Quaternions: 2 different definitions????

Hey Guys,

I am trying to understand quaternions.
I am using a book called: “Mathematics for Computer Graphics” and the NEHE-Tutorial.
Nehe_Quaternion
But after looking closely i have seen that they have 2 different Quaternion definitions.
The + changes to -, when the position of two coefficients is changed.
It would make sense, if this were two imaginary digits but s is real.

Can i assume that it is the same?

But i dont understand why the unsign is changing, when i multiplicate an imaginary with a real digit.

I thought that the multiplication of two imaginary digits is not commutative.

Is it the same with imaginary digits and real ones?

Thanks


BOOK                  |  NEHE               |  Difference |
------------------------------------------------------------
M11 = 1 - 2(yy + zz)  |  1 - 2(yy + zz)     |    
M12 = 2(xy - sz)      |  2(xy + zs)         |  X          
M13 = 2(xz + sy)      |  2(xz - ys)         |  X          
M14 = 0               |  0                  |             
------------------------------------------------------------
M21 = 2(xy + sz)      |  2(xy - zs)         |  X          
M22 = 1 - 2(xx + zz)  |  1 - 2(xx + zz)     |  
M23 = 2(yz - sx)      |  2(zy + xs )        |  X
M24 = 0               |  0                  |
------------------------------------------------------------
M31 = 2(xz - sy)      |  2(xz + ys)         |  X  
M32 = 2(yz + sx)      |  2(yz - xs)         |  X
M33 = 1 - 2(xx + yy)  |  1 - 2( xx + yy )   |
M34 = 0               |  0                  |
------------------------------------------------------------
M41 = 0               |                     |
M42 = 0               |                     |
M43 = 0               |                     |
M44 = 1               |                     |
------------------------------------------------------------

Math is not my strong point, but I want to say that since it is not commutative, flipping the variable changes the sign.

The question is, does each method give you the same result?

Your “Mathematics for Computer Graphics” and the NeHe tutorial both use different conventions. Since it’s a math book, odds are your math book uses column-major conventions. Whereas NeHe, since it’s a tutorial for using graphics hardware, uses row-major conventions (since that’s what most graphics hardware uses).

Invert the matrix from your book, and you’ll find it matches with the tutorial.