Quaternion Function Reference

factorq

Factorisation of a quaternion

Syntax

[f, g, theta] = factorq(q, mu, L)

Description

factorq factorizes a quaternion q, using the pure quaternion mu, such that the vector parts of the factors are orthogonal.

On return f is a quaternion, g is a unit quaternion, and theta is an angle, such that g = exp(mu .* theta) and g .* f = q or f .* g = q according as to whether the third parameter is specified as 'L' or 'R', respectively (the exponential factor is on the left or right).

f will be orthogonal to mu and therefore also to the vector part of exp(mu .* theta) = mu .* sin(theta).

Examples

>> q = randq;
>> mu = randv;
>> [f, theta] = factorq(q, mu, 'R')
 
f = 0.3864 + 0.2327 * I - 0.8896 * J + 0.07195 * K

theta = -2.1688

>> f .* exp(mu .* theta), q
 
ans = -0.2175 - 0.1983 * I + 0.5497 * J + 0.7818 * K
 
q   = -0.2175 - 0.1983 * I + 0.5497 * J + 0.7818 * K
 
>> scalar_product(f, mu)

ans = 1.8041e-16

(c) 2008-2016 Stephen J. Sangwine and Nicolas Le Bihan

License terms.