User:Rschwieb/GA Discussion/Comparison of methods: rotations

=Description=

The subsequent sections first describe how a rotation is represented, then describe the procedures to solve basic tasks.

Basic rotation tasks:

:Problem A: Given two vectors, find a rotation with plane of rotation containing the vectors that turns the first vector in the direction of the second.

:Problem B: Given two sets of vectors, one of which is known to be obtained from the other through rotation, find a rotation that carries each vector in the first set to the corresponding vector in the second set (again keeping vectors orthogonal to all those involved unchanged).

:Problem C: in 3-D, given a plane and a specified angle of rotation, find a rotor representing the rotation.

:Problem D: (n-D analogues of C)

Rotation matrix procedure

  • Problem A: The matrix b aT rotates a unit vector a to a unit vector b More complicated than this: matrix needs to be full rank. Without thinking very hard I suspect you may have to construct full before-and-after orthonomal basis sets A and B, then form B AT similar to Problem B, but there may be some short-cuts for the invariant subspace.
  • Problem B: see e.g Triad method for 3d case; in higher dimensions, one could use Gram-Schmidt to enforce orthogonalisation.

Euler angles? procedure

GA procedure

In a geometric algebra, a rotation is represented directly by an element of the algebra, called a rotor. A rotor R acts upon any element X of the algebra to produce its rotated equivalent X′:

: \, X' = RXR^{-1} .

In 3 dimensions, this is exactly the quaternion method. (Found at [http://www.euvt.eu/fontijnes-formula-published/ Euvision Technologies]:

“Fontijne’s Formula” (apparently derived from GA): if 3D vector p rotates to p’, and q to q’, the quaternion of the rotation is [(q’+q)·(p’−p), (q’−q)×(p’−p)]. — Quondum 20:34, 6 February 2012 (UTC))

It is customary (but not necessary) to normalize R, so that RR~ = 1, i.e. R−1 = R~. R is always an even multivector. Here the notation A~ (alternately A) denotes the reversion of A.

;Solution of Problems A and B in n-D (in 3-D this is no different):

Given two vectors a and b with a2 = b2 = ±1, the rotation that rotates a into b and keeps their orthogonal complement unchanged is:

:R=\pm \frac{1+ba}

a+b

The solution has been normalized. The distinction of sign is topologically significant. The case of (a + b)2 = 0 corresponds to no solution.

::This rotation is associated with a plane of rotation given by ba. If b = −a, this is not sufficient to define a plane; there are many planes that could achieve such a rotation, but such rotations will also cause some vectors orthogonal to a and b to be transformed.

;Example solution of Problem B:

Given two sets of k vectors {ei} and {fi} related by a rotation, find a rotor R that rotates the one into the other (so that fi = ReiR−1), leaving all orthogonal vectors unchanged. Doran and Lazenby give the normalized solution for where the vectors form a 3-D basis in Euclidean space:

:\, R = \pm \frac{1 + f_j e^j}

1 + f_i e^i
,

where {ek} is the dual basis to {ek}.

The case of fkek = −1 requires special care.

A solution for n-D and n independent vectors related by a rotation (not verified):

:\, R = \pm \frac{1 + f_k e^k}{\sqrt{2 + 2 f_k \cdot e^k}}

;Example 3:

Given a plane and an angle of rotation in n-D, give the bivector describing the rotation and how R is related to it.

Given two vectors a and b spanning the plane and with the magnitude giving angle of rotation of θ in the direction from a to b, the bivector describing the plane and angle of rotation (picture a unit vector sweeping out a pizza slice) is

:\, B = \frac{\theta (a \wedge b)}

a^2 b^2 - (a \cdot b)^2

and the rotor is

:\, R = \exp (-B/2) .

This can be easily generalized to independent angles with respect orthogonal planes of rotation in 4-D and above: just add the bivectors.

;Example 4:

Smooth rotation: expression of the SLERP in GA.

Quaternion procedure

;Example "baby" solution in quaternions:

Problem: Demonstrate how to rotate the vector [0,1,1] 90 degrees about the y-axis to lie over [1,1,0] using a quaternion.

:I am inclined to think the problem through in 3D GA, and apply the following mapping (treating quaternions (underlined) as being the even subalgebra of the GA), with the correspondence {{math|1=i = −e2e3}}, {{math|1=j = −e3e1}}, {{math|1=k = −e1e2}}; also {{math|1=I = e1e2e3}}:

::MAPPING : QUATERNION ↔ {{math|1=G3,0}}

::identity : quaternion scalar ↔ scalar [{{math|1={{underline|a}} = a}}]

::dual : quaternion vector ↔ vector [{{math|1={{underline|a}} = −aI}}, {{math|1=a = {{underline|a}}I}}]

::identity : quaternion pseudovector ↔ bivector [{{math|1={{underline|a}} = a}}]

::identity : quaternion rotor ↔ even grade versor (i.e. proper rotor) [{{math|1={{underline|R}} = R}}]

::dual : quaternion reflection ↔ odd grade versor (i.e. improper rotor)

::dual : quaternion pseudoscalar ↔ pseudoscalar

:In GA, the rotor for the rotation (rotating \hat{z} = e_3 into \hat{x} = e_1 the short way around the {{math|y}}-axis; for the long way negate the rotor) is

:: \underline{R} = R = {1 + e_1e_3 \over \left| e_1 + e_2 \right|} = \frac{1}{\sqrt{2}} + { j \over \sqrt{2} }

:: a = e_2 + e_3 \qquad b = e_1 + e_2

:: \underline{a} = -aI = -(e_2 + e_3)e_1e_2e_3 = j+k \qquad \underline{b} = -bI = -(e_1 + e_2)e_1e_2e_3 = i+j

:So working purely with quaternions,

:: \underline{a} = j+k \qquad \underline{b} = i+j

:: \underline{R} = \tfrac{1}{\sqrt{2}} + \tfrac{j}{\sqrt{2}} \qquad \underline{R}^{\dagger} = \tfrac{1}{\sqrt{2}} - \tfrac{j}{\sqrt{2}}

:Checking, we find

::\underline{R}\underline{a}\underline{R}^{\dagger} = (\tfrac{1}{\sqrt{2}} + \tfrac{j}{\sqrt{2}})(j+k)(\tfrac{1}{\sqrt{2}} - \tfrac{j}{\sqrt{2}}) = i+j = \underline{b}

:as expected.

:Beware the normal convention with quaternions is not the GA-centric approach I have used, though I have deliberately chosen the dual mapping for vectors to have matching signs, so it may be directly equivalent. Note that I have used the GA vectors (not underlined) rather than the corresponding quaternion vectors to calculate the rotor, though finding the expression for \underline{R} from the quaternions \hat{\underline{x}} = -\hat{x}I = i etc. will be simple enough. Feel free to trim this down to a concise version. Also, no guarantees that this is correct. — Quondum 21:29, 28 April 2012 (UTC)