LibCapy - quaternion

Quaternion class.

Macros:

Enumerations:

None.

Typedefs:

Predeclaration of the Quaternion class

Struct CapyQuaternion :

Struct CapyQuaternion's properties:

Components (in x,y,z,w order)

Struct CapyQuaternion's methods:

None.

Functions:

Create a CapyQuaternion

Output and side effect(s):

Return a CapyQuaternion equivalent to no rotation

Create a quaternion for a given rotation axis and angle (same handness for the rotation as for the coordinates system)

Input argument(s):

axis: the axis (normalised)

theta: the angle in radians

Output and side effect(s):

Return a CapyQuaternion equivalent to the rotation.

Allocate memory for a new quaternion for a given rotation axis and angle (same handness for the rotation as for the coordinates system)

Input argument(s):

axis: the axis (normalised)

theta: the angle in radians

Output and side effect(s):

Return a CapyQuaternion equivalent to the rotation.

Exception(s):

May raise CapyExc_MallocFailed.

Allocate memory for a new CapyQuaternion and create it

Output and side effect(s):

Return a CapyQuaternion equivalent to no rotation

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyQuaternion

Input argument(s):

that: the CapyQuaternion to free

Free the memory used by a CapyQuaternion* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyQuaternion to free

Set the quaternion from a rotation matrix

Input argument(s):

that: the quaternion

mat: the rotation matrix (3x3)

Output and side effect(s):

The quaternion is updated.

Convert the quaternion to a rotation matrix

Input argument(s):

that: the quaternion

mat: the rotation matrix (3x3)

Output and side effect(s):

The rotation matrix is updated.

Add two quaternions.

Input argument(s):

that: the quaternion

qa: the quaternion to add

qb: the result quaternion

Output and side effect(s):

qb is updated with the quaternion representing the rotation of that followed by the rotation of qa. qb can be that or qa.

Substract two quaternions.

Input argument(s):

that: the quaternion

qa: the quaternion to substract

qb: the result quaternion

Output and side effect(s):

qb is updated with the quaternion representing the rotation of that followed by the inverse rotation of qa. qb can be that or qa.

Calculate the conjugate of the quaternion (ie the inverse rotation of 'that')

Input argument(s):

that: the quaternion

q: the result conjugate

Output and side effect(s):

q is updated. q can be 'that'

Apply a quaternion to a vector (ie rotate the vector by the rotation equivalent to the quaternion)

Input argument(s):

that: the quaternion

u: the vector to be rotated

v: the result vector

Output and side effect(s):

v is updated. v can be u.

Apply the conjugate of a quaternion to a vector (ie rotate the vector by the opposite rotation equivalent to the quaternion)

Input argument(s):

that: the quaternion

u: the vector to be rotated

v: the result vector

Output and side effect(s):

v is updated. v can be u.

Get the angle of the quaternion

Input argument(s):

that: the quaternion

Output and side effect(s):

Return the angle in radians

Get the rotation axis of the quaternion

Input argument(s):

that: the quaternion

axis: the result rotation axis

Output and side effect(s):

The result rotation axis is updated (null vector if no rotation)

Increase the rotation angle of the quaternion.

Input argument(s):

that: the quaternion

theta: angle in radians

Output and side effect(s):

The quaternion is updated.

Set the rotation axis and angle (same handness for the rotation as for the coordinates system) of a quaternion

Input argument(s):

axis: the axis (normalised)

theta: the angle in radians

Output and side effect(s):

Update the quaternion.