Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Aviation coordinates(NED) to OpenGL

This topic is 2921 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working with an sensor board , similar to WII remote. It gives 3D rotation( attitude) with respect to NED ( North East Down ) which means body (aircraft) nose is +X , right wing is +Y , down to earth is +Z.
OpenGL uses Up Y coordinate system( Both can be seen in attached image).I get euler angles(roll, pitch, yaw) from sensor board. see here Sensor video & code .
If i set upvector (0,0-1) in glLookAt function, the coordinate system becomes Towords Viewr +X, Left +Y , Down +Z. Then i will construct Rotationmatrix (- Roll, -Pitch, Yaw) .

void RotationMatrix (dMatrix3x3 &A, double r, double p, double y)
// Order (ZYX)
double sx = sin®, cx = cos®;
double sy = sin(p), cy = cos(p);
double sz = sin(y), cz = cos(y);
A[0][0] = cy*cz; A[0][1] = sy*sx*cz - sz*cx; A[0][2] = sy*cx*cz + sz*sx;
A[1][0] = cy*sz; A[1][1] = sy*sx*sz + cz*cx; A[1][2] = -cz*sx + sy*cx*sz ;
A[2][0] = -sy; A[2][1] = cy*sx; A[2][2] = cy*cx;
if i apply this rotation matrix, it works perfect since i changed glLookAt & angles negated to suit Sensor board coordinate system.

Now, I don't want to change OpenGL upvector in glLookAt , i want to leave it as it is (0,1,0) and want to apply this rotation matrix to object. The object rotation is not intuitive since coordinate system doesn't match.
Please see the attached image.
How can i make the object rotation intuitive without changing glLookAt ?
I read a paper which talks about this issue, but could not understand. See the 4th section in attached paper .
Someone here tell me how ?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!