Sign in to follow this  

General Math

This topic is 3725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey folks, I'm a big fan of this forum, you guys helped me a lot, and of the GameProgramming Gems series... Something came to my attention in the last few weeks: How is matrix multiplication correctly written in English? And: How to write a matrix? I'm not a native english speaker but in germany a matrix is: R R R T R R R T R R R T P P P 1 with R being a Rotation matrix and P the projective part, T is the translation (OK, I left out the scaling which is in main diagonal...) I sometimes stumble across source code and forums posts, where the whole thing is transposed. And even worse (cause it took me some days to find the bug in my code): the multiplication is done differently in some areas??? I know that when I have a matrix R (Rotation), T (Translation) and a vector v, that v_new = T*R*v means: First Rotate then Translate. I was planning to emigrate to some other country sooner or later, so it would be nice if someone could acknowlege these things or tell me the way it is done in other countries... zqueezy

Share this post


Link to post
Share on other sites
Matrices (and math) aren't really locale-aware. Your definition of a matrix is flawed. A (4x4) matrix is:

A B C D
E F G H
I J K L
M N O P

and those values have no meaning without a context. The context you are assuming is a 4x4 matrix representing a generalized transformation in most computer graphics domains. Recall than to multiply two matrices, the inner dimensions must be equal (AxN * NxB). So whether or not the matrix has the meanings you specify

R R R T
R R R T
R R R T
P P P 1

or the transpose of that

R R R P
R R R P
R R R P
T T T 1

depends on whether the context in question assumes vectors are "columns" or "rows" and whether they're multiplied on the left or the right. You're probably used to seeing the vector on the left, written as a column:

R0 R1 R2 Tx | X = R0X + R1Y + R2Z + Tx
R3 R4 R5 Ty | Y = R3X + R4Y + R5Z + Ty
R6 R7 R8 Tz | Z = R6X + R7Y + R8Z + Tz
P0 P1 P2 1 | 1 = P0X + P1Y + P2Z + 1

You could also express the same transformation using the context where vectors are rows, and show up on the right:

X Y Z 1 | R0 R3 R6 P0 = R0X + R1Y + R2Z + Tx, R3X + R4Y + R5Z + Ty, ...
R1 R4 R7 P1 \__________________/ \__________________/
R2 R5 R8 P2 | |
Tx Ty Tz 1 X component Y component

Note how the resulting vector is the same (if you bother to expand out the rest of the terms; I got lazy and I think I'd run out of space.

Share this post


Link to post
Share on other sites

This topic is 3725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this