Jump to content

  • Log In with Google      Sign In   
  • Create Account

Denormalized Angle Operations in Maxscript


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Super Llama   Members   -  Reputation: 152

Like
0Likes
Like

Posted 26 July 2012 - 04:00 PM

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.
It's a sofa! It's a camel! No! It's Super Llama!

Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 13311

Like
0Likes
Like

Posted 27 July 2012 - 12:21 AM

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?

#3 Super Llama   Members   -  Reputation: 152

Like
0Likes
Like

Posted 27 July 2012 - 09:10 AM

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.
It's a sofa! It's a camel! No! It's Super Llama!

#4 Álvaro   Crossbones+   -  Reputation: 13311

Like
0Likes
Like

Posted 27 July 2012 - 11:31 AM

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.

#5 Super Llama   Members   -  Reputation: 152

Like
0Likes
Like

Posted 27 July 2012 - 11:49 AM

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, 27 July 2012 - 12:12 PM.

It's a sofa! It's a camel! No! It's Super Llama!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS