Page 1 of 1

libnds and the new rotation matrix

Posted: Sat Jan 24, 2009 11:43 pm
by Rajveer
I'm not quite sure I understand the rotation bug fixed in the newest libnds. For my previous source, I was using 4x3 matrices for each object, so:

A[0,1,2] = x-axis (x1, x2, x3)
A[3,4,5] = y-axis (y1, y2, y3
A[6,7,8] = z-axis (z1, z2, z3)
A[9,10,11] = translation (t1, t2, t3)

which I'm guessing if the rotation matrix was incorrectly transposed, looked like this:

x1 x2 x3 t1
y1 y2 y3 t2
z1 z2 z3 t3

So if it's been fixed i.e. transposed, it should now be:

x1 y1 z1 t1
x2 y2 z2 t2
x3 y3 z3 t3

which means:

x-axis = A[0,3,6]
y-axis = A[1,4,7]
z-axis = A[2,5,8]

right? So I just have to change each axis to the correct value now in my calculations?

I thought the proper OpenGL format was that each axis was contiguously stored in a 16-value array, with the translation in the 13th, 14th and 15th, so this can't be right no? I've confused myself :S

Re: libnds and the new rotation matrix

Posted: Sun Jan 25, 2009 1:51 pm
by dovoto
The code to calculate the rotation was using a left handed rotation which was causing the rotations to be backwards. The only change to the code was:

http://devkitpro.svn.sourceforge.net/vi ... f_format=h

Re: libnds and the new rotation matrix

Posted: Sun Jan 25, 2009 6:06 pm
by Rajveer
Aha, this shouldn't actually effect my code then. Great, thanks :)