Jump to content

  • Log In with Google      Sign In   
  • Create Account


Help! Extracting angles from a rot Matrix, or quaternion?


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
5 replies to this topic

#1 Dario1986   Members   -  Reputation: 143

Like
0Likes
Like

Posted 06 November 2012 - 05:10 AM

Hello people,

First of all, i say i'm new here but i have been reading you for many years. I'm not used to ask for help but this time I really need it. Let's see.

I'm building a tool where - among other things - you can create a segment of frames for a model where you give a StartFrame and an end Frame as input. The animation segment as you all know is done calling the SLERP function. The problem is easy, I need to get back the set of angles from each of the interpolated frames created seeing that my tool needs to save these values to a file.
I have tried many things, one of them was getting back the Euler angles, but this has many restrictions like the Gimbal Lock and the range of Pitch (x) that goes from -90 to 90.
I was thinking that the function D3DXQuaternionAxisAngle, gives you the axis direction and one angle, so, is it possible to extract some kind of data from this two parameters??

I'm about to finish my tool, but i'm stucked in this issue. I come working on this same problem since the past week and couldn't find a solution. I have seen tools were this was implemented, so I if one of you can raise me a help, I would be really happy!

Keep coding!

PS: I use Directx 8.1 and c++ Builder XE.
Help our doubts¡¡¡Best Regards,

Sponsor:

#2 Olof Hedman   Crossbones+   -  Reputation: 2618

Like
0Likes
Like

Posted 06 November 2012 - 07:41 AM

What "angles" do you need really?

Or do you mean that you need some kind of representation of the objects orientation(rotation), you can write to file, and don't care what this looks like, as long as you can recreate the orientation later?

#3 jjd   Crossbones+   -  Reputation: 2062

Like
0Likes
Like

Posted 06 November 2012 - 10:51 AM

I'm not sure if I understand your description but it sounds like you might be looking for a polar decomposition.

-Josh

Edited by jjd, 06 November 2012 - 10:51 AM.

--www.physicaluncertainty.com
--linkedin
--irc.freenode.net#gdnet


#4 Dario1986   Members   -  Reputation: 143

Like
0Likes
Like

Posted 09 November 2012 - 04:52 AM

Sorry for not answering before, I have some troubles with my line.

Or do you mean that you need some kind of representation of the objects orientation(rotation), you can write to file, and don't care what this looks like, as long as you can recreate the orientation later?


What I needed or need, is the angles as degree or radians, because that info I want to write to a file, is needed by other tool, and that app reads only degrees or radians. Yes, if I only wanted to recreate the object orientation later in my tool, I would save the matrix or the axis vector or whatever. I think that i will have to stick with the Euler angles and see what to do with them. :/
Thanks for taking care,
good luck!!
Help our doubts¡¡¡Best Regards,

#5 Lauris Kaplinski   Members   -  Reputation: 841

Like
0Likes
Like

Posted 09 November 2012 - 06:39 AM

You may take look into my matrix-to-euler-angles implementation:
http://khayyam.kapli...ler-angles.html

I also needed Euler angles for animation and thus had to code a specific solution for my needs. Basically it decomposes matrix to Euler angles obeying two constraints:
  • The set of angles generated was the one of two possible sets that was closest to predefined angles (rest pose)
  • In case of gimbal lock the X rotation was not chosen arbitrarily, but using predefined value (the angle of previous rotation or rest pose rotation).
It also allows arbitrary order of rotations (XYZ, XZY...)
Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/

#6 Dario1986   Members   -  Reputation: 143

Like
0Likes
Like

Posted 13 November 2012 - 03:11 PM

Thanks dude, I will take a look at your code.
Help our doubts¡¡¡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