|
|
"Slime" <fak### [at] emailaddress> wrote:
> You can simply use atan2( vect.y, vect.x ). Note that this is equivalent to
> atan( vect.y / vect.x ) but avoids the problem of division by zero.
>
> This will give you the angle in radians. If you want it in degrees, use
> degrees( atan2( vect.y, vect.x ) ).
>
> - Slime
> [ http://www.slimeland.com/ ]
yep... much better. I had no idea how to make that, THANKS!! but... here's the
problem I've been trying to avoid:
#include "colors.inc"
#include "math.inc"
#declare vect = <-1,1,0>;
camera{
location <0, 0, -10>
look_at 0
angle 30
}
light_source{ <2,20,-20> White }
sphere { 0 .025 pigment { rgb <0,0,1> }} // ORIGIN
sphere { vect .025 pigment { rgb <1,0,0> }}
box { <-.25,0,-.25>, .25 pigment { rgb .5}
scale <.25,1,.25>
rotate <0,0,degrees( atan2( vect.y, vect.x ) )>
}
depending on the quadrant where the vector is the box will point the wrong way.
Couldn't figure out an easy solution for this. Any ideas? Thanks again!
Post a reply to this message
|
|