Orientation Quaternion I am looking to work out the orientation between two quaternions to establish if they are parallel face-face orientation, side-side orientation or perpendicular orientation. At the moment I am taking the absolute of the dot product of two quaternions i.e.
tmp = abs(q1.dot(q2))
If tmp = 1 I identify them as being parallel face-face. Using this same method is it possible to identify them as side - side or perpendicular?
 A: Quaternions can be considered as a kind of vectors in a 4-dimensional hyperbolic space, and they have a complete vector product wherein the lenght of the product vector equals the product of the vector lengths. This vector product is given by the quaternion multiplication rule:
$$ \left( v_{0} + iv_{1} + jv_{2} + kv_{3} \right) \left( w_{0} + iw_{1} + jw_{2} + kw_{3} \right) = \left( v_{0}w_{0} - v_{1}w_{1} - v_{2}w_{2} - v_{3}w_{3} \right) + i \left(v_{0}w_{1} + v_{1}w_{0} + v_{2}w_{3} - v_{3}w_{2} \right) + j \left(v_{0}w_{2} - v_{1}w_{3} + v_{2}w_{0} + v_{3}w_{1} \right) + k \left( v_{0}w_{3} + v_{1}w_{2} - v_{2}w_{1} + v_{3}w_{0} \right) $$
You can take two quaternions as being "collinear" if the imaginary part of their product vector vanishes, and as being "orthogonal" if the real part of their product vector vanishes. Beware of imagination; we are in 4-dimensional space!
By the way, quaternions can be considered a as being the "square root" of Leonhard Euler's algebraic four-squares identity, which states that the product of two sums of four squares is always again a bilinear sum of four squares:
$$ \left( v_{0}^{2} + v_{1}^{2} + v_{2}^{2} + v_{3}^{2} \right) \left( w_{0}^{2} + w_{1}^{2} + w_{2}^{2} + w_{3}^{2} \right) = \left( v_{0}w_{0} - v_{1}w_{1} - v_{2}w_{2} - v_{3}w_{3} \right)^{2} + \left( v_{0}w_{1} + v_{1}w_{0} + v_{2}w_{3} - v_{3}w_{2} \right)^{2} + \left( v_{0}w_{2} - v_{1}w_{3} + v_{2}w_{0} + v_{3}w_{1} \right)^{2} + \left( v_{0}w_{3} + v_{1}w_{2} - v_{2}w_{1} + v_{3}w_{0} \right)^{2} $$
The proof of this is by simple algebraic evaluation.
Leonhard Euler's four-squares identity can be written as the produt
of two inner products v∙v and w∙w, which yields another inner product,
vw ∙ vw, and which therewith defines the complete vector product
vw corresponding to the quaternion multiplication rule.
$$ \left( v \cdot v \right) \left( w \cdot w \right) = vw \cdot vw $$
One can thus, in case of doubts with quaternion math, which is non-
commutative and may yield wrong results upon indiscriminate use, always
check back with the four-squares-identity.
