GLKQuaternion

Overview

The GLKQuaternion type defines a structure that represents a quaternion. A quaternion is defined by a scalar component s and an XYZ vector v. Quaternions are often used in graphics programming as a compact representation of a rotation of an object in three dimensions.

The functions that manipulate GLKQuaternion structures treat the inputs as immutable, instead returning a new quaternion that represent the results of the operation.

Symbols

Creating Quaternions

func GLKQuaternionMake(Float, Float, Float, Float)

Returns a quaternion created from its separate components.

func GLKQuaternionMakeWithArray(UnsafeMutablePointer<Float>!)

Returns a quaternion created from an array of components.

func GLKQuaternionMakeWithVector3(GLKVector3, Float)

Returns a quaternion created from a vector and a scalar.

func GLKQuaternionMakeWithAngleAndAxis(Float, Float, Float, Float)

Creates a quaternion that represents a rotation around an axis.

func GLKQuaternionMakeWithAngleAndVector3Axis(Float, GLKVector3)

Creates a quaternion that represents a rotation around an axis.

func GLKQuaternionMakeWithMatrix3(GLKMatrix3)

Creates a quaternion from a rotation matrix.

func GLKQuaternionMakeWithMatrix4(GLKMatrix4)

Creates a quaternion from a rotation matrix.

Retrieving Information About a Quaternion

func GLKQuaternionLength(GLKQuaternion)

Returns the length of a quaternion.

func GLKQuaternionAxis(GLKQuaternion)

Returns the axis of rotation of a quaternion.

func GLKQuaternionAngle(GLKQuaternion)

Returns the rotation angle of a quaternion.

Performing Mathematical Operations on Quaternions

func GLKQuaternionNormalize(GLKQuaternion)

Returns a normalized version of a quaternion.

func GLKQuaternionInvert(GLKQuaternion)

Returns an inverse of a quaternion.

func GLKQuaternionConjugate(GLKQuaternion)

Returns the conjugate of a quaternion.

func GLKQuaternionAdd(GLKQuaternion, GLKQuaternion)

Returns the sum of two quaternions.

func GLKQuaternionSubtract(GLKQuaternion, GLKQuaternion)

Returns the difference between two quaternions.

func GLKQuaternionMultiply(GLKQuaternion, GLKQuaternion)

Returns the product of two quaternions.

func GLKQuaternionSlerp(GLKQuaternion, GLKQuaternion, Float)

Returns the spherical linear interpolation of two quaternions.

Applying Quaternions to Vectors

func GLKQuaternionRotateVector3(GLKQuaternion, GLKVector3)

Returns a new vector that is calculated by applying a quaternion rotation to a vector.

func GLKQuaternionRotateVector4(GLKQuaternion, GLKVector4)

Returns a new vector calculated by applying a quaternion rotation to a vector.

Data Types

GLKQuaternion

A representation of a quaternion.

Constants

GLKQuaternionIdentity

An identity quaternion.