# 3D Rotation

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

## 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 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 on other sites
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.

1. 1
Rutin
24
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 9
• 46
• 41
• 23
• 13
• ### Forum Statistics

• Total Topics
631748
• Total Posts
3002030
×