Archived

This topic is now archived and is closed to further replies.

Quaternions to angles..why does it fail sometimes?

This topic is 5815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey- I''ve been using quaternions for awhile, and most of the time it''s no problem.. In my application I have to sometimes convert quaternions back to euler angles, but this doesn''t always work consistently..most angles are ok, but some transformations just don''t seem to convert properly.. I keep a set of euler angles for each quaternion, so most places I can use that for reference, but there are times when I must convert some intermediate quaternion into angles, and about 10% of those times I get an incorrect result.. In the article http://www.gamedev.net/reference/articles/article1095.asp Sobeit Void reports a similar problem, and states that he/she knows no solid, concrete method for converting quaternions to angles.. Is there honestly and legitimately NO possible way to convert quaternions to angles?...even with a thousand IF statements?..if I have some interpolated quaternion that was generated on the fly and I don''t have the original euler angles, am I just SOL?.. I wouldn''t care if it cut my frame rate in half, this is not for a high-performance app, but it needs to work..I''m ready to throw up from thinking about these quaternions all day.. btw this has been a major thorn in my side for the last 4 months..only now it''s critical because I''ve completed everything else and have nothing left to do.. Arghhh... Any comments, thoughts, suggestions?..hey, even if you just want to bitch and moan about quaternions feel free to join in, I''m right there with you "Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites
I DID IT!!!

I DID IT!!!

I DID IT!!!

After months of Quaternion Hell I have finally fixed the problem..

What I was doing was clamping the resultant angles to 0-360..when I used those angles to create another quaternion, it would be different..when I don''t clamp them(allowing negative rotation, etc.) the new quaternion is the same!!

Yeah, sure, it appears that I''ve got some other freaky bug(because the solution makes no sense to me), but it WORKS!!!

"Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yeah it should be obvious that you can''t, uhh, clamp angles without changing the resulting rotation.

If you want things to be in the range from 0-360, then you need to add or subtract multiples of 360 until you get there. If you do this, then the resulting quaternion will be the same.

-Jonathan.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Yeah it should be obvious that you can't, uhh, clamp angles without changing the resulting rotation.



No, it's NOT obvious that you can't clamp the angles without changine the resulting rotation..-180 degrees is generally the same rotation as +180..-90 is equal to 270, etc...Just because an angle falls outside of 0-360 doesn't usually mean that you can't clamp it to that range to work with it..

quote:
Original post by Anonymous Poster
If you want things to be in the range from 0-360, then you need to add or subtract multiples of 360 until you get there.



No kidding!

quote:
Original post by Anonymous Poster
If you do this, then the resulting quaternion will be the same.




No, it's NOT..that's the point..

Did you even read my post?..Let me clarify:

Clamping The Angles Caused The Resulting Quaternion To Be Different Than The Original.

I don't know WHY this works in this way, but it is what I have seen.


quote:
Original post by Anonymous Poster
Yeah it should be obvious that you can't, uhh, clamp angles without changing the resulting rotation.



No. It's never been an issue before. Apparently this is only an issue with quaternions in this instance..

quote:
Original post by Anonymous Poster
If you want things to be in the range from 0-360, then you need to add or subtract multiples of 360 until you get there.



This is basic math. I know how to clamp values to a specific range..

quote:
Original post by Anonymous Poster
If you do this, then the resulting quaternion will be the same.




This is just plain incorrect, and it seems to contradict your earlier statement that is should be 'obvious' that clamping the angles will result in a different rotation..

Read my post again AP, I think you missed something..

"Like all good things, it starts with a monkey.."

Edited by - monkeyman on January 11, 2002 11:49:49 AM

Share this post


Link to post
Share on other sites