Reputation: 3785
I recently started reading OpenGL Superbible 5th edition and noticed the following:
Having just taken linear algebra this seemed odd to me. The column vector is of dimension 4x1 and the matrix is 4x4, how is it possible to multiply them together? If the vector were a row-vector and the output were a row vector I agree that it would be possible, but this?
Update: I emailed the author and he said that I was correct. He noticed the order was wrong in the previous edition of the book, however it ended up not being fixed in the 5th edition.
Upvotes: 6
Views: 523
Reputation: 370
It's a common mistake through all the book's matrix-related examples. See LISTING 4.1, the caption says "Translate then Rotate", while both the on book code and the executable sample code show "rotate-then-translate" behavior. Sigh.
Upvotes: 1
Reputation: 9547
This is not a typo or an error, it's a common way in 3D graphics to express vector-matrix multiplications. But mathematically speaking, you are correct : the left vector should be written horizontally. In 3D you will never see this, though.
Upvotes: 3
Reputation: 308988
I agree: it should be a column vector that's pre-multiplied by the identity matrix.
If it's a row vector, then the RHS needs to be a row vector as well to make the dimensions match.
Upvotes: 5