Sign in to follow this  
dxp

3D Rotation

Recommended Posts

Hi all, does anyone have a link or a document that explains 3D rotation around arbitrary point using a given matrix? I would like to be able to this type of rotation without quaternions if possible. regards, dxp

Share this post


Link to post
Share on other sites
The OpenGL red book has the math, I think, in one of the appendices. But, you can't really rotate around a "point." You need an axis. Therefore, you can rotate about a line through a point, since the line defines an axis.

Here's an online version of an old, old edition of the OpenGL red book:

The OpenGL Programming Guide (aka The OpenGL Red Book)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Maybe you can if you do something like this:
Say the point is position some were in space by a matrix, or just a position.

Pw = Pl * M

Where:
Pw is the point in work space.
Pl is the point is local space.
M is the matrix your are using to take the point in the work

For example Pl could by a hard point in a model, M could be the model world model matrix.

Then if you want to rotate of in general Transform anything locally to that particulate point Say a Camera, a gun, etc
Say the Rotation Matrix is R

Then these are the steps:
-bring the point to the origin by multiplying by the Inverse Matrix
-Apply the Rotation matrix by multiplying by the Rotation Matrix
-Put everything back to where it was by multiplying by the Transform matrix again

in symbols is this
R1 = inv(T) * R * T

R1 is the Rotation matrix you can apply to your object.
The above operation is very common and it is call a similar Transformation.
You can do the In Ogl by just pushing matrices on the stack and it works quite well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this