## Quaternion-like rotation in 4D?

If you don't know where to post something, put it here and an administrator or moderator will move it to the right place.

### Quaternion-like rotation in 4D?

For 3D computer graphics, we have the useful idea of Quaternion Rotation, which solves the Gimbal Lock problem and lets us rotate around an arbitrary line (i.e. in an arbitrary plane). But how do I extend this concept to 4D? Marc Ten Bosch has a blog post about it (http://marctenbosch.com/news/2011/05/4d-rotations-and-the-4d-equivalent-of-quaternions/). He gives an ok explanation of Quaternions, then mentions that you can extend the idea to 4D using Rotors (https://en.wikipedia.org/wiki/Rotor_(mathematics)), but then stops there. No explanation of what Rotors are or how to use them or anything!

Does anyone know what exactly a Rotor is, what it's capable of, and how to use one for rotation in 4D? I'm working on some 4D visualization software and I'd really like to add that as a feature. I only have Euler rotation. Euler rotation in 4D is necessary, but can get sticky, especially for things like Inverse Kinematics (https://en.wikipedia.org/wiki/Inverse_kinematics#Inverse_kinematics_and_3D_animation).
neverhood311
Mononian

Posts: 12
Joined: Tue Jun 30, 2015 10:58 pm
Location: Salt Lake City, UT

### Re: Quaternion-like rotation in 4D?

As you can see in your link, you need to know Geometric Algebra (a generalization of vector algebra).

Here are some more links for GA:

http://www.av8n.com/physics/clifford-intro.htm

http://geocalc.clas.asu.edu/html/Intro.html

A rotor is a multivector with only even-grade components, normalized to have magnitude 1. Alternatively, it's a geometric product of an even number of unit vectors. It applies to a vector x in the same way you should know from quaternions:

x --> R-1xR = R~xR

The formula with the inverse can be applied whether R is normalized or not. The tilde means "reverse"; it flips the order of multiplication of all the vectors in R. We have some general formulas for reversion, where A and B are multivectors, and <A>k denotes grade-projection:

(A+B)~ = A~+B~

(AB)~ = B~A~

A~ = sumk (-1){k(k-1)/2}<A>k

(Any multivector is a sum of products of orthogonal vectors. This is obvious if you use an orthonormal basis. The grade-projection <A>k is all the terms that have exactly k orthogonal vectors being multiplied.)

The product of two unit vectors a and b (not necessarily orthogonal) is a rotor that generates a simple rotation in that plane. (Four or more vectors could make a compound rotation.) The angle of rotation is 2 times the angle between a and b. This is a result of the 2 factors of R in the sandwich product. If you want half of that rotation, to send a directly to b, you'll need to take a square root of R, or calculate the angle directly. That can be done with

ab = (a . b) + (a ^ b) = (||a|| ||b|| cos t) + (||a|| ||b|| i sin t) = cos t + i sin t = exp{it}

where i is the unit bivector for the plane of a and b.
mr_e_man
Trionian

Posts: 106
Joined: Tue Sep 18, 2018 4:10 am

### Re: Quaternion-like rotation in 4D?

Unfortunately, quaternions only apply to 3D rotations, and the only other dimension where you can map rotation to a neat object is 7D, where you can represent rotations with octonions. However, there you no longer have a 1-to-1 mapping, and it may not necessarily be easier to calculate than other methods.

A more general approach to rotations that's much easier to generalize across dimensions is to ditch the idea of rotational axes or stationary subspaces, and tackle rotation as what it really boils down to: rigid motion in a rotational plane. For this, you just need two orthogonal unit vectors in the rotational plane, and then you can use the (dimension-independent) formula in this article to compute the rotation. To obtain the two unit vectors, all you really need is just any two non-parallel vectors, let's call them v and w, then let u = v - (v.w)w where '.' denotes the dot product, and then u and v will be perpendicular vectors. Then just scale them down to unit length and you're all ready to go.

Now, in 4D rotation is a little more complicated than just a single planar rotation, because it's possible to have 2 simultaneous rotations in orthogonal planes with possibly different rates of rotation. So to cover the general case, you'll have to specify two pairs of vectors in order to fully specify a 4D rotation. (Well, technically you only need 2 vectors and 2 rotation rates, because one plane uniquely defines the other, but to be general across higher dimensions, and to keep the concept simple, use 2 pairs of vectors.) In general, in (2n)-dimensions it is possible to have n independent simultaneous rotations, which is one of the reasons a quaternion-like, closed system isn't really possible beyond 3D. The rotational group in higher dimensional space simply becomes too complex for such simple systems to be represent all the possibilities.

Note that doing it this way is essentially equivalent to the geometric algebra method of representing rotations.
quickfur
Pentonian

Posts: 2601
Joined: Thu Sep 02, 2004 11:20 pm
Location: The Great White North 