Rotations, once and for all...
by technostick · in Marble Blast · 02/13/2006 (7:25 am) · 15 replies
As everyone here knows, nobody here really seems to know the precise equations for rotation of objects. Many threads have been started with the purpose of settling this issue, but they have all fallen short, in part due to the fact that geometrically, rotating objects in 3-D space does not lend itself easily to numerical description. Nevertheless, the space of all rotations in 3-D is itself a 3-dimensional vector space, which means that it is possible for it to be described in 3 parameters.
Unfortunately, the system in Torque uses 4 parameters, x y z n. Most of us will probably have gathered that n is some sort of a scaling factor - i.e. x y z n means (x*n) (y*n) (z*n). The problem now is what these three numbers actually do. From experience, as well as the previous threads regarding this topic, it has emerged that 1 0 0 n is a rotation about the x-axis by n degrees, 0 1 0 a rotation about the y-axis by n degrees, and 0 0 1 a rotation about the z-axis by n degrees. What is totally unclear is what the meaning of x y 0 n and its likes are. I have also noticed that certain combinations of parameters distort the object as well as rotate it.
It would be tremendously helpful to all if someone could explain the "inner workings" of rotations in Torque, in whatever mathematical complexity necessary to fully describe it. After a complete description is formulated, then the mathematicians among us (me included), can simplify or interpret the results for the non-mathematicians.
Please, let us put an end to this frustrating issue once and for all.
-technostick
Unfortunately, the system in Torque uses 4 parameters, x y z n. Most of us will probably have gathered that n is some sort of a scaling factor - i.e. x y z n means (x*n) (y*n) (z*n). The problem now is what these three numbers actually do. From experience, as well as the previous threads regarding this topic, it has emerged that 1 0 0 n is a rotation about the x-axis by n degrees, 0 1 0 a rotation about the y-axis by n degrees, and 0 0 1 a rotation about the z-axis by n degrees. What is totally unclear is what the meaning of x y 0 n and its likes are. I have also noticed that certain combinations of parameters distort the object as well as rotate it.
It would be tremendously helpful to all if someone could explain the "inner workings" of rotations in Torque, in whatever mathematical complexity necessary to fully describe it. After a complete description is formulated, then the mathematicians among us (me included), can simplify or interpret the results for the non-mathematicians.
Please, let us put an end to this frustrating issue once and for all.
-technostick
About the author
#2
I'm a mathmatician too, but this scaler stuff is new to me. Is it geometry OR something that simplifies computer calculation(i.e., for game engines like TGE). I don't know.
02/13/2006 (11:48 pm)
I've noticed the distortion bit too. It seems to happen when a value is put in more than axis slot. I had to do some creative 'fitting' to get my pipe right in the custom level 'oil rig' that I made a while back. I simply couldn't rotate the elbow pipe in some directions. If I had an elbow pipe that mirrored the one we have now, I could've got the effect I wanted without all the twisting.I'm a mathmatician too, but this scaler stuff is new to me. Is it geometry OR something that simplifies computer calculation(i.e., for game engines like TGE). I don't know.
#3
Another point is that in the second example above, 0.5 0 1 70, in what way does the X and Z interact? It doesn't seem to be simply "rotate 35 degrees about X, then 70 degrees about Z", or the other way around. In fact, rotation is not commutative - i.e. doing X before Z generally gives a different result than doing Z before X.
I suppose what we really need is a description of the way that the 3 parameters interact with one another.
02/14/2006 (2:41 pm)
This scalar parameter must be a computer quirk - I cannot think of any group of rotation/distortions that are geometrically easiest expressed in 3 parameters and a scalar.Another point is that in the second example above, 0.5 0 1 70, in what way does the X and Z interact? It doesn't seem to be simply "rotate 35 degrees about X, then 70 degrees about Z", or the other way around. In fact, rotation is not commutative - i.e. doing X before Z generally gives a different result than doing Z before X.
I suppose what we really need is a description of the way that the 3 parameters interact with one another.
#4
02/15/2006 (12:05 am)
I would gander a guess that the above example will, or should I say would produce a distortion? Will someone try it in the MBG editor?
#5
I think that we might need someone who really knows all about Torque rotations, instead of a bunch of "tinkerers" guessing. :-)
Maybe Alex can help?...
02/15/2006 (4:58 am)
It does indeed produce a fairly noticable distortion. Interestingly, if I set the X value to something smaller than 0.5, the distortion lessens.I think that we might need someone who really knows all about Torque rotations, instead of a bunch of "tinkerers" guessing. :-)
Maybe Alex can help?...
#7
Might this be a step in the right direction?
02/24/2006 (11:48 am)
I had a slight conceptual breakthrough recently regarding the "double" rotations like "0.5 0 1 70". I tried to reduce everything to the basic "axioms", and saw "x y z n" as purely "x*n y*n z*n" - let's call that "a b c". Nothing that we don't know, but nevertheless a first step. (What is strange is why to represent a 3-dimensional space with 4 parameters...) Also, we know that "a 0 0" rotates the object a degrees about the x axis, and similarly for the other axes. Now, the breakthrough: I realized that the distortions were symmetrical in a way that could only be if the axes were rotated separately. More precisely, when the object distorts, it does so because the axes are no longer at right angles to each other - i.e. one axis becomes "skewed". Now what needs to be done is to formulate a consistent interpretation using that and the know facts. Basically we need to know just how each rotation factor influences each of the axes.Might this be a step in the right direction?
#8
02/24/2006 (11:48 pm)
Yes grasshopper.
#9
Here is a table of what certain known rotations do to each of the axes...
1 0 0 0
nothing
1 0 0 n
nothing to x
rotates y and z by n degrees in the yz-plane
1 0 1 n
...I'm going to try to find that out next...
03/06/2006 (3:04 am)
It now seems a bit more complicated than I originally thought... I do still think that each axis rotates seperately, but unfortunately there aren't enough parameters to rotate each freely. In order to rotate an axis freely around a point, it needs two parameters (i.e. latitude and longitude). However, it seems that each axis has only one.Here is a table of what certain known rotations do to each of the axes...
1 0 0 0
nothing
1 0 0 n
nothing to x
rotates y and z by n degrees in the yz-plane
1 0 1 n
...I'm going to try to find that out next...
#11
???
Maybe a good approach would be to see what products of 90-degree axis rotations do (i.e. those that rotate 90 degrees about x, y, and/or z). If these rotations are simply one right after another in some way, we should have 1 1 0 90 = -1 -1 2 90 or something like that...
03/07/2006 (7:56 am)
There was a post sometime ago by a user of Torque who offhandedly remarked that the parameters "is a quarternion"... What does that mean? This is the quote:Quote:Otherwise the for digits number is a quaternion, you can do the math yourself and write there the correct values to obtain the rotation you want :))
???
Maybe a good approach would be to see what products of 90-degree axis rotations do (i.e. those that rotate 90 degrees about x, y, and/or z). If these rotations are simply one right after another in some way, we should have 1 1 0 90 = -1 -1 2 90 or something like that...
#12
Imagine a halfpipe opening up and with the length side as the x-axis. (exactly like the included halfpipe unrotated.) Now turn it to face down. It gets the rotation 1 0 0 180. Now here's the weird bit: the rotation about the y and z axes are switched! If you want to turn this inverted halfpipe about the z-axis by 90 degrees (i.e. put it along the y axis), you would do 1 0.5 0 180.
So this solves the problem of the "elbow" tube being unable to turn in every direction! Just do 1 0 0 180 to it, switch the y and z axes, and you get a mirror of the existing one!
03/23/2006 (11:12 am)
Noticed something strange again...Imagine a halfpipe opening up and with the length side as the x-axis. (exactly like the included halfpipe unrotated.) Now turn it to face down. It gets the rotation 1 0 0 180. Now here's the weird bit: the rotation about the y and z axes are switched! If you want to turn this inverted halfpipe about the z-axis by 90 degrees (i.e. put it along the y axis), you would do 1 0.5 0 180.
So this solves the problem of the "elbow" tube being unable to turn in every direction! Just do 1 0 0 180 to it, switch the y and z axes, and you get a mirror of the existing one!
#13
03/23/2006 (12:21 pm)
Geesh, I thought I tried every combination?
#14
n. foursome of real numbers that contains the complex numbers (Mathematics); group of four people or things
03/23/2006 (2:47 pm)
quaternionn. foursome of real numbers that contains the complex numbers (Mathematics); group of four people or things
#15
The first definition (Mathematics) refers to a field generated by 1, i, j, k, after Hamilton. (see mathworld.wolfram.com/Quaternion.html)
It seems that has nothing to do with the rotations, because the rotations are 3 symmetric elements and one scalar element, while the quarternions aren't.
I tried doing 1 1 0 90... A horrendous distortion resulted. :-)
03/25/2006 (8:22 am)
That's what's so confusing!The first definition (Mathematics) refers to a field generated by 1, i, j, k, after Hamilton. (see mathworld.wolfram.com/Quaternion.html)
It seems that has nothing to do with the rotations, because the rotations are 3 symmetric elements and one scalar element, while the quarternions aren't.
I tried doing 1 1 0 90... A horrendous distortion resulted. :-)
Torque Owner Bob
The rotation is interpreted as a scalar, meaning that the first 3 values are the X, Y, and Z scalars (range 0.0-1.0), and the fourth is a multiplier (in degrees). So:
1 0 0 90 = 90 degrees X (1 x 90) 0 degrees Y (0 x 90) 0 degrees Z (0 x 90) 0.5 0 1 70 = 35 degrees X (0.5 x 70) 0 degrees Y (0 x 70) 70 degrees Z (1 x 70)Kind of complicated, but not too hard for turning things 90 degrees on their side, just make the value for to axis you want it to turn around 1.0, and the multiplier 90.