POV-Ray : Newsgroups : povray.newusers : Re: How to transform box<0 , 1> to box<p1 , p2>? Server Time
30 Jul 2024 08:16:30 EDT (-0400)
  Re: How to transform box<0 , 1> to box<p1 , p2>? (Message 1 to 5 of 5)  
From: D  H  Berlin
Subject: Re: How to transform box<0 , 1> to box<p1 , p2>?
Date: 22 Aug 2004 07:55:00
Message: <web.4128883bbaeff42344ab2cfe0@news.povray.org>
#include "math.inc"
#macro dabox(p1,p2)
 box{0, 1 texture {boxhm}
     scale vlength(p2-p1)
     rotate vcross(1,p2)*VRotationD(1, p2, vcross(1,p2))
     translate p1
 }
#end


With textures:

#include "colors.inc"
#include "metals.inc"
#include "woods.inc"
#include "math.inc"
#declare box_holz = texture {T_Wood10 scale 1 rotate y*20 };
#declare box_metal = texture {T_Silver_3D};
#declare box_metal_ab = 0.85;
#declare boxhm =
    texture {
      function{sqrt(y*y+(1-z)*(1-z))}
      texture_map {
        [ 0.0 box_holz ]
        [ box_metal_ab box_holz ]
        [ box_metal_ab*1.0107 box_metal ]
        [ 1 box_metal ]
      }
    };
#macro dabox(p1,p2)
 box{0, 1 texture {boxhm}
     scale vlength(p2-p1)
     rotate vcross(p1,p2)*VRotationD(p1, p2, vcross(p1,p2))
     translate p1
 }
#end


Post a reply to this message

From: D  H  Berlin
Subject: Re: How to transform box<0 , 1> to box<p1 , p2>?
Date: 22 Aug 2004 08:05:01
Message: <web.41288b23baeff42344ab2cfe0@news.povray.org>
Oh! Didn't want to start a new thread.
And the first line got lost:
"Well my first try by myself: but it doesn't work.
"
 :)


Post a reply to this message

From: D  H  Berlin
Subject: Re: How to transform box<0 , 1> to box<p1 , p2>?
Date: 22 Aug 2004 08:50:00
Message: <web.41289585baeff42344ab2cfe0@news.povray.org>
I have chosen another way to solve this:

#macro dabox(bd,yrot,p1)
// bd: <width,height,deepnes>;    yrot: -> orientation;     p1: box-corner
bottom left
 box{0, 1 texture {boxhm}
     scale bd
     rotate y*yrot
     translate p1
 }
#end

Greetings
Dieter


Post a reply to this message

From: incognito
Subject: Re: How to transform box<0 , 1> to box<p1 , p2>?
Date: 22 Aug 2004 15:35:01
Message: <web.4128f459baeff42355d024bf0@news.povray.org>
Not sure if this answers the question but if you declare the box to be an
object, you can then rotate that object to the desired orientation.

Hope this helps.


"D. H. Berlin" <wee### [at] PoVStefaniede> wrote:
> I have chosen another way to solve this:
>
> #macro dabox(bd,yrot,p1)
> // bd: <width,height,deepnes>;    yrot: -> orientation;     p1: box-corner
> bottom left
>  box{0, 1 texture {boxhm}
>      scale bd
>      rotate y*yrot
>      translate p1
>  }
> #end
>
> Greetings
> Dieter


Post a reply to this message

From: D  H  Berlin
Subject: Re: How to transform box<0 , 1> to box<p1 , p2>?
Date: 22 Aug 2004 15:55:00
Message: <web.4128f8f7baeff42317b111d50@news.povray.org>
"incognito" <nomail@nomail> wrote:
> Not sure if this answers the question but if you declare the box to be an
> object, you can then rotate that object to the desired orientation.
>
> Hope this helps.

I figured out that it is important always to use the same scheme for the
coordinates p1 and p2: for example p1 always front bottom left corner and
p2 backward upper right corner
Then I could just the way I'm doing it now. (Instead of using mathematics I
don't understand. :)

Greetings
Dieter


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.