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

Started by
4 comments, last by Dario1986 11 years, 5 months ago
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,
Advertisement
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?
I'm not sure if I understand your description but it sounds like you might be looking for a polar decomposition.

-Josh

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

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

  1. The set of angles generated was the one of two possible sets that was closest to predefined angles (rest pose)
  2. 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/
Thanks dude, I will take a look at your code.
Help our doubts¡¡¡Best Regards,

This topic is closed to new replies.

Advertisement