POV-Ray : Newsgroups : povray.advanced-users : matrix help.... : Re: matrix help.... Server Time
29 Jul 2024 22:29:54 EDT (-0400)
  Re: matrix help....  
From: David Fontaine
Date: 14 Sep 2000 16:42:47
Message: <39C13719.1E81196@faricy.net>
Tor Olav Kristensen wrote:

> > #macro repoint(pt,vec1,vec2)
> >
> >    #if (vlength(vec1)=0)
> >       #render "Warning: reposition initial vector length is zero.\n"
> >    #end
> >    #if (vec1.x=0 & vec1.z=0)
> >       #local RotY=0;
> >    #else
> >       #local RotY=atan2(vec1.x,vec1.z)*180/pi;
> >    #end
> >    #local RotX=asin((vec1.y)/vlength(vec1))*180/pi;
> >
> >    #local pt = vrotate ( pt, <0,-RotY,0>    )
> >    #local pt = vrotate ( pt, <RotX,0,0>     )
> >
> > ... 8< Snip ...
>
> May I suggest using degrees() instead of
> multiplying with 180/pi ?
> E.g.: RotY=degrees(atan2(vec1.x,vec1.z));
>
> You can also write asin(vnormalize(vec1).y)
> instead of asin((vec1.y)/vlength(vec1))

Ah, will do. New version will go up when I update my site.

--
David Fontaine   <dav### [at] faricynet>   ICQ 55354965
Please visit my website:  http://davidf.faricy.net/


Post a reply to this message

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