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.

Topics

Creating Matrices

GLKMatrix4Make

Returns a 4x4 matrix created from individual component values.

GLKMatrix4MakeAndTranspose

Returns a 4x4 transposed matrix created from individual component values.

GLKMatrix4MakeWithArray

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

GLKMatrix4MakeWithArrayAndTranspose

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

GLKMatrix4MakeWithColumns

Returns a 4x4 matrix created from four column vectors.

GLKMatrix4MakeWithRows

Returns a 4x4 matrix created from four row vectors.

GLKMatrix4MakeRotation

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

GLKMatrix4MakeXRotation

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

GLKMatrix4MakeYRotation

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

GLKMatrix4MakeZRotation

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

GLKMatrix4MakeWithQuaternion

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

GLKMatrix4MakeScale

Returns a 4x4 matrix that performs a scaling transformation.

GLKMatrix4MakeTranslation

Returns a 4x4 matrix that performs a translation.

GLKMatrix4MakeLookAt

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

GLKMatrix4MakeOrtho

Returns a 4x4 orthographic projection matrix.

GLKMatrix4MakePerspective

Returns a 4x4 perspective projection matrix.

GLKMatrix4MakeFrustum

Returns a 4x4 perspective projection matrix.

Working With Parts of a Matrix

GLKMatrix4GetMatrix2

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

GLKMatrix4GetMatrix3

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

GLKMatrix4GetColumn

Retrieves a column from a 4x4 matrix.

GLKMatrix4GetRow

Retrieves a row from a 4x4 matrix.

GLKMatrix4SetColumn

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

GLKMatrix4SetRow

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

Performing Mathematical Operations on Matrices

GLKMatrix4Invert

Returns the inverse of a matrix.

GLKMatrix4Transpose

Returns the transpose of a matrix.

GLKMatrix4InvertAndTranspose

Returns the inverse transpose of a matrix.

GLKMatrix4Multiply

Returns the product of two matrices.

GLKMatrix4Rotate

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

GLKMatrix4RotateWithVector3

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

GLKMatrix4RotateWithVector4

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

GLKMatrix4RotateX

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

GLKMatrix4RotateY

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

GLKMatrix4RotateZ

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

GLKMatrix4Scale

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

GLKMatrix4ScaleWithVector3

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

GLKMatrix4ScaleWithVector4

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

GLKMatrix4Translate

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

GLKMatrix4TranslateWithVector3

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

GLKMatrix4TranslateWithVector4

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

GLKMatrix4Add

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

GLKMatrix4Subtract

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

Performing Mathematical Operations on Vectors

GLKMatrix4MultiplyVector3

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

GLKMatrix4MultiplyVector3Array

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

GLKMatrix4MultiplyVector3WithTranslation

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

GLKMatrix4MultiplyVector3ArrayWithTranslation

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

GLKMatrix4MultiplyVector4

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

GLKMatrix4MultiplyVector4Array

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

GLKMatrix4MultiplyAndProjectVector3

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

GLKMatrix4MultiplyAndProjectVector3Array

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.

See Also

Math Utilties

GLKMatrixStackRef

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