Orthogonal hyperplane decomposition
[p, m] = ohd(q, a, b)
ohd(q, a ,b) decomposes a quaternion array element-by-element q into two components in orthogonal hyperplanes defined by a and b using the formulae p = ½(q + acb) and m = ½(q - acb) where c is the conjugate of q. The third parameter is optional, if omitted it is set equal to the second. If a is a pure quaternion, and b is omitted, p is parallel to a, and m is in the plane normal to a. (Parallel/perpendicular decomposition.) Other cases are determined by the values of the second and third parameters. Coxeter's paper is recommended as a reference for details of the geometry.
>> q = randq; >> [p,m] = ohd(q, randq, randq) p = 0.1606 - 0.1504 * I + 0.6234 * J - 0.6342 * K m = 0.1713 + 0.3609 * I + 0.00905 * J - 0.0333 * K >> scalar_product(p,m) ans = -1.2490e-16 % p and m are orthogonal.