QUATERNIONS
Quaternion Arithmetic
QUATERNIONS,
a MATLAB library which
carries out some simple arithmetic operations for quaternions.
Rotations in 3D can be represented in a number of ways, including
quaternions, a rotation matrix, and a combination of a rotation axis
and rotation angle. This library includes functions to convert
a rotation from one representation to another, and to apply a rotation
to a given vector.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
QUATERNIONS is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
C4LIB,
a MATLAB library which
implements certain elementary functions for
single precision complex (C4) variables.
C8LIB,
a MATLAB library which
implements certain elementary functions for
double precision complex (C8) variables;
COMPLEX_NUMBERS,
a MATLAB program which
demonstrates some simple features involved in the use of
complex numbers in MATLAB programming.
I4LIB,
a MATLAB library which
contains many utility routines, using "I4" or "single precision integer"
arithmetic.
quaternions_test
R8LIB,
a MATLAB library which
contains many utility routines, using "R8" or
"double precision real" arithmetic.
Reference:

Jack Kuipers,
Quaternions and Rotation Sequences,
Princeton, 1998,
ISBN: 0691102988,
LC: QA196.K85.
Source Code:

degrees_to_radians.m,
converts an angle in degrees to one in radians;

q8_conjugate.m,
conjugates a quaternion;

q8_exponentiate.m,
exponentiates a quaternion;

q8_inverse.m,
inverts a quaternion;

q8_multiply.m,
multiplies two quaternions;

q8_multiply2.m,
multiplies two quaternions using a matrix;

q8_norm.m,
computes the L2 norm of a quaternion;

q8_normal_01.m,
selects a normally distributed quaternion;

q8_transpose_print.m,
prints a quaterion "transposed", or as a row vector.

r8_acos.m,
computes the inverse cosine of C;

r8mat_print.m,
prints an R8MAT;

r8mat_print_some.m,
prints some of an R8MAT;

r8vec_print.m,
prints an R8VEC;

r8vec_uniform_01.m,
returns a unit pseudorandom R8VEC.

radians_to_degrees.m,
converts an angle in radians to one in degrees;

rotation_axis_vector.m,
rotates a vector about an axis vector in 3D;

rotation_axis2mat.m,
converts a rotation from axis to matrix format in 3D;

rotation_axis2quat.m,
converts a rotation from axis to quaternion format in 3D;

rotation_mat_vector.m,
applies a matrix rotation to a vector in 3D;

rotation_mat2axis.m,
converts a rotation from matrix to axis format in 3D;

rotation_mat2quat.m,
converts a rotation from matrix to quaternion format in 3D;

rotation_quat_vector.m,
applies a quaternion rotation to a vector in 3D;

rotation_quat2axis.m,
converts a rotation from quaternion to axis format in 3D;

rotation_quat2mat.m,
converts a rotation from quaternion to matrix format in 3D;

timestamp.m,
prints the current YMDHMS date as a timestamp.
Last revised on 15 February 2019.