Quaternions¶
Overview¶
A unit quaternion is a compact, well-behaved way to represent a rotation. A rotation by angle \(\theta\) about the unit axis \(\underline{u}\) is the quaternion
\(\underline{e} = \{e_0, e_1, e_2\}\) is the vector part and \(e_3\) is the scalar part, written \(\hat{e} = \{\underline{e};\ e_3\}\). The hat marks a unit quantity. A quaternion that is not of unit length, such as a pure quaternion \(\{\underline{v};\ 0\}\), has no hat. Note the half angle: \(\hat{e}\) and \(-\hat{e}\) describe the same rotation.
Compared with a rotation matrix, a quaternion uses 4 numbers instead of 9 and
is easily brought back to unit length after round-off
(ksl_quaternion_normalize()). Compared with Euler angles, it has no
singular orientations (no gimbal lock, see Axes and Euler Angles), and two orientations
can be interpolated smoothly along the shortest path with spherical linear
interpolation, slerp (ksl_quaternion_slerp())
[18]. A sequence of key orientations can be
interpolated with squad (ksl_quaternion_squad_keys())
[19], which, unlike slerp between successive keys,
gives an angular velocity that is continuous at the keys. The time derivative
of a quaternion is linear in the angular velocity, which makes quaternions
convenient as orientation coordinates for integrating the equations of motion
(ksl_omega_to_dquaternion()). [10] is a readable
introduction.
Products. Quaternions are multiplied with the Hamilton product, in which
\(ij = k\). The product composes rotations in the same order as rotation
matrices: if \(\hat{e}_1\) and \(\hat{e}_2\) correspond to
\(R_1\) and \(R_2\), then \(\hat{e}_1 \hat{e}_2\) corresponds to
\(R_1 R_2\). The conjugate \(\hat{e}^* = \{-\underline{e};\ e_3\}\) is
the inverse rotation; conj in a function name means the conjugate of that
operand, so ksl_product_qconjq computes \(\hat{e}_1^* \hat{e}_2\).
The subscripts 1 and 2 number the operands; a subscript 0 to 3 without a hat
is a component.
ksl_mat3x3_toQuaternion() and ksl_quaternion_toMat3x3() convert to and
from rotation matrices.
Axis quaternions take the half angle. ksl_product_qxq and the other
qx, qy and qz functions multiply by a rotation about a coordinate
axis given as a {sin, cos} pair. For a quaternion that pair is
\(\{\sin(\theta/2), \cos(\theta/2)\}\), whereas the matrix functions
(drx and so on) take \(\{\sin\theta, \cos\theta\}\):
double dc_half[2];
ksl_dc(0.5 * theta, dc_half); /* not ksl_dc(theta, ...) */
ksl_product_qxq(dc_half, &q, &qo); /* qo = qx(theta) * q */
Storage. ksl_quaternion_t holds four double values, 32 bytes
(ksl_quaternionf_t: 16 bytes), with the scalar part last:
\(e_0\) to \(e_3\) are the fields x, y, z, w, or
at[0] to at[3], and the vector part \(\underline{e}\) is also a
ksl_vec3_t named r. Some other libraries store the scalar first, so
check the order when exchanging data.
Double precision¶
double precision quaternion data structure |
|
allocate memory for n quaternions and set to identity |
|
Dot product of two quaternions, x1 x2 + y1 y2 + z1 z2 + w1 w2. |
|
Normalize a quaternion to unit length, in place. |
|
Scale quaternion x by a and add it to quaternion y: y += a * x. |
|
Convert a rotation matrix to a quaternion. |
|
Convert a quaternion to a rotation matrix. |
|
Spherical linear interpolation (slerp) between two quaternions. |
|
Normalized linear interpolation (nlerp) between two quaternions. |
|
Logarithm of a unit quaternion. |
|
Exponential of a pure quaternion. |
|
Control point of a key quaternion for ksl_quaternion_squad(). |
|
Spherical quadrangle interpolation (squad) between two key quaternions. |
|
Interpolate an array of key quaternions with squad. |
|
Apply a small rotation to a quaternion, to first order. |
|
Remove a small rotation from a quaternion, to first order. |
|
Time derivative of a quaternion from the angular velocity. |
|
Quaternion product qo = q1i * q2i. |
|
Quaternion product qo = conj(q1i) * q2i. |
|
Quaternion product qo = q1i * conj(q2i). |
|
Quaternion product qo = conj(q1i) * conj(q2i). |
|
Double precision quaternion product qo = qx * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qi * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qx) * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qi) * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qx * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qi * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qx) * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qi) * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qy * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qi * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qy) * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qi) * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qy * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qi * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qy) * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qi) * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qz * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qi * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qz) * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qi) * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qz * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = qi * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qz) * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Double precision quaternion product qo = conj(qi) * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Product of a quaternion and a vector, qo = qi * {vi, 0}. |
|
Product of a quaternion and a vector, qo = conj(qi) * {vi, 0}. |
|
Product of a quaternion and a vector, qo = {vi, 0} * qi. |
|
Product of a quaternion and a vector, qo = {vi, 0} * conj(qi). |
|
Construct a double precision quaternion from its components. |
-
union ksl_quaternion_t¶
- #include <types.h>
double precision quaternion data structure
-
ksl_quaternion_t *ksl_quaternion_alloc(int)¶
allocate memory for n quaternions and set to identity
-
static inline double ksl_dot_qq(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i)¶
Dot product of two quaternions, x1 x2 + y1 y2 + z1 z2 + w1 w2.
- Parameters:
q1i – [in] first quaternion
q2i – [in] second quaternion
- Returns:
the dot product of q1i and q2i
-
static inline void ksl_quaternion_normalize(ksl_quaternion_t *qi)¶
Normalize a quaternion to unit length, in place.
qi must not be zero.
- Parameters:
qi – [in,out] quaternion to normalize
-
static inline void ksl_axpy_qq(const double a, const ksl_quaternion_t *x, ksl_quaternion_t *y)¶
Scale quaternion x by a and add it to quaternion y: y += a * x.
- Parameters:
a – [in] scale factor
x – [in] quaternion to scale and add
y – [in,out] quaternion that a * x is added to
-
void ksl_mat3x3_toQuaternion(const ksl_mat3x3_t *ri, ksl_quaternion_t *qo)¶
Convert a rotation matrix to a quaternion.
The inverse of ksl_quaternion_toMat3x3(). A rotation matrix determines its quaternion only up to sign, since q and -q give the same matrix. When the trace of the matrix is positive, the returned quaternion has w > 0.
- Parameters:
ri – [in] rotation matrix
qo – [out] quaternion
-
static inline void ksl_quaternion_toMat3x3(ksl_quaternion_t *qi, ksl_mat3x3_t *ro)¶
Convert a quaternion to a rotation matrix.
qi is first normalized in place. For \(\hat{e} = \{e_0, e_1, e_2, e_3\}\),
\[\begin{split} R = \begin{bmatrix} e_3^2 + e_0^2 - e_1^2 - e_2^2 & 2(e_0 e_1 - e_3 e_2) & 2(e_0 e_2 + e_3 e_1) \\ 2(e_0 e_1 + e_3 e_2) & e_3^2 - e_0^2 + e_1^2 - e_2^2 & 2(e_1 e_2 - e_3 e_0) \\ 2(e_0 e_2 - e_3 e_1) & 2(e_1 e_2 + e_3 e_0) & e_3^2 - e_0^2 - e_1^2 + e_2^2 \end{bmatrix} \end{split}\]- Parameters:
qi – [in,out] quaternion, normalized on return
ro – [out] rotation matrix
-
static inline void ksl_quaternion_slerp(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i, double *t, ksl_quaternion_t *qo)¶
Spherical linear interpolation (slerp) between two quaternions.
Interpolates along the great circle from q1i to q2i at constant angular velocity (Shoemake, 1985; see the References). Since q2i and -q2i are the same rotation, the one closer to q1i is used, so the interpolation takes the shorter path; at t = 1 the result may therefore be -q2i.
- Parameters:
q1i – [in] quaternion at t = 0
q2i – [in] quaternion at t = 1
t – [in] interpolation parameter, from 0 to 1
qo – [out] interpolated quaternion
-
static inline void ksl_quaternion_nlerp(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i, const double *t, ksl_quaternion_t *qo)¶
Normalized linear interpolation (nlerp) between two quaternions.
Interpolates linearly between q1i and q2i and normalizes the result. It follows the same path as ksl_quaternion_slerp() at lower cost, but not at constant angular velocity. If the dot product of q1i and q2i is negative, q2i is negated so that the interpolation takes the shorter path.
- Parameters:
q1i – [in] quaternion at t = 0
q2i – [in] quaternion at t = 1
t – [in] interpolation parameter, from 0 to 1
qo – [out] interpolated quaternion
-
void ksl_quaternion_log(const ksl_quaternion_t *qi, ksl_vec3_t *vo)¶
Logarithm of a unit quaternion.
For the unit quaternion \(\hat{e} = \{\underline{u}\sin\phi;\ \cos\phi\}\), with \(0 \le \phi \le \pi\), the logarithm is the pure quaternion \(\log \hat{e} = \{\underline{u}\,\phi;\ 0\}\); its vector part, half the rotation vector, is returned. If qi is a rotation of more than \(\pi\) ( \(e_3 < 0\)), so is the result, \(|\log \hat{e}| > \pi/2\); negate qi first for the shorter rotation. The inverse of ksl_quaternion_exp().
- Parameters:
qi – [in] unit quaternion
vo – [out] vector part of log(qi)
-
void ksl_quaternion_exp(const ksl_vec3_t *vi, ksl_quaternion_t *qo)¶
Exponential of a pure quaternion.
For the pure quaternion \(\{\underline{v};\ 0\}\) with \(\phi = |\underline{v}|\), \(\exp\{\underline{v};\ 0\} = \{\underline{v}\sin(\phi)/\phi;\ \cos\phi\}\), the rotation by \(2\phi\) about \(\underline{v}\). The inverse of ksl_quaternion_log().
- Parameters:
vi – [in] vector part of a pure quaternion
qo – [out] unit quaternion exp(vi)
-
void ksl_quaternion_squad_control(const ksl_quaternion_t *qprevi, const ksl_quaternion_t *qi, const ksl_quaternion_t *qnexti, ksl_quaternion_t *so)¶
Control point of a key quaternion for ksl_quaternion_squad().
Given the key \(\hat{e}_i\) and its neighbors \(\hat{e}_{i-1}\) and \(\hat{e}_{i+1}\), computes (Shoemake, 1987; see the References)
\[ \hat{s}_i = \hat{e}_i \exp\left(-\frac{\log(\hat{e}_i^* \hat{e}_{i+1}) + \log(\hat{e}_i^* \hat{e}_{i-1})}{4} \right) \]which makes the squad curve through the keys continuous in angular velocity at \(\hat{e}_i\). The differences \(\hat{e}_i^* \hat{e}_{i\pm1}\) are taken as the shorter rotation, so the signs of the keys do not matter, and \(\hat{s}_i\) has the sign of \(\hat{e}_i\). At the first and last key there is only one neighbor; use the key itself as its control point, as ksl_quaternion_squad_keys() does.
- Parameters:
qprevi – [in] previous key, \(\hat{e}_{i-1}\)
qi – [in] key, \(\hat{e}_i\)
qnexti – [in] next key, \(\hat{e}_{i+1}\)
so – [out] control point, \(\hat{s}_i\)
-
void ksl_quaternion_squad(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i, const ksl_quaternion_t *s1i, const ksl_quaternion_t *s2i, const double *t, ksl_quaternion_t *qo)¶
Spherical quadrangle interpolation (squad) between two key quaternions.
Interpolates from the key \(\hat{e}_1\) to the next key \(\hat{e}_2\) along a smooth curve shaped by their control points \(\hat{s}_1\) and \(\hat{s}_2\) from ksl_quaternion_squad_control() (Shoemake, 1987; see the References):
\[ \mathrm{squad}(\hat{e}_1, \hat{e}_2, \hat{s}_1, \hat{s}_2, t) = \mathrm{slerp}\big( \mathrm{slerp}(\hat{e}_1, \hat{e}_2, t), \mathrm{slerp}(\hat{s}_1, \hat{s}_2, t), 2t(1 - t)\big) \]Joining the curves between successive keys gives an orientation path through all the keys that is continuous in angular velocity, unlike slerp between successive keys, whose angular velocity jumps at every key. The slerps take the shorter path, so the signs of the keys do not matter. To interpolate an array of keys, see ksl_quaternion_squad_keys().
- Parameters:
q1i – [in] key at t = 0
q2i – [in] key at t = 1
s1i – [in] control point of q1i
s2i – [in] control point of q2i
t – [in] interpolation parameter, from 0 to 1
qo – [out] interpolated quaternion
-
void ksl_quaternion_squad_keys(int n, const ksl_quaternion_t *keys, const double *t, ksl_quaternion_t *qo)¶
Interpolate an array of key quaternions with squad.
Evaluates the squad curve through the n keys at the parameter t, which runs from 0 at keys[0] to n - 1 at keys[n - 1]: key k is reached at t = k, so the keys are taken as equally spaced in time. Between keys k and k + 1 it calls ksl_quaternion_squad() with t - k, computing the two control points with ksl_quaternion_squad_control(); the first and last keys are their own control points. t outside [0, n - 1] is clamped. The signs of the keys do not matter.
To evaluate many points, it is cheaper to compute the control points of all the keys once with ksl_quaternion_squad_control() and call ksl_quaternion_squad() directly.
- Parameters:
n – [in] number of keys, at least 1
keys – [in] key quaternions
t – [in] key parameter, from 0 to n - 1
qo – [out] interpolated quaternion
-
static inline void ksl_add_dpiToq(const ksl_vec3_t *dpi, ksl_quaternion_t *qi)¶
Apply a small rotation to a quaternion, to first order.
Adds the change in the quaternion produced by a small rotation vector \(\Delta\underline{\pi}\) whose coordinates are expressed in the rotated (body) frame:
\[\begin{split} \hat{e} \leftarrow \hat{e} + \tfrac{1}{2}\, \hat{e} \begin{Bmatrix} \Delta\underline{\pi} \\ 0 \end{Bmatrix} \end{split}\]The result is not normalized.- Parameters:
dpi – [in] small rotation vector, body frame coordinates
qi – [in,out] quaternion to update
-
static inline void ksl_subtract_dpiFromq(const ksl_vec3_t *dpi, ksl_quaternion_t *qi)¶
Remove a small rotation from a quaternion, to first order.
The reverse of ksl_add_dpiToq():
\[\begin{split} \hat{e} \leftarrow \hat{e} - \tfrac{1}{2}\, \hat{e} \begin{Bmatrix} \Delta\underline{\pi} \\ 0 \end{Bmatrix} \end{split}\]The result is not normalized.- Parameters:
dpi – [in] small rotation vector, body frame coordinates
qi – [in,out] quaternion to update
-
static inline void ksl_omega_to_dquaternion(const ksl_vec3_t *w, const ksl_quaternion_t *qi, ksl_quaternion_t *dqo)¶
Time derivative of a quaternion from the angular velocity.
\[\begin{split} \dot{\hat{e}} = \tfrac{1}{2} \begin{Bmatrix} \underline{\omega} \\ 0 \end{Bmatrix} \hat{e} + \frac{1}{2\tau}\left(1 - \hat{e}^T \hat{e}\right) \hat{e}, \qquad \tau = 0.5 \end{split}\]where the coordinates of the angular velocity \(\underline{\omega}\) are expressed in the fixed frame. The second term keeps the quaternion at unit length during numerical integration: it is zero at unit length and pulls the length back toward 1 otherwise.- Parameters:
w – [in] angular velocity, fixed frame coordinates
qi – [in] quaternion
dqo – [out] time derivative of the quaternion
-
static inline void ksl_product_qq(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i, ksl_quaternion_t *qo)¶
Quaternion product qo = q1i * q2i.
The Hamilton product of two quaternions. For a quaternion \(\hat{e} = \{e_0, e_1, e_2, e_3\}\) it can be written as a matrix product, \(\hat{e}_1 \hat{e}_2 = L(\hat{e}_1)\, \hat{e}_2 = R(\hat{e}_2)\, \hat{e}_1\), with
\[\begin{split} L(\hat{e}) = \begin{bmatrix} e_3 & -e_2 & e_1 & e_0 \\ e_2 & e_3 & -e_0 & e_1 \\ -e_1 & e_0 & e_3 & e_2 \\ -e_0 & -e_1 & -e_2 & e_3 \end{bmatrix}, \qquad R(\hat{e}) = \begin{bmatrix} e_3 & e_2 & -e_1 & e_0 \\ -e_2 & e_3 & e_0 & e_1 \\ e_1 & -e_0 & e_3 & e_2 \\ -e_0 & -e_1 & -e_2 & e_3 \end{bmatrix} \end{split}\]- Parameters:
q1i – [in] first quaternion
q2i – [in] second quaternion
qo – [out] product
-
static inline void ksl_product_qconjq(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i, ksl_quaternion_t *qo)¶
Quaternion product qo = conj(q1i) * q2i.
Computes \(\hat{e}_o = \hat{e}_1^* \hat{e}_2\). See ksl_product_qq() for the matrix form of the product.
- Parameters:
q1i – [in] first quaternion
q2i – [in] second quaternion
qo – [out] product
-
static inline void ksl_product_qqconj(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i, ksl_quaternion_t *qo)¶
Quaternion product qo = q1i * conj(q2i).
Computes \(\hat{e}_o = \hat{e}_1 \hat{e}_2^*\). See ksl_product_qq() for the matrix form of the product.
- Parameters:
q1i – [in] first quaternion
q2i – [in] second quaternion
qo – [out] product
-
static inline void ksl_product_qconjqconj(const ksl_quaternion_t *q1i, const ksl_quaternion_t *q2i, ksl_quaternion_t *qo)¶
Quaternion product qo = conj(q1i) * conj(q2i).
Computes \(\hat{e}_o = \hat{e}_1^* \hat{e}_2^*\). See ksl_product_qq() for the matrix form of the product.
- Parameters:
q1i – [in] first quaternion
q2i – [in] second quaternion
qo – [out] product
-
static inline void ksl_product_qxq(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qx * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqx(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qi * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qxconjq(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qx) * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqx(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qi) * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qxqconj(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qx * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqxconj(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qi * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qxconjqconj(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qx) * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqxconj(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qi) * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyq(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qy * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqy(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qi * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyconjq(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qy) * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqy(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qi) * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyqconj(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qy * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqyconj(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qi * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyconjqconj(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qy) * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqyconj(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qi) * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzq(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qz * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqz(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qi * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzconjq(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qz) * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqz(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qi) * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzqconj(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qz * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqzconj(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = qi * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzconjqconj(const double dci[2], const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qz) * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqzconj(const ksl_quaternion_t *qi, const double dci[2], ksl_quaternion_t *qo)¶
Double precision quaternion product qo = conj(qi) * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qv(const ksl_quaternion_t *qi, const ksl_vec3_t *vi, ksl_quaternion_t *qo)¶
Product of a quaternion and a vector, qo = qi * {vi, 0}.
The vector is treated as a quaternion with zero scalar part:
\[\begin{split} \hat{e} \begin{Bmatrix} \underline{v} \\ 0 \end{Bmatrix} \end{split}\]- Parameters:
qi – [in] quaternion
vi – [in] vector
qo – [out] product
-
static inline void ksl_product_qconjv(const ksl_quaternion_t *qi, const ksl_vec3_t *vi, ksl_quaternion_t *qo)¶
Product of a quaternion and a vector, qo = conj(qi) * {vi, 0}.
The vector is treated as a quaternion with zero scalar part:
\[\begin{split} \hat{e}^* \begin{Bmatrix} \underline{v} \\ 0 \end{Bmatrix} \end{split}\]- Parameters:
qi – [in] quaternion
vi – [in] vector
qo – [out] product
-
static inline void ksl_product_vq(const ksl_vec3_t *vi, const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Product of a quaternion and a vector, qo = {vi, 0} * qi.
The vector is treated as a quaternion with zero scalar part:
\[\begin{split} \begin{Bmatrix} \underline{v} \\ 0 \end{Bmatrix} \hat{e} \end{split}\]- Parameters:
vi – [in] vector
qi – [in] quaternion
qo – [out] product
-
static inline void ksl_product_vqconj(const ksl_vec3_t *vi, const ksl_quaternion_t *qi, ksl_quaternion_t *qo)¶
Product of a quaternion and a vector, qo = {vi, 0} * conj(qi).
The vector is treated as a quaternion with zero scalar part:
\[\begin{split} \begin{Bmatrix} \underline{v} \\ 0 \end{Bmatrix} \hat{e}^* \end{split}\]- Parameters:
vi – [in] vector
qi – [in] quaternion
qo – [out] product
-
static inline ksl_quaternion_t ksl_quaternion(double x, double y, double z, double w)¶
Construct a double precision quaternion from its components.
- Parameters:
x – [in] first vector component
y – [in] second vector component
z – [in] third vector component
w – [in] scalar component
- Returns:
the quaternion {x, y, z, w}
Single precision¶
single precision quaternion data structure |
|
allocate memory for n quaternions and set to identity |
|
Single precision version of ksl_quaternion_normalize(). |
|
Single precision version of ksl_mat3x3_toQuaternion(). |
|
Single precision version of ksl_dot_qq(). |
|
Single precision version of ksl_axpy_qq(). |
|
Single precision version of ksl_quaternion_toMat3x3(). |
|
Single precision version of ksl_quaternion_slerp(). |
|
Single precision version of ksl_quaternion_nlerp(). |
|
Single precision version of ksl_quaternion_log(). |
|
Single precision version of ksl_quaternion_exp(). |
|
Single precision version of ksl_quaternion_squad_control(). |
|
Single precision version of ksl_quaternion_squad(). |
|
Single precision version of ksl_quaternion_squad_keys(). |
|
Single precision version of ksl_product_qq(). |
|
Single precision version of ksl_product_qconjq(). |
|
Single precision version of ksl_product_qqconj(). |
|
Single precision version of ksl_product_qconjqconj(). |
|
Single precision quaternion product qo = qx * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qi * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qx) * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qi) * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qx * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qi * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qx) * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qi) * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qy * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qi * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qy) * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qi) * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qy * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qi * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qy) * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qi) * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qz * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qi * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qz) * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qi) * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qz * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = qi * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qz) * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision quaternion product qo = conj(qi) * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}. |
|
Single precision version of ksl_product_qv(). |
|
Single precision version of ksl_product_qconjv(). |
|
Single precision version of ksl_product_vq(). |
|
Single precision version of ksl_product_vqconj(). |
|
Single precision version of ksl_quaternion(). |
-
union ksl_quaternionf_t¶
- #include <types.h>
single precision quaternion data structure
-
ksl_quaternionf_t *ksl_quaternionf_alloc(int)¶
allocate memory for n quaternions and set to identity
-
static inline void ksl_quaternionf_normalize(ksl_quaternionf_t *qi)¶
Single precision version of ksl_quaternion_normalize().
-
inline void ksl_mat3x3f_toQuaternion(const ksl_mat3x3f_t *ri, ksl_quaternionf_t *qo)¶
Single precision version of ksl_mat3x3_toQuaternion().
-
static inline float ksl_dot_qqf(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i)¶
Single precision version of ksl_dot_qq().
-
static inline void ksl_axpy_qqf(const float a, const ksl_quaternionf_t *x, ksl_quaternionf_t *y)¶
Single precision version of ksl_axpy_qq().
-
static inline void ksl_quaternionf_toMat3x3f(ksl_quaternionf_t *qi, ksl_mat3x3f_t *ro)¶
Single precision version of ksl_quaternion_toMat3x3().
-
static inline void ksl_quaternionf_slerp(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i, float *t, ksl_quaternionf_t *qo)¶
Single precision version of ksl_quaternion_slerp().
-
static inline void ksl_quaternionf_nlerp(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i, const float *t, ksl_quaternionf_t *qo)¶
Single precision version of ksl_quaternion_nlerp().
-
void ksl_quaternionf_log(const ksl_quaternionf_t *qi, ksl_vec3f_t *vo)¶
Single precision version of ksl_quaternion_log().
-
void ksl_quaternionf_exp(const ksl_vec3f_t *vi, ksl_quaternionf_t *qo)¶
Single precision version of ksl_quaternion_exp().
-
void ksl_quaternionf_squad_control(const ksl_quaternionf_t *qprevi, const ksl_quaternionf_t *qi, const ksl_quaternionf_t *qnexti, ksl_quaternionf_t *so)¶
Single precision version of ksl_quaternion_squad_control().
-
void ksl_quaternionf_squad(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i, const ksl_quaternionf_t *s1i, const ksl_quaternionf_t *s2i, const float *t, ksl_quaternionf_t *qo)¶
Single precision version of ksl_quaternion_squad().
-
void ksl_quaternionf_squad_keys(int n, const ksl_quaternionf_t *keys, const float *t, ksl_quaternionf_t *qo)¶
Single precision version of ksl_quaternion_squad_keys().
-
static inline void ksl_product_qqf(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_qq().
-
static inline void ksl_product_qconjqf(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_qconjq().
-
static inline void ksl_product_qqconjf(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_qqconj().
-
static inline void ksl_product_qconjqconjf(const ksl_quaternionf_t *q1i, const ksl_quaternionf_t *q2i, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_qconjqconj().
-
static inline void ksl_product_qxqf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qx * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqxf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qi * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qxconjqf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qx) * qi, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqxf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qi) * qx, where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qxqconjf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qx * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqxconjf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qi * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qxconjqconjf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qx) * conj(qi), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqxconjf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qi) * conj(qx), where qx is the rotation about the x axis qx = {dci[0], 0, 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyqf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qy * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqyf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qi * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyconjqf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qy) * qi, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqyf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qi) * qy, where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyqconjf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qy * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqyconjf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qi * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qyconjqconjf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qy) * conj(qi), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqyconjf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qi) * conj(qy), where qy is the rotation about the y axis qy = {0, dci[0], 0, dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzqf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qz * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqzf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qi * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzconjqf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qz) * qi, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqzf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qi) * qz, where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzqconjf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qz * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qqzconjf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = qi * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qzconjqconjf(const float dci[2], const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qz) * conj(qi), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qconjqzconjf(const ksl_quaternionf_t *qi, const float dci[2], ksl_quaternionf_t *qo)¶
Single precision quaternion product qo = conj(qi) * conj(qz), where qz is the rotation about the z axis qz = {0, 0, dci[0], dci[1]} given by dci = {sin(theta/2), cos(theta/2)}.
-
static inline void ksl_product_qvf(const ksl_quaternionf_t *qi, const ksl_vec3f_t *vi, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_qv().
-
static inline void ksl_product_qconjvf(const ksl_quaternionf_t *qi, const ksl_vec3f_t *vi, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_qconjv().
-
static inline void ksl_product_vqf(const ksl_vec3f_t *vi, const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_vq().
-
static inline void ksl_product_vqconjf(const ksl_vec3f_t *vi, const ksl_quaternionf_t *qi, ksl_quaternionf_t *qo)¶
Single precision version of ksl_product_vqconj().
-
static inline ksl_quaternionf_t ksl_quaternionf(float, float, float, float)¶
Single precision version of ksl_quaternion().