Getting eulers from modelview_matrix

Started by
3 comments, last by Sander 21 years, 2 months ago
In my OGL app I dump the modelview_matrix in a float matrix[16]. I know that matrix[12] matrix[13] and matrix [14] hold the current x, y and z translation. But how and where can I get the euler rotations from the matrix? Are they in the matrix directly? If not, how do I convert the matrix to get the euler angles? Thanks in advance! Sander Maréchal [Lone Wolves GD][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Advertisement
To my knowledge, that''s exceptionally difficult, if not impossible. Once more than one angle goes into the modelview matrix, it''s impossible to find out what the angles originally were from just the modelview matrix. Someone asked the same question about two weeks ago, and I think that what I said then about it being impossible was backed up. If anyone knows any mathematical formula that allows extraction of Euler angles from the modelview, and I''m wrong, please post it...


Coding Stuff ->  [ iNsAn1tY Games | DarkVertex | How To Do CSG | Direct3D Vs. OpenGL | Google ]
Fun Stuff    ->  [ Evil T-Shirts | Stick-Based Comedy | You''re Already Here | The Best Film Reviews ]
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
not eular angles but the top3x3 of the matrix are 3 vectors which represent
side, up + forward

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
i think it''s not possible.
the rotation matrix M for euler angles is computed through:

M = Rz(a)Rx(b)Rz(w)Rx(-b)Rz(-a)

(Rsomethingwhat is a matrix).
so you multiply at the end all five matrices together and get the 3x3 matrix or in homogenous coordinates 4x4 matrix you can read as usual.

maybe using quaternions for rotating would help you more?


ps: i may be wrong with this, i''m a newbie.
http://www.quake.de
I am using quaternations at the moment but sometimes it goes wrong. That''s why I need the eulers so I can check it. I use the quaternations for rotating my tentacle. Sometimes it works (screenshot) but sometimes the rotation goes in the opposite direction (screenshot). For eacht part of the tentacle i have a quaternation which is the rotation relative o the previous bone and the modelview matrix. I need to figure out where it goes wrong and why the tentacle sometimes points in the wrong way.

Sander Maréchal
[Lone Wolves GD][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

This topic is closed to new replies.

Advertisement