Solved

quaternion to euler-angles conversion

Posted on 2004-08-19
1
2,109 Views
Last Modified: 2013-12-26
hey guys, im working with a quaternion-class to store and to handle my rotations, in that class
i have a conversion method to make a quaternion from eulers:

where eulers are given:
pitch -> rotation around x-axis
yaw -> rotation around y-axis
rool -> rotation around z-axis

the eulers where made with Y-rotation first, then X-rotation, then Z-rotation,
that's why the method has the suffix "YXZ", here it is:

void CQuaternion::MakeFromEulerYXZ( const CEulerAngles &rot )
{
      const float fltPitch2 = rot.GetPitch() * 0.5f;
      const float fltYaw2   = rot.GetYaw() * 0.5f;
      const float fltRoll2  = rot.GetRoll() * 0.5f;

      const float cosY2 = g_Math.Cosf( fltYaw2 );
      const float sinY2 = g_Math.Sinf( fltYaw2 );
      const float cosP2 = g_Math.Cosf( fltPitch2 );
      const float sinP2 = g_Math.Sinf( fltPitch2 );
      const float cosR2 = g_Math.Cosf( fltRoll2 );
      const float sinR2 = g_Math.Sinf( fltRoll2 );

      x = cosR2 * sinP2 * cosY2 + sinR2 * cosP2 * sinY2;
      y = cosR2 * cosP2 * sinY2 - sinR2 * sinP2 * cosY2;
      z = sinR2 * cosP2 * cosY2 - cosR2 * sinP2 * sinY2;
      w = cosR2 * cosP2 * cosY2 + sinR2 * sinP2 * sinY2;
}

now i need the reverse conversion, from quaternion to euler, which means
x,y,z,w are given and i need the eulers( pitch, yaw, roll)

any suggestions?




0
Comment
Question by:ikework
1 Comment
 
LVL 45

Accepted Solution

by:
sunnycoder earned 350 total points
ID: 11849510
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now