PDA

View Full Version : Rotation about an arbitrary axis



WillieD
11-25-2005, 03:15 AM
Hi all!

I have created a matrix to rotate about an arbitrary axis. The matrix is right(I have checked it in the internet)

The problem is when i use it like this:

SetupMatrixRotateAxis(matrix, axis.x, axis.y, axis.z, angle); // where axis.x = axis.y = 1, axis.z = 0
glMultMatrix(matrix);
..
..
..

angle += 0.1;

the object seems to be rotated about 1, 1, 0 axis but also is scaled in x, y directions

Can anyone tell me what is happening?

Bob
11-25-2005, 03:29 AM
Something is obviously wrong with the matrix since you get some scaling effect in a rotation matrix. Post the code for SetupMatrixRotateAxis.

memfr0b
11-25-2005, 04:48 AM
Did you normalize the rotation axis? The x, y and z values used to construct the rotation matrix must form a unit vector, or the matrix will contain a scaling.

dmy
12-06-2005, 05:00 PM
also pay attention to major/minor row order...