# General Math

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

## 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 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 DE F G HI J K LM 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 TR R R TR R R TP P P 1

or the transpose of that
R R R PR R R PR R R PT 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 + TxR3 R4 R5 Ty | Y  = R3X + R4Y + R5Z + Ty   R6 R7 R8 Tz | Z  = R6X + R7Y + R8Z + TzP0 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.

1. 1
Rutin
37
2. 2
3. 3
4. 4
5. 5

• 11
• 12
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
633348
• Total Posts
3011461
• ### Who's Online (See full list)

There are no registered users currently online

×