Raised when an error occurs (usually a division by zero)
Module OgamlMath.Matrix3D
Provides easy creation and manipulation of rendering matricesOptimized operations on 3D (4x4) float matrices
Simple Matrices
Type of 4x4 matrices stored in a flat, column-major array
Zero matrix
Identity matrix
Builds a translation matrix from a vector
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Builds a scaling matrix from a vector
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Builds a rotation matrix from an axis and an angle
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Builds a rotation matrix from a quaternion
See : OgamlMath.Quaternion
See : OgamlMath.Quaternion
Matrix Operations
Computes the product of two matrices
Transposes a matrix. The original is not modified.
Translates a matrix by a vector. The original matrix is not modified.
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Scales a matrix by a vector. The original matrix is not modified.
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Rotates a matrix by an angle around a given axis. The original matrix is not modified.
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Computes the (right-)product of a matrix with a column vector
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Returns a pretty-printed string (not for serialization)
Rendering Matrices Creation
Builds the inverse of a "look-at" view matrix. Raises Matrix3D_exception if
See : OgamlMath.Vector3f
up = zero
.See : OgamlMath.Vector3f
Builds a "look-at" view matrix from eulerian angles. Theta should be in [0;2pi] and phi in [-pi/2;pi/2]. If phi = pi/2, the camera is looking up (towards positive Y). If theta = 0, the camera is looking towards negative Z.
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Builds the inverse of a "look-at" view matrix from eulerian angles. Theta should be in [0;2pi] and phi in [-pi/2;pi/2].
See : OgamlMath.Vector3f
See : OgamlMath.Vector3f
Builds an orthographic projection matrix englobing a volume defined by six planes. Raises Matrix3D_exception if
right = left
or near = far
or top = bottom
Builds the inverse of an orthographic projection matrix
Builds a perspective projection matrix. Near and far are the positions of the clipping planes relatively to the camera position (nothing will be rendered outside those planes). Width and height should usually be the dimensions of the screen in pixels. Fov corresponds to the view angle, and is given in radians.
Raises Matrix3D_exception if
Raises Matrix3D_exception if
near = far
.
Builds the inverse of a perspective projection matrix
Other functions
Returns a matrix as a flat bigarray. Used internally by OGAML, it should not be necessary for your programs.