api/aspherix_quaternion.h

This is the header file used to define a quaternion class. Quaternions are used to describe the orientation of an object in 3D space. The member functions are:


Quaternion

Constructor

operator[]

Get a component value of the quaternion.

operator_getitem

Helper function.

operator+

Add two quaternions.

operator+=

Add a quaternion value to an existing one.

operator-

Subtract two quaternions.

operator-=

Subtract a quaternion value from an existing one.

operator*

Quaternion multiplication if the argument on the left is also a quaternion or scalar multiplication if the argument on the left is a scalar value.

operator*=

Scalar multiplication with a scalar value.

operator/

Scalar division.

operator/=

Scalar division of an existing quaternion.

operator-

Reverse a quaternion.

operator=

Copy a quaternion.

length_squared

Squared norm of a quaternion.

length

Norm of a quaternion.

normalize

Convert a quaternion to a unit quaternion.

print

Function to print a quaternion to stdout.

as_string

Returns the quaternion as string, e.g. for printing.