PDA

View Full Version : Matrix4x4 question

Steve
05-14-2001, 07:15 AM
Hi,

Just a little matrix4x4 question...

I have made some matrix code and started testing it.
I tried this:
Matrix4 a;
a.RotateXYZ(45.0, 0.0, 0.0);
Matrix4 b;
b.Translate(5.0, 5.0, -20.0);
m = a * b;
(As you can see, this is cpp. Matrix4 is a 4x4 matrix class)
Then I see an object in the upper corner.
I do get the same result when I try this:
glTranslatef(5.0, 5.0, -20.0);
glRotatef(45.0, 1.0, 0.0, 0.0);

Does this make sense, as I (in my code) first rotate and then translate,
but in the second example I first translate, and then rotate...

Thanks,

Steven

davepermen
05-14-2001, 08:25 AM
how bout m = b * a ? it should then be the same.. this is the logic of matrizes... funny, not?

its simply cause the first transformation is done at the right part of the equation, means every vertex going through m goes first through a, then trough b ( in my example ) ( or otherway round, HELP, psycho! ) but its simply like that.. if you read redbook and mathbooks then you will see that everything is ok