# QUATERNIONS Quaternion Arithmetic

QUATERNIONS is a ++C 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.

### 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 C++ library which implements certain elementary functions for single precision complex (C4) variables.

C8LIB, a C++ library which implements certain elementary functions for double precision complex (C8) variables;

COMPLEX_NUMBERS, a C++ program which demonstrates some simple features involved in the use of complex numbers in MATLAB programming.

I4LIB, a C++ library which contains many utility routines, using "I4" or "single precision integer" arithmetic.

R8LIB, a C++ library which contains many utility routines, using "R8" or "double precision real" arithmetic.

### Reference:

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

### List of Routines:

• Q8_CONJUGATE conjugates a quaternion.
• Q8_INVERSE inverts a quaternion.
• Q8_MULTIPLY multiplies two quaternions.
• Q8_NORM computes the norm of a quaternion.
• Q8_NORMAL_01 returns a normally distributed quaternion.
• R8_ACOS computes the arc cosine function, with argument truncation.
• R8MAT_MV_NEW multiplies a matrix times a vector.
• R8MAT_PRINT prints an R8MAT.
• R8MAT_PRINT_SOME prints some of an R8MAT.
• R8VEC_COPY_NEW copies an R8VEC.
• R8VEC_CROSS_PRODUCT_3D computes the cross product of two R8VEC's in 3D.
• R8VEC_DOT_PRODUCT computes the dot product of a pair of R8VEC's.
• R8VEC_NORM returns the L2 norm of an R8VEC.
• R8VEC_PRINT prints an R8VEC.
• R8VEC_UNIFORM_01_NEW returns a unit pseudorandom R8VEC.
• R8VEC_ZEROS_NEW creates and zeroes an R8VEC.
• ROTATION_AXIS_VECTOR rotates a vector around an axis vector in 3D.
• ROTATION_AXIS2MAT converts a rotation from axis to matrix format in 3D.
• ROTATION_AXIS2QUAT converts a rotation from axis to quaternion format in 3D.
• ROTATION_MAT_VECTOR applies a marix rotation to a vector in 3d.
• ROTATION_MAT2AXIS converts a rotation from matrix to axis format in 3D.
• ROTATION_MAT2QUAT converts a rotation from matrix to quaternion format in 3D.
• ROTATION_QUAT_VECTOR applies a quaternion rotation to a vector in 3d.
• ROTATION_QUAT2AXIS converts a rotation from quaternion to axis format in 3D.
• ROTATION_QUAT2MAT converts a rotation from quaternion to matrix format in 3D.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

You can go up one level to the C++ source codes.

Last revised on 06 August 2018.