[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] Skip to the content of the web site.

Rotations

Given a number z, the product wzw-1 rotates the imaginary component of z by an angle of 2 arg(w) radians around the line defined by ℑ(w) using the right-hand rule (a positive angle rotates clock-wise when looking out along ℑ(w) for quaternions). If w has unit length (i.e., |w| = 1) then this formula simplifies to w*zw.

These formulas are usually applied to quaternions for use in spatial rotations.

Finding the Appropriate Number w

To rotate the imaginary part of a number around the axis defined by ω where ω is a unit imaginary number through θ radians, use the number

w = cos(θ/2) + ω sin(θ/2).

Orientation

The formula wzw-1 rotates the imaginary component in the direction dictated by the right-hand rule. In order to rotate in the opposite direction (left-hand rule), use w-1zw.

Implementation

The special form of a rotation product results in significant cancellation of terms, and thus, the number of multiplications can be significantly reduced. For example, the product of three quaternions normally requires 32 floating-point products but this is reduced to 24 products (three of which are of the form 2×), the product of three octonions normally requires 128 floating-point products but this is reduced to 93 products (fourteen of which are of the form 2×), the product of three sedenions normally requires 512 floating-point products but this is reduced to 401 products (thirty of which are of the form 2×), and the product of three sedenions normally requires 2048 floating-point products but this is reduced to 1823 products (sixty-two of which are of the form 2×). The T rotate( const T & w ) member function assumes that argument w has unit length. If w does not have unit length, you can always calculate z.rotate( w )/w.norm() which is cheaper than z.rotate( w/w.abs() ).

Rotations and Non-Associativity

Note that, while octonions, sedenions, and trigintaduonions are non-associative, the expression is still well defined because these algebras are all flexible, that is, (wz)w = w(zw). Consequently:

(w*z)w = ((ℜ(w) − ℑ(w))z)w
= (ℜ(w)z − ℑ(w)z)w
= (ℜ(w)z)w − (ℑ(w)z)(ℜ(w) + ℑ(w))
= ℜ(w)(zw) − (ℑ(w)z)ℜ(w) − (ℑ(w)z)ℑ(w)
= ℜ(w)(zw) − ℑ(w)(zℜ(w)) − ℑ(w)(zℑ(w))
= ℜ(w)(zw) − ℑ(w)(zw)
= (ℜ(w) − ℑ(w))(zw)
= w*(zw)