POV-Ray : Newsgroups : povray.advanced-users : REQ: reorienting a vector : Re: REQ: reorienting a vector Server Time
30 Jul 2024 14:29:13 EDT (-0400)
  Re: REQ: reorienting a vector  
From: Margus Ramst
Date: 25 Apr 1999 09:31:41
Message: <37230b2d.0@news.povray.org>
Thank you, this is perfect.
One of these days I'm sure I'll learn to use vdot... Maybe. I hope.

Margus

Ronald L. Parker wrote in message <372379f4.216088045@news.povray.org>...
>
>Ah, okay, that's actually how I read it at first, but I couldn't
>imagine why you would need such a thing so then I assumed that you
>really wanted the Reorient macro.  I can get you an angle and an axis,
>which you can use with vaxis_rotate(), if you'd like.  This isn't
>tested, so it may be faulty.  In particular, you may have to fix the
>sign on the angle. (It's times like this that I don't trust a
>left-handed coordinate system.)  You may, of course, get rid of all
>the intermediate local variables and make this a one-liner.
>
>#macro vvec_rotate( Vec, RefA, RefB )
>  #local nA = vnormalize(RefA);
>  #local nB = vnormalize(RefB);
>  #local axis = vcross(nA,nB);
>  #local angle = degrees(atan2(vlength(axis),vdot(nA,nB)));
>  vaxis_rotate( Vec, axis, angle );
>#end
>
>


Post a reply to this message

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