Archived

This topic is now archived and is closed to further replies.

Jankey

Rotating Point a Point a 3 Axes

Recommended Posts

A vertex is a vector. A specific type of vector. It is a position vector. You rotate a vertex by multiplying a matrix by a column vector or a row vector by a matrix. You don''t use the same matrix for both, but rather one is the a transpose of the other. I believe there are tutorials under Articles & Resources on how to multiply two matrices or a matrix by a row or column vector. There are also tutorials on how to construct various matrices for various purposes. The devrivation of things like projection and axis angle matrices is quite complex.

A rotation matrix for rotating around the primary axes is quite simple. It is the addition and subtraction formulas from trig, i.e. sin(a+b) and cos(a+b). A is the angle of the current point and b is the amount you are rotating by. In 2D the current position is x=r*cos(a) and y=r*sin(a) where r is the distance from the origin. After rotation it is x''=r*cos(a+b) and y''=r*sin(a+b). The addition formulas give you sin(a+b)=sin(a)*cos(b)+cos(a)*sin(b) and cos(a+b)=cos(a)*cos(b)-sin(a)*sin(b). So x''=r*cos(a+b)=r*cos(a)*cos(b)-r*sin(a)*sin(b), but x=r*cos(a) and y=r*sin(a) so x''=x*cos(b)-y*sin(b) and similarly for y''. If you look at how you multiply a matrix by a vector then it becomes obvious why you build a rotation matrix as you do. The reason you multiply two matrices as you do is because that is what is useful. One of the many benefits is that when you multiply two rotation matrices together you get something useful instead of garbage as you would if it was defined differantly.

Share this post


Link to post
Share on other sites