?
Solved

quaternion to euler-angles conversion

Posted on 2004-08-19
1
Medium Priority
?
2,155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 45

Accepted Solution

by:
sunnycoder earned 1050 total points
ID: 11849510
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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