PDA

View Full Version : rotate about vector axis


mrMotion
02-25-2005, 02:56 PM
I'm working on a constraint-node for Maya, and I want to rotate a vector point with another vector as axis... I have done the same using mel-expression:
rot( $vector1, $vector2, $degrees );

How do I do the same using Maya API?

daniel_arz
03-04-2005, 05:09 AM
3d Math Primer pg 110. Derive a matrix to rotate v about n. In other words, derive the matrix R(n, @) such that vR(n, @) = v'


v' = cos @ ( v - ( v dot n ) n ) + sin @( n cross v) + (v dot n)n


D

mrMotion
03-04-2005, 06:05 AM
Thanx... I just ordered that book :)
This is also a great resource which has helped me a lot!: http://mathworld.wolfram.com/

rendermaniac
03-04-2005, 09:46 AM
Rotations can become a bitvh very quickly. Using the cross roduct to get the vector to rotate about, and then the dot product for the angle is the easiest way. This will give you the shortest rotation which is generally good until you need a smooth rotation for animation and you will have to seriously consider quaternions. Quaternions also avoid gimbal lock.

I find that the Matrix and Quaternion FAQ (http://www.flipcode.com/documents/matrfaq.html) and Martin Baker's Euclidean Space (http://www.euclideanspace.com/maths/geometry/rotations/) websites are very good resources for this sort of thing.

Simon

playmesumch00ns
03-04-2005, 09:57 AM
Just use Imath!

daniel_arz
03-04-2005, 04:24 PM
Just use Imath!
Hi playmesumch00ns,

Is Imath software? Nothing relevant pops up in Google.

D

rendermaniac
03-04-2005, 06:01 PM
Imath is a free library included with OpenEXR from ILM. You can download it from http://www.openexr.com/

Simon

daniel_arz
03-04-2005, 06:28 PM
Imath is a free library included with OpenEXR from ILM. You can download it from http://www.openexr.com/



THANKS RENDERMANIAC!!!

daniel_arz
03-04-2005, 07:00 PM
Hi Rendermaniac,
Do you have any sample code that you could show us? For example, how would you rotate one point around a vector using Imath?

Daniel

CGTalk Moderation
03-04-2005, 07:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.