Jump to content
  • Advertisement
Sign in to follow this  
disruptive

Rotation Matricies

This topic is 3977 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I have a 3D object. I would like to perform a 3D rotation about its COM (centre of mass), in terms of theta and phi. Not about the axes. I did have a piece of code to do this, but have lost the official reference for where I saw this worked out in more detail. I know it was a coupled combination of a rotation by theta and then phi for example. Can anyone point me to a good source of information on this. Thanks Dis

Share this post


Link to post
Share on other sites
Advertisement
theta and phi are just greek symbols; they could represent whatever you want depending on the context, but they are commonly used in textbooks to represent the angles in polar coords.

I'm guessing that you want to look into Polar Coordinates? or something along those lines?


EDIT:
Ignore 'polar coords' I was probably thinking of 'Spherical Coordinates' as haegarr mentions below. (when you don't use either of them much, its easy to forget the right terms)

[Edited by - haphazardlynamed on January 17, 2008 11:11:52 PM]

Share this post


Link to post
Share on other sites
In this case of 2 angles in 3D world I would assume the OP is speaking of the 2 angles of spherical co-ordinates (with the radius implicitely defined to be 1). Google knows plenty of pages about "spherical coordinates" (~375k hits). They are much more informative and illustrated than I can do here. But be observant that the formulas differs in details (not in structure) dependend on e.g. what axis is the "zero angle axis".

I don't know whether direct conversion to matrices exists. Using spherical co-ordinates just to compute cartesian co-ordinates yields in the target vector only. In that case the usual cross- and dot-product way of computing the axis/angle rotation representation, and the also usual matrix conversion routine can be used.

EDIT: To rotate about the COM, the rotation matrix has to be surrounded by translations. Assuming that the object's mesh is given in its own local co-ordinate frame, the object 1st has to be translated so that the COM rests at (0,0,0). After the rotation those translation has to be undone. I.e. if using column vectors, and T denotes the local COM, and R the rotation, then
T * R * T-1
is the entire thing (reverse the order for using row vectors).


[Edited by - haegarr on January 17, 2008 2:34:03 AM]

Share this post


Link to post
Share on other sites
The problem relates to the fact that I have implemented code to perform rigid body rotations about the COM of the object. However most textbooks (that I can find) only simply use rotations about the axes - whereas this implementation is more generic in that we perform rotations about the C.O.M. I cannot remember since I have lost the original reference and was hoping that I would find something that would jog my memory of how to do it again from first principles.

Hope this helps or I could be pointed in the right direction.

Thannks

Share this post


Link to post
Share on other sites
Quote:
Original post by disruptive
The problem relates to the fact that I have implemented code to perform rigid body rotations about the COM of the object. However most textbooks (that I can find) only simply use rotations about the axes - whereas this implementation is more generic in that we perform rotations about the C.O.M. I cannot remember since I have lost the original reference and was hoping that I would find something that would jog my memory of how to do it again from first principles.

Hope this helps or I could be pointed in the right direction.

Thannks

First of all, your thinking here is a little muddled. You speak about rotating around the COM (a point) rather around "the axes". A rotation is always around a particular point--the center of rotation, which falls out as an eigenvector--as well as relative to a particular set of axes (the basis for the axis of rotation). What it sounds like you're running into is that the order of your rotations is relative to the world axes (aka the world coordinate system), rather than to the object-local coordinate system. To get local as opposed to global rotations, just do them in the opposite order. That is, a local series of X Z Y rotations is equivalent to a global series of Y Z X rotations.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!