# possible alternative to quaternions?

## Recommended Posts

rrrr    118
I've been reading about quaternions as used in game programming, and was wondering how the following type of 3D hypercomplex number might work out for representing rotations: The numbers are of the form A + By + Cz There is a real-number axis, and two imaginary ones whose units are y and z. The multiplication rules are y^2 = z z^2 = -y yz or zy = -1 Multiplying by the unit y rotates any number in one direction, touching both sides of every axis, and similarly the unit -z (note the minus) rotates in the other direction. Would it be any use in games programming in 3D? [Edited by - rrrr on August 19, 2006 11:58:37 AM]

##### Share on other sites

z^2 = -y <=> z^3 = -yz <=> z^3 = 1 <=> z = 1 <=> y = -1

Therefore "A + By + Cz" simply diminishes to "A - B + C" and there's nothing complex about them.

Coming up with a quantity that can be used to represent 3d rotations is not a trivial task.

##### Share on other sites
SiCrane    11839
z3 = 1 does not imply z = 1.

##### Share on other sites
rrrr    118
Yes, I was going to say that. y and z are irreducible imaginaries, like sqrt(-1).

##### Share on other sites
Oops, of course not. I replied in a rush and forgot the other 2 roots.
Yes, it could also be -(-1)^(1/3) and (-1)^(2/3)

I just wanted to point out that numbers with that properties are not imaginary units.

##### Share on other sites
rrrr    118
Well, we would differ on that. Assuming I am right, I would be very interested to have game developers try out these numbers and see if perhaps they might be a contender for expressing rotations.

Anyone want to give it a "whirl"?

##### Share on other sites
SiCrane    11839
So what number would you use to represent a 90 degree rotation about the x-axis? The y-axis? The z-axis?

##### Share on other sites
samv    312
My algebra knowledge is not that solid, but doesn't this solution (z = 1, y = -1) mean it's isomorphic to (and thus no more interesting to represent rotations in than) the real numbers?

##### Share on other sites
rrrr    118
Quote:
 Original post by SiCraneSo what number would you use to represent a 90 degree rotation about the x-axis? The y-axis? The z-axis?
Actually that's the sort of question I was hoping others more proficient in math than I am might want to tackle.

However, I'll see what I come up with. Am a bit busy at the moment though. Anyone else is welcome to try.

EDIT: Turns out to be very easy. Will post when I have time.

[Edited by - rrrr on August 19, 2006 5:56:25 PM]

##### Share on other sites
Limitz    342
I'm willing to give it a try,

i just got my quaternion camera set up, so no biggie to try it out. If i could just get my head straight on how to implement it.

EDIT: will this be able to rotate over all 3 axes?

Greetings.

[Edited by - Limitz on August 19, 2006 8:28:00 PM]

##### Share on other sites
rrrr    118
I believe so. Multiplying in the manner I described in my first post rotates everywhere, but in a sort of spiral-twist fashion. To rotate around y, you multiply any number of the form

A + By + Cz

by

(-C + By + Az)/(A + By + Cz)

and analogously for other axes or other directions.

##### Share on other sites
Mastaba    761
It is not clear to me how your hypercomplex value is isomorphic to a quaternion or axis-angle pair. Nor do I undersand how a rotation is simply a multiplication by a particular hypercomplex quotient. How is the hypercomplex division defined?

##### Share on other sites
Eric Lengyel    3460
It has been known since 1843 that you cannot come up with a three-component algebra representing 3D rotations -- it's impossible. You must use quaternions. If you're interested, you might also want to look at geometric algebra. The quaternions are actually a subset of a larger algebra known as the set of three-dimensional multivectors. (The imaginary units i, j, and k of the quaternions correspond to the three orthogonal unit bivectors.)

##### Share on other sites
I just wanted rrrr to see that you cannot let some values be imaginary units, and then give them extra properties.

The whole idea behind the square of such a quantity being -1, is exactly what relates that quantity with rotation, since -consider a vector v on a plane through the origin-, -v = v*i^2, which is v rotated by π rad on the plane normal to i. Of course this lies in the fact that multiplication with i is known to rotate by π/2.

The whole thing behind Hamilton's basic rule of transformation of i,j,k (i^2 = j^2 = k^2 = -1, ij = k, ji = -k etc...) merely displays how multiplication with these quantities should affect a vector which is expressed via these quantities (like a set of basis vectors).
E.g., if you rotate i around j by π/2 you get k, which is concisely expressed as ij=k, or the other way around, ji=-k. This is no different than rotating the regular x,y,z axes of a cartesian system around themselves.

Quaternions arose naturally (I believe) by the study of the properties of vectors expressed with the i,j,k orthogonal unit vectors.
Try to multiply two vectors, of the form xi+yj+zk and you'll be left with a quaternion in no more than a couple of lines (considering the usual properties of course).
Divide them (you'll need inverse vectors), and you'll get a quotient quaternion, which when applied to the divisor vector, rotates and stretches it (for arbitrary non unit quaternions) into the dividend!
It's amazing what you can come up with if you start writing these things down.

If you lose one basis vector (k in your example) you're no longer assuming 3d space... or if you alter the fundamental property of i^2=-1, (like with y^2=z and z^2=-y) it's not a complex quantity anymore, and most likely it will not exhibit properties such as rotating vectors.

##### Share on other sites
rrrr    118
Just a quick note since I am so busy. The imaginaries were not arbitrarily posited: y and z actually represent another, underlying algebra that generates their properties--which I'd rather not go into at this time. However, the same algebra, I've observed, generates the complex number system.

The imaginaries rotate in 3D, not 2D, however--in an indescribable but completely orderly fashion.

EDIT: Will deal with other issues as time permits. (By the way, if it turns out four axes are REALLY needed, I have 4D, 5D, and 6D systems built on the same principles--but that's for another thread. But I am thinking three axes might be more efficient for representing space.)

[Edited by - rrrr on August 21, 2006 7:28:57 AM]

##### Share on other sites
Daerax    1207
250 years ago it was concluded after 300 years of investigation by many scores of people that you could not infact represent 3 dimensional space using number composed of triples.

1,2,4,8D are the only possible ever division algebras. You may wish to look into cayley algebras and their construction.

##### Share on other sites
rrrr    118
I have the greatest respect for the geniuses of the past, and my intent is not to contradict them.

All I am saying is that, coming at it from another angle, with this particular hypercomplex system, the coefficients of the three terms, each having its own axis, do form a 3D space when put at right angles to each other, and when you multiply any number by, for example, the imaginary unit y, each of the axes rotates 90 degrees--try it--and also, with the operations of addition, one can mirror points in a plane, and do other transformations, so to that extent one might find the system useful for some things that quaternions are now used for.

I do accept that a 3D system cannot be a "division algebra"--from my own initial calculation, there are some numbers that lack a unique inverse (and that's what math theory predicts)--but this does not seem to make rotation impossible. The rotations happen! So my (tentative) conclusion is that some error in interpretation or application of math theory is being made, if one says this system has to be useless.

If a concrete example showing me that my rotations, though they happen, have no practical use, can be given, then I would of course accept that!

[Edited by - rrrr on August 21, 2006 4:24:56 PM]

##### Share on other sites
SiCrane    11839
You still haven't answered my question about what number would represent a 90 degree rotation about the y axis.

##### Share on other sites
rrrr    118
Quote:
 Original post by SiCraneYou still haven't answered my question about what number would represent a 90 degree rotation about the y axis.
Sorry, I should have drawn attention to this post above:

To rotate around y, you multiply any number of the form

A + By + Cz

by

(-C + By + Az)/(A + By + Cz)

and analogously for other axes or other directions.

In effect, in the case of y, one switches the two non-y coeffients and changes the sign of one of them.

In general, to divide, one has to factor the numerator, then cancel if possible. Now, it appears that my system is not a "division algebra"--not every number has an inverse. Assuming that this is a problem, can we say that nevertheless, any number can be divided by itself to yield 1?

If there is some theoretical problem with this, is there any difficulty with telling the computer to simply switch coefficients and change a sign? I truly don't know and that's the sort of thing I needed feedback on.

##### Share on other sites
rrrr    118
I also just wanted to mention something that may be important here.

In the case of complex numbers (which turn out to be a special case of "my" systems [I put it in quotes because I am still investigating other people's hypercomplex systems]), the point multiplied by i does not rotate about an axis. Rather, it rotates about a point in 2D space (the origin).

It is the same here. The point multiplied by the imaginary rotates about the origin, not an axis--and touches both sides of all axes in 3D rather than 2D.

##### Share on other sites
Mastaba    761
Can you show one simple concrete example? Say for instance you have a point P in R3, (1,0,0). Say you also have an axis in R3 that is coincident with a line segment that intersects the origin and (1,1,1). Can you show how to rotate P around that axis using your system, numbers and all? Please be explicit.

##### Share on other sites
rrrr    118
Quote:
 Original post by MastabaCan you show one simple concrete example? Say for instance you have a point P in R3, (1,0,0). Say you also have an axis in R3 that is coincident with a line segment that intersects the origin and (1,1,1). Can you show how to rotate P around that axis using your system, numbers and all? Please be explicit.
That's the sort of question I wanted to consult about--whether, given the rules (and I'll provide more if you require them), you can do the things you want to do. It may be that you cannot. (I may then post my 4D system in another thread and ask the same thing.)

What I can do, however, is post numerous examples of arithmetical operations with these numbers. I will do this--I realize all the above may be too abstract for many to get a handle on.

(If the theoretical mathematicians who have posted that my system cannot be used for these sorts of applications turn out to be right, perhaps they may still find these 3D numbers interesting in themselves. So they might want to follow these later posts.)

The main thing is that y and z do not reduce to real numbers except according to the rules (which, again, are not arbitrary), and that everything follows the procedures of straight algebra.

[Edited by - rrrr on August 21, 2006 5:17:41 PM]

##### Share on other sites
SiCrane    11839
Quote:
 Original post by rrrrTo rotate around y, you multiply any number of the formA + By + Czby(-C + By + Az)/(A + By + Cz)and analogously for other axes or other directions.

If you need three different numbers to apply the same rotatation to three different points, then your number system is not useful for representing rotations in computer applications.

##### Share on other sites
rrrr    118
Actually, since one of the two types of "rotation" I am talking about is in 3D, multiplication of any number by y or -z rotates any group of numbers in the same manner, and the whole shape they define rotates in 3D by a 90-degree movement about all three axes simultaneously. In effect, all the axes switch places, for every one of the points.

For movements of other angles than 90 degrees--well, that's one of the things I'd need a math whiz to look into. Can anyone help? Granted, the math is likely much more complicated, involving nested Pythagorean theorems, but nothing today's computers can't handle--I would think.

That's rotation about a point, as in the complex numbers. The other type of rotation, about an axis, depends on using the coefficents of any given point to calculate the coefficients of the new point. Let's say you have a picture of Goofy consisting of a million pixels. For each point,

A + By + Cz

you would have the computer do the operation that switches two coefficients and changes a sign. Then the whole picture rotates 90 degrees about the axis. With the processing power available today, wouldn't that be easy and fast?

It would require different programming than for the quaternions, obviously.

[Edited by - rrrr on August 21, 2006 7:52:02 PM]

##### Share on other sites
alvaro    21246
I don't know why you are so convinced that multiplication in this space of yours represents 3D rotations. I tried a simple example and it's obvious that you can't represent rotations this way.

Let's try to find (a+by+cz) such that for all (A,B,C),
(A+By+Cz)*(a+by+cz) = -B+Ay+Cz
(i.e., let's try to express a rotation of 90 around the z axis)

(A+By+Cz)*(a+by+cz) = Aa + Aby + Acz + Bay + Bbz - Bc + Caz - Cb - Ccy
= (Aa - Bc - Cb) + (Ab + Ba -Cc)y +(Ac + Bb + Ca)z

So enforcing the fact that the first components must match, you get
Aa - Bc - Cb = -B, for all values of A, B and C, which gives you a=0, c=1, b=0.

But those values don't satisfy the other two conditions, since you get
(A+By+Cz)*z = - B - Cy + Az

So there is no way to represent a 90 degree rotation around the z axis using those numbers.