Zephyr Scientific Library (zscilib)
|
Go to the documentation of this file.
66 #ifndef ZEPHYR_INCLUDE_ZSL_QUATERNIONS_H_
67 #define ZEPHYR_INCLUDE_ZSL_QUATERNIONS_H_
int zsl_quat_to_unit_d(struct zsl_quat *q)
Normalises to unit quaternion (destructive).
zsl_real_t zsl_quat_magn(struct zsl_quat *q)
Calculates the magnitude (or length) of the quaternion, a scalar value equal to the square root of th...
int zsl_quat_scale(struct zsl_quat *q, zsl_real_t s, struct zsl_quat *qs)
Multiples each element in the quaternion by a scalar value.
int zsl_quat_to_axis_angle(struct zsl_quat *q, struct zsl_vec *a, zsl_real_t *b)
Converts a unit quaternion to it's axis-angle rotation equivalent.
zsl_real_t idx[4]
Allows access as an array.
zsl_real_t y
The second vector component.
Represents a quaternion, a 4D structure capable of representing 3D rigid body orientations.
int zsl_quat_inv(struct zsl_quat *q, struct zsl_quat *qi)
Calculates the multiplicative inverse of unit quaternion 'q'.
zsl_real_t k
The third imaginary component.
int zsl_quat_to_unit(struct zsl_quat *q, struct zsl_quat *qn)
Normalises the input to be a "unit" or "rotation" quaternion, AKA a versor, such that the square root...
int zsl_quat_from_ang_mom(struct zsl_vec *l, struct zsl_quat *qin, zsl_real_t *i, zsl_real_t t, struct zsl_quat *qout)
Updates an orientation quaternion with new information in form of angular momentum,...
Represents a m x n matrix, with data stored in row-major order.
zsl_real_t i
The first imaginary component.
int zsl_quat_slerp(struct zsl_quat *qa, struct zsl_quat *qb, zsl_real_t t, struct zsl_quat *qi)
Spherical linear interpolation (SLERP).
int zsl_quat_to_rot_mtx(struct zsl_quat *q, struct zsl_mtx *m)
Converts a unit quaternion to it's equivalent rotation matrix.
int zsl_quat_diff(struct zsl_quat *qa, struct zsl_quat *qb, struct zsl_quat *qd)
Calculates the rotation (qd) from qa to qb using the multiplicative inverse, such that qb = qa * qd.
int zsl_quat_from_rot_mtx(struct zsl_mtx *m, struct zsl_quat *q)
Converts a rotation matrix to it's equivalent unit quaternion.
int zsl_quat_to_euler(struct zsl_quat *q, struct zsl_euler *e)
Converts a unit quaternion to it's equivalent Euler angle. Euler values expressed in radians.
int zsl_quat_mult(struct zsl_quat *qa, struct zsl_quat *qb, struct zsl_quat *qm)
Multiples the two supplied unit quaternions (a * b) together, and stores the results in qm.
An ordered triplet of real numbers describing the orientation of a rigid body in three-dimensional (E...
int zsl_quat_exp(struct zsl_quat *q, struct zsl_quat *qe)
Calculates the exponential of a unit quaternion.
int zsl_quat_from_ang_vel(struct zsl_vec *w, struct zsl_quat *qin, zsl_real_t t, struct zsl_quat *qout)
Updates an orientation quaternion with new information in form of angular velocity and time elapsed.
int zsl_quat_conj(struct zsl_quat *q, struct zsl_quat *qc)
Calculates the complex conjugate of 'q'.
void zsl_quat_init(struct zsl_quat *q, enum zsl_quat_type type)
Convenience function to set the supplied quaternion into a known state.
zsl_real_t j
The second imaginary component.
int zsl_quat_inv_d(struct zsl_quat *q)
Inverts unit quaternion 'q' (destructive).
int zsl_quat_from_euler(struct zsl_euler *e, struct zsl_quat *q)
Converts a Euler angle to a unit quaternion. Euler values expressed in radians.
zsl_real_t x
The first vector component.
zsl_real_t r
The real component.
int zsl_quat_rot(struct zsl_quat *qa, struct zsl_quat *qb, struct zsl_quat *qr)
Rotates the pure quaternion qb using the quaternion qa.
zsl_real_t z
The third vector component.
API header file for matrices in zscilib.
int zsl_quat_scale_d(struct zsl_quat *q, zsl_real_t s)
Multiples each element in the quaternion by a scalar value (destructive).
int zsl_quat_lerp(struct zsl_quat *qa, struct zsl_quat *qb, zsl_real_t t, struct zsl_quat *qi)
Linear interpolation (LERP).
int zsl_quat_from_axis_angle(struct zsl_vec *a, zsl_real_t *b, struct zsl_quat *q)
Converts axis-angle rotation to its unit quaternion equivalent.
API header file for zscilib.
int zsl_quat_print(struct zsl_quat *q)
Print the supplied quaternion using printf in a human-readable manner.
int zsl_quat_log(struct zsl_quat *q, struct zsl_quat *ql)
Calculates the natural logarithm of a unit quaternion.
int zsl_quat_pow(struct zsl_quat *q, zsl_real_t pow, struct zsl_quat *qout)
Multiples the supplied unit quaternions to the specified exponent, and stores the results in qout (wh...
@ ZSL_QUAT_TYPE_IDENTITY
Indicates no rotation, with the scalar value set to 1 and imaginary values set to 0.
zsl_quat_type
Represents various 'types' of quaternions that can be initialised with the zsl_quat_init function.
bool zsl_quat_is_unit(struct zsl_quat *q)
Verifies that this is a "unit" quaternion, meaning that it has a magnitude of 1, where sqrt(r^2+i^2+j...
API header file for euler angles in zscilib.
struct zsl_quat::@28::@32 alias
zsl_real_t w
The scalar component.