View Full Version : rotate about vector axis
mrMotion 02252005, 03:56 PM I'm working on a constraintnode for Maya, and I want to rotate a vector point with another vector as axis... I have done the same using melexpression:
rot( $vector1, $vector2, $degrees );
How do I do the same using Maya API?


daniel_arz
03042005, 06: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
03042005, 07: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
03042005, 10: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
03042005, 10:57 AM
Just use Imath!
daniel_arz
03042005, 05:24 PM
Just use Imath!
Hi playmesumch00ns,
Is Imath software? Nothing relevant pops up in Google.
D
rendermaniac
03042005, 07:01 PM
Imath is a free library included with OpenEXR from ILM. You can download it from http://www.openexr.com/
Simon
daniel_arz
03042005, 07: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
03042005, 08: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
03042005, 08: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.
vBulletin v3.0.5, Copyright ©20002014, Jelsoft Enterprises Ltd.