# Denormalized Angle Operations in Maxscript

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

## 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 on other sites
In an effort to understand your problem I googled for "denormalized euler angles" and I got this thread as the only match. Would you mind explaining what you mean by that?

##### 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 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 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 Edited by Super Llama

1. 1
2. 2
3. 3
Rutin
20
4. 4
frob
20
5. 5

• 32
• 13
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
632559
• Total Posts
3007080

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!