Hi
i called glRotatef(90,0,0,1) then glGetFloatv(GL_MODELVIEW_MATRIX, mv); mv[0] and mv[5] is where cos(90) and should equal 0. but they equal 1.2, why is this? the places in the matrix defined by sin(90) are correct i.e 1. why are the cos(90) incorrect and the sin(90) correct.
then i called glRotatef(180,0,0,1) this time the places defined by cos(180) where correct and the places defined by sin(180) were incorrect(2.4) when sin(90) = 0.
i dont get whats going on. i set up a simple example.
glRotatef(90,0,0,1)
glGetFloatv(GL_MODELVIEW_MATRIX, mv);
CVector3 p2(0,0,0);//the new point
lpos.x = lpos.z = 0;
lpos.y = 5; //the original point
//get the matrix
CVector3 xtrans(mv[0],mv[4],mv[8]);
CVector3 ytrans(mv[1],mv[5],mv[9]);
CVector3 ztrans(mv[2],mv[6],mv[10]);
//transform the point
p2.x = (lpos * xtrans) + (mv[12]);
p2.y = (lpos * ytrans) + (mv[13]);
p2.z = (lpos * ztrans) + (mv[14]);
should put p2 at -5,0,0; and it did when i wrote out the matrices on paper, but in the app i got p2 = -5,6.08,0; and it all comes down to the cos(90) = 1.2 again
im really confused here could someone please help me out,
EDIT: thought id post the z rotation matrix to stop people from haing to look it up
cos(a) -sin(a) 0 0
sin(a) cos(a) 0 0
0 0 1 0
0 0 0 1
x = xCos(a) - ySin(a)
y = xSin(a) + yCos(a)
thanks for your time.
[This message has been edited by break_stuff247 (edited 11-29-2002).]