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.

Topics

Creating Quaternions

func GLKQuaternionMake(Float, Float, Float, Float) -> GLKQuaternion

Returns a quaternion created from its separate components.

func GLKQuaternionMakeWithArray(UnsafeMutablePointer<Float>!) -> GLKQuaternion

Returns a quaternion created from an array of components.

func GLKQuaternionMakeWithVector3(GLKVector3, Float) -> GLKQuaternion

Returns a quaternion created from a vector and a scalar.

func GLKQuaternionMakeWithAngleAndAxis(Float, Float, Float, Float) -> GLKQuaternion

Creates a quaternion that represents a rotation around an axis.

func GLKQuaternionMakeWithAngleAndVector3Axis(Float, GLKVector3) -> GLKQuaternion

Creates a quaternion that represents a rotation around an axis.

func GLKQuaternionMakeWithMatrix3(GLKMatrix3) -> GLKQuaternion

Creates a quaternion from a rotation matrix.

func GLKQuaternionMakeWithMatrix4(GLKMatrix4) -> GLKQuaternion

Creates a quaternion from a rotation matrix.

Retrieving Information About a Quaternion

func GLKQuaternionLength(GLKQuaternion) -> Float

Returns the length of a quaternion.

func GLKQuaternionAxis(GLKQuaternion) -> GLKVector3

Returns the axis of rotation of a quaternion.

func GLKQuaternionAngle(GLKQuaternion) -> Float

Returns the rotation angle of a quaternion.

Performing Mathematical Operations on Quaternions

Applying Quaternions to Vectors

func GLKQuaternionRotateVector3(GLKQuaternion, GLKVector3) -> GLKVector3

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

func GLKQuaternionRotateVector4(GLKQuaternion, GLKVector4) -> GLKVector4

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

Data Types

typealias GLKQuaternion

A representation of a quaternion.

Constants

See Also

Math Utilties

class GLKMatrixStack

An opaque type that represents a stack of 4 x 4 matrices, providing support for hierarchical transform modeling and similar tasks.