Euler angle order in dMatrix::GetEulerAngles()

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Euler angle order in dMatrix::GetEulerAngles()

Postby misho » Thu Apr 05, 2018 10:53 pm

I've recently upgraded from a year-old Newton to the latest and greatest. Everything went smooth, except one thing dMatrix::GetEulerAngles(), which was, from what I can see, re-arranged a bit.

dMatrix::GetEulerAngles() takes dEulerAngleOrder parameter, and Newton defines it as two possible combinations:

m_pitchYawRoll
m_rollYawpitch

There are actually 4 other combinations, which complete all possible permutations of Pitch, Yaw and Roll. In my project, the way the coordinate systems are set up, I have to use YPR and RPY permutations, which are not included in Newton. So, in order to overcome this: in dMathDefines.h, I add 4 additional options (plus, re-insert 2 Newton ones with my naming convention, for clarity):

Code: Select all
enum dEulerAngleOrder
{
   m_pitchYawRoll,
   m_pitchRollYaw,
   PYR = (0 << 8) + (1 << 4) + (2 << 0),
   PRY = (0 << 8) + (2 << 4) + (1 << 0),
   RYP = (2 << 8) + (1 << 4) + (0 << 0),
   RPY = (2 << 8) + (0 << 4) + (1 << 0),
   YPR = (1 << 8) + (0 << 4) + (2 << 0),
   YRP = (1 << 8) + (2 << 4) + (0 << 0)
};


This worked fine, since the year-old Newton dMatrix::GetEulerAngles() function had:

Code: Select all
   int a0 = (order>>8)&3;
   int a1 = (order>>4)&3;
   int a2 = (order>>0)&3;


However , the most recent version switched to switch-case blocks, so I had to revert to a year-old method for the time being.

Can this please be addressed? I think Newton should offer all 6 Euler angle order permutations, since there are a lot of graphical engines with all kinds of coordinate system conventions (case in point - mine!) and therefore Newton should have the utmost in flexibility to support all possible cases.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests

cron