rotlib 1.0.0
Loading...
Searching...
No Matches
rotlib.h File Reference
#include <stdbool.h>

Go to the source code of this file.

Enumerations

enum  EulangSeq {
  ES_XYZ , ES_XZY , ES_YXZ , ES_YZX ,
  ES_ZXY , ES_ZYX
}
 Euler angle sequences. ES_ABC signifies first rotation about the A axis, second rotation about the B axis, and the third rotation about the C axis. More...

Functions

void align (const int n, const double *v, const int m, const double *old, const double *new, double *valigned)
 Rotates vectors such that a set of mutually orthogonal unit vectors aligns with another set of mutually orthogoanl unit vectors.
bool mat_is_rotmat (const double *mat)
 Checks whether a 2D array is a rotation matrix.
void quat_rand (double q[4])
 Creates a unit quarternion with random orientation.
void quat_identity (double q[4])
 Creates an identity quarternion.
void quat_conjugated (double q[4])
 Performs in-place conjugation of a quaternion.
void quat_inverted (double q[4])
 Performs in-place inversion of a quaternion.
void quat_normalized (double q[4])
 Performs in-place normalization of a quaternion.
bool quat_is_normalized (const double q[4])
 Returns true if a quaternion is normalized, i.e. if it is a unit quaternion.
void quat_prod (const double p[4], const double q[4], double pq[4], bool normalize)
 Calculates the product of two unit quaternions.
double quat_angle_between (const double p[4], const double q[4])
 Returns the angle between two unit quaternions.
void quat_interpolate (const double q1[4], const double q2[4], const double t, double q[4])
 Interpolates between two unit quaternions.
void quat_deriv_to_angvel_mat (const double q[4], double *mat)
 Returns the matrix mapping the derivative of a unit quaternion to angular velocity.
void quat_deriv_to_angvel (const double q[4], const double qdot[4], double angvel[3])
 Calculates the angular velocity from a unit quaternion and its time derivative.
void quat_deriv_from_angvel_mat (const double q[4], double *mat)
 Returns the matrix mapping the angular velocity to the time derivative of a unit quaternion.
void quat_deriv_from_angvel (const double q[4], const double angvel[3], double qdot[4])
 Calculates the time derivative of a unit quaternion from angular velocity.
void quat_rotmat (const double q[4], double *rotmat)
 Calculates the rotation matrix corresponding to a unit quaternion.
void quat_shiftmat (const double q[4], const bool forward, double *shiftmat)
 Calculates the shifter matrix corresponding to a unit quaternion.
void quat_rotate_vectors (const int n, const double *v, const double q[4], double *vrot)
 Rotates vectors by a unit quaternion.
void quat_shift_vectors (const int n, const double *v, const double q[4], const bool forward, double *vshift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by a unit quaternion, shifts vectors from A to B or B to A.
void quat_shift_tensor2 (const double *A, const double q[4], const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by a unit quaternion, shifts second-order tensors from A to B or B to A.
void quat_shift_tensor3 (const double *A, const double q[4], const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by a unit quaternion, shifts third-order tensors from A to B or B to A.
void quat_to_aa (const double q[4], double axis[3], double *angle)
 Converts a unit quaternion to an axis-angle representation.
void quat_to_dcm (const double q[4], double *dcm)
 Converts a unit quaternion to a direction cosine matrix.
void quat_to_euler (const double q[4], enum EulangSeq seq, const bool world, double euler[3])
 Converts a unit quaternion to an Euler angle sequence.
void aa_fix (double axis[3], double *angle, const bool normalize)
 Modifies axis and angle to ensure a right handed rotation with angle $\in [0, \pi)$$\in [0, \pi)$.
void aa_rand (double axis[3], double *angle)
 Generates a random orientation in axis-angle representation.
void aa_rotmat (const double axis[3], const double angle, double *rotmat)
 Calculates the rotation matrix corresponding to an axis-angle representation.
void aa_from_rotmat (const double *rotmat, double axis[3], double *angle)
 Extracts axis and angle from a rotation matrix.
void aa_rotate_vectors (const int n, const double *v, const double axis[3], const double angle, double *vrot)
 Rotates vectors about axis by angle.
void aa_shiftmat (const double axis[3], const double angle, const bool forward, double *shiftmat)
 Calculates the shifter matrix corresponding to an axis-angle representation.
void aa_shift_vectors (const int n, const double *v, const double axis[3], const double angle, const bool forward, double *vshift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by an axis-angle representation, shifts vectors from A to B or B to A.
void aa_shift_tensor2 (const double *A, const double axis[3], const double angle, const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by axis-angle representation, shifts second-order tensors from A to B or B to A.
void aa_shift_tensor3 (const double *A, const double axis[3], const double angle, const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by axis-angle representation, shifts third-order tensors from A to B or B to A.
void aa_to_quat (const double axis[3], const double angle, double q[4])
 Converts an axis-angle representation to a unit quaternion.
void aa_to_dcm (const double axis[3], const double angle, double *dcm)
 Converts an axis-angle representation to a direction cosine matrix.
void aa_to_euler (const double axis[3], const double angle, enum EulangSeq seq, const bool world, double euler[3])
 Converts an axis-angle representation to an Euler angle sequence.
bool mat_is_dcm (const double *mat)
 Checks is a 3 x 3 array is a direction cosine matrix.
void dcm_from_axes (const double *A, const double *B, double *dcm)
 Returns the direction cosine matrix of axes(i.e. frame) B with respect to axes(i.e. frame) A.
void dcm_rotmat (const double *dcm, double *rotmat)
 Returns the rotation matrix corresponding to a direction cosine matrix.
void dcm_shiftmat (const double *dcm, const bool forward, double *shiftmat)
 Returns the shifter matrix corresponding to a direction cosine matrix.
void dcm_rotate_vectors (const int n, const double *v, const double *dcm, double *vrot)
 Rotates vectors by a direction cosine matrix.
void dcm_shift_vectors (const int n, const double *v, const double *dcm, const bool forward, double *vshift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by a direction cosine matrix, shifts vectors from A to B or B to A.
void dcm_shift_tensor2 (const double *A, const double *dcm, const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by a direction cosine matrix, shifts second-order tensors from A to B or B to A.
void dcm_shift_tensor3 (const double *A, const double *dcm, const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by a direction cosine matrix, shifts third-order tensors from A to B or B to A.
void dcm_to_quat (const double *dcm, double q[4])
 Converts a direction cosine matrix to a unit quaternion.
void dcm_to_aa (const double *dcm, double axis[3], double *angle)
 Converts a direction cosine matrix to an axis-angle representation.
void dcm_to_euler (const double *dcm, enum EulangSeq seq, const bool world, double euler[3])
 Converts a direction cosine matrix to Euler angles.
void euler_rotmat (const double euler[3], enum EulangSeq seq, const bool world, double *rotmat)
 Calculates the rotation matrix for a set of Euler angles.
void euler_shiftmat (const double euler[3], enum EulangSeq seq, const bool world, const bool forward, double *shiftmat)
 Calculates the shifter matrix for a set of Euler angles.
void euler_rotate_vectors (const int n, const double *v, const double euler[3], enum EulangSeq seq, const bool world, double *vrot)
 Rotates vectors with a set of Euler angles.
void euler_shift_vectors (const int n, const double *v, const double euler[3], enum EulangSeq seq, const bool world, const bool forward, double *vshift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by three Euler angles, shifts vectors from A to B or B to A.
void euler_shift_tensor2 (const double *A, const double euler[3], enum EulangSeq seq, const bool world, const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by three Euler angles, shifts second-order tensors from A to B or B to A.
void euler_shift_tensor3 (const double *A, const double euler[3], enum EulangSeq seq, const bool world, const bool forward, double *Ashift)
 Given two frames A and B such that the orientation of frame B with respect to frame A is given by three Euler angles, shifts third-order tensors from A to B or B to A.
void euler_to_quat (const double euler[3], enum EulangSeq seq, const bool world, double q[4])
 Convert Euler angles to a unit quaternion.
void euler_to_aa (const double euler[3], enum EulangSeq seq, const bool world, double axis[3], double *angle)
 Convert Euler angles to an axis-angle representation.
void euler_to_dcm (const double euler[3], enum EulangSeq seq, const bool world, double *dcm)
 Convert Euler angles to a direction cosine matrix.
void euler_to_euler (const double euler[3], enum EulangSeq seq, const bool world, enum EulangSeq to_seq, const bool to_world, double to_euler[3])
 Converts Convert one set of Euler angles to another.

Enumeration Type Documentation

◆ EulangSeq

enum EulangSeq

Euler angle sequences. ES_ABC signifies first rotation about the A axis, second rotation about the B axis, and the third rotation about the C axis.

Note
Euler angle ranges:

XYZ, ZYX: phi in [-pi, pi], theta in [-pi/2, pi/2], psi in [-pi, pi]
XZY, YZX: phi in [-pi, pi], theta in [-pi, pi], psi in [-pi/2, pi/2] ZXY, YXZ: phi in [-pi/2, pi/2], theta in [-pi, pi], psi in [-pi, pi]

Euler angle sequence: XYZ (world). First rotation about X, second rotation
about Y, and the third rotation about Z axis of the world(i.e. fixed) frame. This is the same as the sequence used in Blender.
In contrast, the XYZ sequence is understood in the Aerospace community as:
First rotation about Z-axis, second rotation about Y-axis, and the third
rotation about X-axis of the body frame.

See also
http://www.geometrictools.com/Documentation/EulerAngles.pdf