3D Matrix (4x4) or (3x3) ?

Started by
2 comments, last by relsoft 18 years, 9 months ago
Reading through a tutorial i learned that in 3D space the matrix math helps to represent it as x,y,z,w. That is a matrix of 4 x 4. It says that the extra W (Values 0001 at the bottom of the matrix) helps make things like movement easier to deal with and that the value of W will always be 1. But i don't understand what this additional row 4 i.e. 0001 has to do in the calculation when its value is always 1 and how it results in easier movement. what will happen if we remove row 4 making the matrix 3 x 3 and do the matrix multiplication. Any help! Row 1 - > 1 0 0 0 Row 2 - > 0 1 0 0 Row 3 - > 0 0 1 0 Row 4 - > 0 0 0 1 Thanks & Regards, Pramod
Advertisement
The reason is that you can merge rotation/scaling with translation if you use a 4x4 basicly you have

? ? ? tx? ? ? ty? ? ? tz0 0 0 1


doing away with it and just using a 3x3 means handling translation separatly and that's not nearly as elgant.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
Thanks for the reply. Let me take an example for addition. Let be tx=5, ty=5 and tz=5. This would add 5 to x, y and z.

Row 1 - 0 1 0 0 tx -> ( x' = x + tx )
Row 2 - 0 0 1 0 ty -> ( y' = y + ty )
Row 3 - 0 0 0 1 tz -> ( z' = z + tz )
Row 4 - 0 0 0 1

and here i got new values for x,y,z in x',y',z' after the addtion. Now what row 4 has to do here as i have already got the new required values. i am sorry i am little weak in maths!. i know that i am trying to understand something, which is difficult for me do. But it seems it would be really interesting if i understand it completely.

Thanks

pramod
Row 4 makes you matrix homogeneous.

Like: ax'' + bx' + c = 0

So your right vector would look like:

rx + ry + rz = 0

That 1 on the 4,4th element is the Homogeneous coordinate wich is W:

(g(x) - (f(x))/ W

I made this little tute in my DOS days, but it should get you some ideas.

Warning: The matrix there is Row major order unlike OpenGL which is collumn order.

Cut n' paste. :*(

http://www.phatcode.net/articles.php?id=215

http://www.phatcode.net/articles.php?id=216
Hi.

This topic is closed to new replies.

Advertisement