GLKMatrix4

Overview

The GLKMatrix4 type defines a 4x4 floating-point matrix as well as many mathematical operations commonly used to manipulate matrices. 3D graphics programming uses matrices extensively as a convenient way to represent a graphical transformation between different coordinate systems. These transformations include translation, scaling, rotation and projection; through matrix multiplication, multiple transformations can be concatenated into a single transformation matrix.

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

Symbols

Creating Matrices

func GLKMatrix4MakeWithArray(UnsafeMutablePointer<Float>!)

Returns a 4x4 matrix created from an array of component values.

func GLKMatrix4MakeWithArrayAndTranspose(UnsafeMutablePointer<Float>!)

Returns a 4x4 transposed matrix created from an array of component values.

func GLKMatrix4MakeWithColumns(GLKVector4, GLKVector4, GLKVector4, GLKVector4)

Returns a 4x4 matrix created from four column vectors.

func GLKMatrix4MakeWithRows(GLKVector4, GLKVector4, GLKVector4, GLKVector4)

Returns a 4x4 matrix created from four row vectors.

func GLKMatrix4MakeRotation(Float, Float, Float, Float)

Returns a 4x4 matrix that performs a rotation around an arbitrary vector.

func GLKMatrix4MakeXRotation(Float)

Returns a 4x4 matrix that performs a rotation around the positive x-axis.

func GLKMatrix4MakeYRotation(Float)

Returns a 4x4 matrix that performs a rotation around the positive y-axis.

func GLKMatrix4MakeZRotation(Float)

Returns a 4x4 matrix that performs a rotation around the positive z-axis.

func GLKMatrix4MakeWithQuaternion(GLKQuaternion)

Returns a 4x4 matrix that performs a rotation based on a quaternion.

func GLKMatrix4MakeScale(Float, Float, Float)

Returns a 4x4 matrix that performs a scaling transformation.

func GLKMatrix4MakeTranslation(Float, Float, Float)

Returns a 4x4 matrix that performs a translation.

func GLKMatrix4MakeLookAt(Float, Float, Float, Float, Float, Float, Float, Float, Float)

Returns a 4x4 matrix that transforms world coordinates to eye coordinates.

func GLKMatrix4MakeOrtho(Float, Float, Float, Float, Float, Float)

Returns a 4x4 orthographic projection matrix.

func GLKMatrix4MakePerspective(Float, Float, Float, Float)

Returns a 4x4 perspective projection matrix.

Working With Parts of a Matrix

func GLKMatrix4GetMatrix2(GLKMatrix4)

Returns the upper-left 2x2 section of a 4x4 matrix.

func GLKMatrix4GetMatrix3(GLKMatrix4)

Returns the upper-left 3x3 section of a 4x4 matrix.

func GLKMatrix4GetColumn(GLKMatrix4, Int32)

Retrieves a column from a 4x4 matrix.

func GLKMatrix4GetRow(GLKMatrix4, Int32)

Retrieves a row from a 4x4 matrix.

func GLKMatrix4SetColumn(GLKMatrix4, Int32, GLKVector4)

Returns a new 4x4 matrix with one column replaced by a new vector.

func GLKMatrix4SetRow(GLKMatrix4, Int32, GLKVector4)

Returns a new 4x4 matrix with one row replaced by a new vector.

Performing Mathematical Operations on Matrices

func GLKMatrix4Transpose(GLKMatrix4)

Returns the transpose of a matrix.

func GLKMatrix4Multiply(GLKMatrix4, GLKMatrix4)

Returns the product of two matrices.

func GLKMatrix4Rotate(GLKMatrix4, Float, Float, Float, Float)

Returns a new 4x4 matrix created by concatenating a matrix with a rotation around a vector.

func GLKMatrix4RotateWithVector3(GLKMatrix4, Float, GLKVector3)

Returns a new 4x4 matrix created by concatenating a matrix with a rotation around a vector.

func GLKMatrix4RotateWithVector4(GLKMatrix4, Float, GLKVector4)

Returns a new 4x4 matrix created by concatenating a matrix with a rotation around a vector.

func GLKMatrix4RotateX(GLKMatrix4, Float)

Returns a new 4x4 matrix created by concatenating a matrix with a rotation around the x-axis.

func GLKMatrix4RotateY(GLKMatrix4, Float)

Returns a new 4x4 matrix created by concatenating a matrix with a rotation around the y-axis.

func GLKMatrix4RotateZ(GLKMatrix4, Float)

Returns a new 4x4 matrix created by concatenating a matrix with a rotation around the z-axis.

func GLKMatrix4Scale(GLKMatrix4, Float, Float, Float)

Returns a new 4x4 matrix created by concatenating a matrix with a scaling transform.

func GLKMatrix4ScaleWithVector3(GLKMatrix4, GLKVector3)

Returns a new 4x4 matrix created by concatenating a matrix with a scaling transform defined by a vector.

func GLKMatrix4ScaleWithVector4(GLKMatrix4, GLKVector4)

Returns a new 4x4 matrix created by concatenating a matrix with a scaling transform defined by a vector.

func GLKMatrix4Translate(GLKMatrix4, Float, Float, Float)

Returns a new 4x4 matrix created by concatenating a matrix with a translation transform.

func GLKMatrix4TranslateWithVector3(GLKMatrix4, GLKVector3)

Returns a new 4x4 matrix created by concatenating a matrix with a translation transform defined by a vector.

func GLKMatrix4TranslateWithVector4(GLKMatrix4, GLKVector4)

Returns a new 4x4 matrix created by concatenating a matrix with a translation transform defined by a vector.

func GLKMatrix4Add(GLKMatrix4, GLKMatrix4)

Returns a new 4x4 matrix created by performing a component-wise addition of two matrices.

func GLKMatrix4Subtract(GLKMatrix4, GLKMatrix4)

Returns a new 4x4 matrix created by performing a component-wise subtraction of two matrices.

Performing Mathematical Operations on Vectors

func GLKMatrix4MultiplyVector3(GLKMatrix4, GLKVector3)

Multiplies a 4x4 matrix by a 3-component vector.

func GLKMatrix4MultiplyVector3Array(GLKMatrix4, UnsafeMutablePointer<GLKVector3>, Int)

Multiplies a 4x4 matrix by an array of 3-component vectors.

func GLKMatrix4MultiplyVector3WithTranslation(GLKMatrix4, GLKVector3)

Multiplies a 4x4 matrix by a 3-component vector, applying translation.

func GLKMatrix4MultiplyVector3ArrayWithTranslation(GLKMatrix4, UnsafeMutablePointer<GLKVector3>, Int)

Multiplies a 4x4 matrix by an array of 3-component vectors, applying translation.

func GLKMatrix4MultiplyVector4(GLKMatrix4, GLKVector4)

Multiplies a 4x4 matrix by a 4-component vector.

func GLKMatrix4MultiplyVector4Array(GLKMatrix4, UnsafeMutablePointer<GLKVector4>, Int)

Multiplies a 4x4 matrix by an array of 4-component vectors.

func GLKMatrix4MultiplyAndProjectVector3(GLKMatrix4, GLKVector3)

Multiplies a 4x4 matrix by a position vector to create a vector in homogenous coordinates, then projects the result to a 3-component vector.

func GLKMatrix4MultiplyAndProjectVector3Array(GLKMatrix4, UnsafeMutablePointer<GLKVector3>, Int)

Multiplies a 4x4 matrix by an array of 3-component vectors. Each result is projected back to 3-component vector.

Data Types

GLKMatrix4

A 4x4 matrix.

Constants

GLKMatrix4Identity

A 4x4 identity matrix.