POV-Ray : Newsgroups : povray.general : computed rotate in macros : computed rotate in macros Server Time
12 Aug 2024 09:23:19 EDT (-0400)
  computed rotate in macros  
From: John M  Dlugosz
Date: 28 Feb 1999 14:14:18
Message: <36d9958a.0@news.povray.org>
Here is the situation:  A macro will create an object, and one of the
parameters specifies the "up" vector of the desired object.  The macro will
generate an object initially at the origin with a hard-coded "up" direction
(say, +y) and then translate/rotate into the final location.  Translate is
easy.  How about rotate?  In this case, I want to compute the arguments to
'rotate' so that what was +y now points paralell to the Up parameter.

The axis of rotation would be the cross product of the old and new up's.
The angle can also be figured from this (I don't know the formula off hand,
but it's not a big mystery).  BUT, POV wants a rotate command giving x,y,z
component angles.  There isn't a form to rotate (the enclosing object) by a
specific amount along a specified axis.

Anyone have the answer?

TIA,
--John


Post a reply to this message

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