Sign in to follow this  

Denormalized Angle Operations in Maxscript

This topic is 1966 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

Hi everyone, I'm writing an exporter for my animation format in Maxscript, and I ran into a problem with angles. Basically, the angles start out as denormalized euler angles, but I have to do some transformation operations on them to get them in the proper format. Since you can't just do operations on euler angles in maxscript, I have to convert them to quaternions first-- the problem is, this automatically normalizes them, which causes its own host of problems. Basically my question is (yes, I've googled it), is there any way at all to convert back and forth from euler angles and quaternions without normalizing them? Or is there some way to un-normalize them given the starting angle? All I need to do is subtract the new position from the starting one, but even basic subtraction wreaks havok if you try it on a euler angle. If all else fails, is there some way of subtracting denormalized euler angles? The only remaining courses of action if I don't find a way to do this is to completely change my format so it uses quaternions, and that'd take a lot of editing.

Share this post


Link to post
Share on other sites
Well, a normalized euler angle is an angle with an XYZ component where each component is limited to between -180 and 180. This is how most angles are stored-- but for animation sometimes you need to perform multiple cycles, so it's best to not normalize them and allow values like 270. The problem is, combined XYZ angles seem to be impossible to perform operations on without converting them to quaternions, and the process of converting them to quaternions automatically normalizes them (keeps the quaternion length less than a full revolution) even though it's possible to have a non-normalized quaternion. What I want to do is somehow take the starting non-normalized euler angle, convert it into a quaternion, and then modify the quaternion so it matches the number of revolutions that the starting angle had, and do a similar operation in reverse. getEulerQuatAngleRatio looks like it might do something like this but I can't seem to find any straightforward information about it.

Share this post


Link to post
Share on other sites
Oh, I see what you mean now. Do you ever have an animation that is so fast that the rotation happening from one frame to the next is more than 180°? If you don't, transforming to quaternions and operating with them should work fine. If you do, things are more complicated, and I would have to think hard about how the animation data could be stored in a meaningful way.

Share this post


Link to post
Share on other sites
Yeah, the main thing about non-normalized eulers is that it's much easier to tween them, since you don't have to wrap around. Quaternions are really starting to look like the only way at this point... pretty much any attempts to fix these eulers just distorts them worse. I suppose I'll have to modify my format after all :/

EDIT: Wow. Switching to quaternions only took like 15 minutes and they work perfectly... lol, thanks for verifying that my eulers were hopeless :P Edited by Super Llama

Share this post


Link to post
Share on other sites

This topic is 1966 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this