POV-Ray : Newsgroups : povray.advanced-users : Speaking of Mathematics : Re: Speaking of Mathematics Server Time
28 Jul 2024 16:17:40 EDT (-0400)
  Re: Speaking of Mathematics  
From: Captain Chemistry
Date: 7 Dec 2004 02:15:00
Message: <web.41b55745864be4ea301d03a70@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote:
> > #local rx = degrees(acos(vdot(d, <0, d.y, d.z>)));
> > #local ry = degrees(acos(vdot(d, <d.x, 0, d.z>)));
> > #local rz = degrees(acos(vdot(d, <d.x, d.y, 0>)));
>
> I'm not sure exactly what you were trying to do here (I'm sure there's logic
> to it but I'm just not following it), but chances are after you do the
> rotate rx*x (if that's what you're doing), the ry and rz rotations are no
> longer useful for the object's new position.
>
> Another thing to consider is that only two rotations should be needed to
> make an object point in a certain direction. (This is because a direction
> can be represented as a point on the surface of the unit sphere, and the
> surface of a sphere is 2 dimensional.) For instance, if an object is
> pointing in the positive x direction, a rotation between -90 and +90 degrees
> around the z axis, followed by a rotation between -180 and +180 degrees
> around the y axis is enough to orient the object in any direction. (A
> rotation around the x axis could be done before either of these to have
> control over how the object is rotated around the axis it's going to point
> in.)
>
> In any case, there's no point (besides educational reasons) to go through
> all this work, since you can just use the Reorient_Trans macro in
> transforms.inc to do what you want. (The macro doesn't use rotations, it
> instead creates a matrix transformation; this is a more straightforward way
> of approaching the problem if you understand the math.)
>
>  - Slime
>  [ http://www.slimeland.com/ ]

I'm not adding anything new here, just saying that the Reorient_Trans marco
is good and it works.


Post a reply to this message

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