Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL Superbible linear algebra - is this correct?

I recently started reading OpenGL Superbible 5th edition and noticed the following:

Equation in question

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.

like image 384
Stephen Melvin Avatar asked Aug 15 '10 21:08

Stephen Melvin


3 Answers

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.

like image 157
duffymo Avatar answered Nov 09 '22 20:11

duffymo


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.

like image 22
Calvin1602 Avatar answered Nov 09 '22 20:11

Calvin1602


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.

like image 1
Middleware Avatar answered Nov 09 '22 22:11

Middleware