**0**

# Getting Rotation X, Y, Z from D3DXMatrixRotationAxis()

Started by Medo3337, May 19 2012 08:11 PM

3 replies to this topic

Sponsor:

###
#2
Members - Reputation: **1174**

Posted 20 May 2012 - 03:47 PM

Hi!

Extracting those angles is a rather laborious procedure, since you have to deal with singularities. What do you need the angles for?

The following is from John J. Craig: Introduction to Robotics. Page 47f, Addison-Wesley Publishing Company, Reading, Mass. 1989, ISBN 0-201-09528-9.

Given a rotation matrix R:

The angles are:

With being roll, being pitch and being yaw.

Now the singularities:

If then

If then

Or you can look at this.

Best regards!

Extracting those angles is a rather laborious procedure, since you have to deal with singularities. What do you need the angles for?

The following is from John J. Craig: Introduction to Robotics. Page 47f, Addison-Wesley Publishing Company, Reading, Mass. 1989, ISBN 0-201-09528-9.

Given a rotation matrix R:

The angles are:

With being roll, being pitch and being yaw.

Now the singularities:

If then

If then

Or you can look at this.

Best regards!

**Edited by Tsus, 20 May 2012 - 03:48 PM.**

###
#3
Members - Reputation: **891**

Posted 20 May 2012 - 06:08 PM

I think you misunderstood my question, I don't want to extract Pitch Yaw Roll from the rotation matrix, rather I have the following two variables:

How can I get Pitch Yaw Roll from the two variables "

D3DXVECTOR3 axis;

FLOAT angle;

I use those variables to get the rotation by using:

D3DXMatrixRotationAxis(&rotation, &axis, angle);

How can I get Pitch Yaw Roll from the two variables "

D3DXVECTOR3 axis;" and "

FLOAT angle;

"?###
#4
Members - Reputation: **1174**

Posted 20 May 2012 - 06:20 PM

Sorry, I forgot to mention. I'd have used the matrix as some sort of detour to get to the angles.

I guess the conversion from (axis, angle) to (yaw, pitch, roll) is probably a little more complicated.

So instead, I’d suggest to go from (axis, angle) to (rotation matrix) to (yaw, pitch, roll).

So, first, create the 4x4 matrix with D3DXMatrixRotationAxis(&rotation, &axis, angle); as you already had.

Then, only consider the top-left 3x3 matrix as only this part contains the rotation part.

Best regards

I guess the conversion from (axis, angle) to (yaw, pitch, roll) is probably a little more complicated.

So instead, I’d suggest to go from (axis, angle) to (rotation matrix) to (yaw, pitch, roll).

So, first, create the 4x4 matrix with D3DXMatrixRotationAxis(&rotation, &axis, angle); as you already had.

Then, only consider the top-left 3x3 matrix as only this part contains the rotation part.

Best regards