POV-Ray : Newsgroups : povray.general : vrotate? : Re: vrotate? Server Time
30 Jul 2024 10:22:24 EDT (-0400)
  Re: vrotate?  
From: Chris B
Date: 5 Mar 2009 04:39:46
Message: <49af9de2@news.povray.org>
"[GDS|Entropy]" <gds### [at] hotmailcom> wrote in message 
news:49af84d0$1@news.povray.org...
> I'm looking through the docs and see that vrotate *seems* to do what I'm 
> looking for; that is to have a vector A which is rotated by a vector B.
>

It rotates vector A around the origin by the number of degrees specified by 
vector B, returning a vector. It rotates by B.x followed by B.y then B.z.
Is that what you want to do?


> So this would mean that if I have two vectors, say the top and bottom of a 
> cyl, that I could, using vrotate, arbitrarily rotate the top of the cyl 
> while leaving the bottom in place?
>

You can use it to help you do that. You need to be a little careful because 
you are talking about rotating one location vector around another location 
vector and vrotate rotates around the origin, so you need to compensate for 
that. You can use NewTop = vrotate(CylTop-CylBot,<30,0,0>)+CylBot; Then you 
can use NewTop and CylBot to define a cylinder object.


> If so, sweet, and can vrotation be used to determine the effect of 
> vrotate?

VRotation can indeed give you the angle between two direction vectors in 
Radians. To use it with CylTop and CylBot you still need to work on the 
difference between these positions to get a direction vector. Use VRotationD 
if you want to work in degrees. These can't reveal the original 3 angles 
used to rotate the vector in the first place.


> Would vcross give the perpendicular axis needed in vrotation, if its 
> inputs were vector A and vector B from above?

You can use vcross or VPerp_To_Plane to give you an axis that's 
perpendicular to two direction vectors (which you need for vrotation). You 
wouldn't want to use A and B from above as input because A is a direction 
vector, B is a vector containing 3 angles in degrees. You could use 
(CylTop-CylBot) and (NewTop-CylBot) which provides two direction vectors.


Regards,
Chris B.


Post a reply to this message

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