HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Euler and quaternion toy (or how to rotate models by hand)

06-10-2003, 04:00 AM#1
Ari
EDIT: In the event that the link below is down, the same program can be found at

http://wct.wc3campaigns.com/Rotation.htm

For me, at least, this was so useful that I'd have been screwed if they took it off their website, so I copied it to our server.


I only recently learned of the way wc3 handles the rotations of models. To put it in terms that will piss of anybody in-the-know, but satisfy me and everyone else, wc3 uses a special code called quaternions to represent rotations.

In other words, in an mdl file a rotation will be represented by a series of 4 numbers. Now, the numbers are almost incomprehensible when you look at them by eye, making it very hard to create your own rotations by hand. However, after scouring the internet, I've found a java applet that very easily lets you convert angles (or eulers, for the mathematically inclined)into quaternions.

http://www.engin.umich.edu/dept/aero...t3DApplet.html

Even better, it displays a picture of an airplane on the screen at the same time, so you can see the results of your rotations as you make them. It also displays the rotations in both quaternion, and euler values (and axis angles, not that that means much to me), while allowing easy conversion between the two.

This program was a godsend for me when I need to rotate emitters for FoK mdl's. The *only* catch is that there's a single bug: sometimes it gives quaternion values like [6.123, 0, 0, 1]. In cases like this, the large number is supposed to be a zero (it's always MUCH larger than the other numbers).
Edit: I just realized tha those numbers are usually proceded by an exponential notation ( so it's not 6.12335356545 but rather 6.12335356545E-3 where the final characters are cut off by the size of the applet.


Oh, one last thing: while the program displays output as (real, i, j, k) keep in mind that mdl files take the numbers in the order (i, j, k, real).