Quaternion Functions¶
-
inline Quaternion QDynamics::operator*(const Quaternion &lhs, const Quaternion &rhs)¶
The crucial quaternion multiplication operation, defined such that:
\(\mathsf{a} \otimes \mathsf{b} = \begin{pmatrix} a_0 b_0 - \vec{a} \cdot \vec{b} \\ a_0 \vec{b} + b_0 \vec{a} + \vec{a} \times \vec{b}\end{pmatrix}\) . Note that this product is highly non-commutative in general.
- Parameters
lhs – The first argument of the operation ( \(\mathsf{a}\) )
rhs – The second argument ( \(\mathsf{b}\) )
- Returns
The quaternion product ( \(\mathsf{a}\otimes\mathsf{b}\) )
-
inline Quaternion QDynamics::operator/(const Quaternion &lhs, const Quaternion &rhs)¶
Quaternion division operation, such that:
\(\mathsf{a} \oslash \mathsf{b} = \frac{1}{|\mathsf{b}|^2} \mathsf{a} \otimes \overline{\mathsf{b}}\) .
- Parameters
lhs – The first argument of the operation ( \(\mathsf{a}\) )
rhs – The second argument ( \(\mathsf{b}\) )
- Returns
The quaternion division ( \(\mathsf{a}\oslash\mathsf{b}\) )
-
inline Quaternion QDynamics::operator*(const JSL::Matrix &lhs, const Quaternion &rhs)¶
The (slightly dodgy) matrix-quaternion product. In reality, casts the quaternion to R^4, multiplies, then casts back.
- Parameters
lhs – A JSL::Matrix object to be multiplied
rhs – A Quaternion object to be multiplied
- Returns
A Quaternion object of the resulting product
-
inline Quaternion QDynamics::exp(const Quaternion &a)¶
The quaternion exponential, defined such that:
\(\exp(\mathsf{a}) = \sum_{n = 0}^\infty \frac{\mathsf{a}^n}{n!}\)
- Parameters
a – The argument of the operation ( \(\mathsf{a}\) )
- Returns
The (analytically computed) quaternion exponential