Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Getting Rotation X, Y, Z from D3DXMatrixRotationAxis()


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 19 May 2012 - 08:11 PM

I have the following lines:
D3DXVECTOR3 axis;
FLOAT angle;
D3DXMatrixRotationAxis(&rotation, &axis, angle);

How can I get the rotation Pitch, Yaw and Roll from the two variables "axis" and "angle"?

Sponsor:

#2 Tsus   Members   -  Reputation: 1062

Like
0Likes
Like

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!

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


#3 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

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:

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 Tsus   Members   -  Reputation: 1062

Like
0Likes
Like

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS