Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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: 671

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: 1047

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: 671

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: 1047

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