GLKit Framework Reference GLKit Math Utilities

Options
Deployment Target:

Language:

# GLKit Math Utilities

This reference includes math routines without a specific type associated with them.

### Functions

• ``` GLKMathDegreesToRadians(_:) GLKMathDegreesToRadians ```

Converts an angle measured in degrees to radians.

#### Declaration

Swift

``` func GLKMathDegreesToRadians(_ degrees: Float) -> Float ```

Objective-C

``` float GLKMathDegreesToRadians ( float degrees ); ```

#### Parameters

 ``` degrees ``` An angle in degrees.

#### Return Value

The converted angle in radians.

#### Availability

Available in OS X v10.8 and later.

• ``` GLKMathRadiansToDegrees(_:) GLKMathRadiansToDegrees ```

Converts an angle measured in radians to degrees.

#### Declaration

Swift

``` func GLKMathRadiansToDegrees(_ radians: Float) -> Float ```

Objective-C

``` float GLKMathRadiansToDegrees ( float radians ); ```

#### Parameters

 ``` radians ``` An angle in radians.

#### Return Value

The converted angle in degrees.

#### Availability

Available in OS X v10.8 and later.

• ``` GLKMathProject(_:_:_:_:) GLKMathProject ```

Projects a point in object space into the window coordinate system.

#### Declaration

Swift

``` func GLKMathProject(_ object: GLKVector3, _ model: GLKMatrix4, _ projection: GLKMatrix4, _ viewport: UnsafeMutablePointer<Int32>) -> GLKVector3 ```

Objective-C

``` GLKVector3 GLKMathProject ( GLKVector3 object, GLKMatrix4 model, GLKMatrix4 projection, int *viewport ); ```

#### Parameters

 ``` object ``` The point in object space. ``` model ``` A modelview transformation matrix. ``` projection ``` A projection matrix. ``` viewport ``` A pointer to an array of four integer values. The first pair of values represent the window coordinates of the viewport’s bottom left corner. The second pair of values represent the width and height of the view port.

#### Return Value

The projected point in window coordinates.

#### Availability

Available in OS X v10.8 and later.

• ``` GLKMathUnproject(_:_:_:_:_:) GLKMathUnproject ```

Projects a point in view space into object space.

#### Declaration

Swift

``` func GLKMathUnproject(_ window: GLKVector3, _ model: GLKMatrix4, _ projection: GLKMatrix4, _ viewport: UnsafeMutablePointer<Int32>, _ success: UnsafeMutablePointer<Bool>) -> GLKVector3 ```

Objective-C

``` GLKVector3 GLKMathUnproject ( GLKVector3 window, GLKMatrix4 model, GLKMatrix4 projection, int *viewport, bool *success ); ```

#### Parameters

 ``` window ``` The point in window coordinates. ``` model ``` A modelview transformation matrix. ``` projection ``` A projection matrix. ``` viewport ``` A pointer to an array of four integer values. The first pair of values represent the window coordinates of the viewport’s bottom left corner. The second pair of values represent the width and height of the view port. ``` success ``` Upon return, contains `YES``true` if the function completed successfully, otherwise it contains `NO``false`. Pass `NULL` if you do not want error information.

#### Return Value

The projected point in object space.

#### Availability

Available in OS X v10.8 and later.

• ``` NSStringFromGLKMatrix2(_:) NSStringFromGLKMatrix2 ```

Returns a string that represents the contents of a matrix.

#### Declaration

Swift

``` func NSStringFromGLKMatrix2(_ matrix: GLKMatrix2) -> String ```

Objective-C

``` NSString * NSStringFromGLKMatrix2 ( GLKMatrix2 matrix ); ```

#### Parameters

 ``` matrix ``` A `2x2` matrix.

#### Availability

Available in OS X v10.8 and later.

• ``` NSStringFromGLKMatrix3(_:) NSStringFromGLKMatrix3 ```

Returns a string that represents the contents of a matrix.

#### Declaration

Swift

``` func NSStringFromGLKMatrix3(_ matrix: GLKMatrix3) -> String ```

Objective-C

``` NSString * NSStringFromGLKMatrix3 ( GLKMatrix3 matrix ); ```

#### Parameters

 ``` matrix ``` A `3x3` matrix.

#### Availability

Available in OS X v10.8 and later.

• ``` NSStringFromGLKMatrix4(_:) NSStringFromGLKMatrix4 ```

Returns a string that represents the contents of a matrix.

#### Declaration

Swift

``` func NSStringFromGLKMatrix4(_ matrix: GLKMatrix4) -> String ```

Objective-C

``` NSString * NSStringFromGLKMatrix4 ( GLKMatrix4 matrix ); ```

#### Parameters

 ``` matrix ``` A `4x4` matrix.

#### Availability

Available in OS X v10.8 and later.

• ``` NSStringFromGLKVector2(_:) NSStringFromGLKVector2 ```

Returns a string that represents the contents of a vector.

#### Declaration

Swift

``` func NSStringFromGLKVector2(_ vector: GLKVector2) -> String ```

Objective-C

``` NSString * NSStringFromGLKVector2 ( GLKVector2 vector ); ```

#### Parameters

 ``` vector ``` A 2-component vector.

#### Availability

Available in OS X v10.8 and later.

• ``` NSStringFromGLKVector3(_:) NSStringFromGLKVector3 ```

Returns a string that represents the contents of a vector.

#### Declaration

Swift

``` func NSStringFromGLKVector3(_ vector: GLKVector3) -> String ```

Objective-C

``` NSString * NSStringFromGLKVector3 ( GLKVector3 vector ); ```

#### Parameters

 ``` vector ``` A 3-component vector.

#### Availability

Available in OS X v10.8 and later.

• ``` NSStringFromGLKVector4(_:) NSStringFromGLKVector4 ```

Returns a string that represents the contents of a vector.

#### Declaration

Swift

``` func NSStringFromGLKVector4(_ vector: GLKVector4) -> String ```

Objective-C

``` NSString * NSStringFromGLKVector4 ( GLKVector4 vector ); ```

#### Parameters

 ``` vector ``` A 4-component vector.

#### Availability

Available in OS X v10.8 and later.

• ``` NSStringFromGLKQuaternion(_:) NSStringFromGLKQuaternion ```

Returns a string that represents the contents of a quaternion.

#### Declaration

Swift

``` func NSStringFromGLKQuaternion(_ quaternion: GLKQuaternion) -> String ```

Objective-C

``` NSString * NSStringFromGLKQuaternion ( GLKQuaternion quaternion ); ```

#### Parameters

 ``` quaternion ``` A quaternion.

#### Availability

Available in OS X v10.8 and later.