GLKit Math Utilities

Framework
GLKit/GLKMath.h
Declared in
GLKMathUtils.h

Overview

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

Functions by Task

Converting Angles

Projecting Vectors

Obtaining String Descriptions

Functions

GLKMathDegreesToRadians

Converts an angle measured in degrees to radians.

float GLKMathDegreesToRadians (
   float degrees
);
Parameters
degrees

An angle in degrees.

Return Value

The converted angle in radians.

Availability
  • Available in iOS 5.0 and later.
Related Sample Code
Declared In
GLKMathUtils.h

GLKMathProject

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

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 iOS 5.0 and later.
Declared In
GLKMathUtils.h

GLKMathRadiansToDegrees

Converts an angle measured in radians to degrees.

float GLKMathRadiansToDegrees (
   float radians
);
Parameters
radians

An angle in radians.

Return Value

The converted angle in degrees.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

GLKMathUnproject

Projects a point in view space into object space.

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 if the function completed successfully, otherwise it contains NO. Pass NULL if you do not want error information.

Return Value

The projected point in object space.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

NSStringFromGLKMatrix2

Returns a string that represents the contents of a matrix.

NSString * NSStringFromGLKMatrix2 (
   GLKMatrix2 matrix
);
Parameters
matrix

A 2x2 matrix.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

NSStringFromGLKMatrix3

Returns a string that represents the contents of a matrix.

NSString * NSStringFromGLKMatrix3 (
   GLKMatrix3 matrix
);
Parameters
matrix

A 3x3 matrix.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

NSStringFromGLKMatrix4

Returns a string that represents the contents of a matrix.

NSString * NSStringFromGLKMatrix4 (
   GLKMatrix4 matrix
);
Parameters
matrix

A 4x4 matrix.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

NSStringFromGLKQuaternion

Returns a string that represents the contents of a quaternion.

NSString * NSStringFromGLKQuaternion (
   GLKQuaternion quaternion
);
Parameters
quaternion

A quaternion.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

NSStringFromGLKVector2

Returns a string that represents the contents of a vector.

NSString * NSStringFromGLKVector2 (
   GLKVector2 vector
);
Parameters
vector

A 2-component vector.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

NSStringFromGLKVector3

Returns a string that represents the contents of a vector.

NSString * NSStringFromGLKVector3 (
   GLKVector3 vector
);
Parameters
vector

A 3-component vector.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h

NSStringFromGLKVector4

Returns a string that represents the contents of a vector.

NSString * NSStringFromGLKVector4 (
   GLKVector4 vector
);
Parameters
vector

A 4-component vector.

Availability
  • Available in iOS 5.0 and later.
Declared In
GLKMathUtils.h