libnds and the new rotation matrix

Post Reply
Rajveer
Posts: 11
Joined: Sat Jan 24, 2009 11:37 pm

libnds and the new rotation matrix

Post by Rajveer » Sat Jan 24, 2009 11:43 pm

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

dovoto
Developer
Posts: 43
Joined: Fri Aug 12, 2005 10:01 pm
Contact:

Re: libnds and the new rotation matrix

Post by dovoto » Sun Jan 25, 2009 1:51 pm

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

Rajveer
Posts: 11
Joined: Sat Jan 24, 2009 11:37 pm

Re: libnds and the new rotation matrix

Post by Rajveer » Sun Jan 25, 2009 6:06 pm

Aha, this shouldn't actually effect my code then. Great, thanks :)

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests