Matrix4
4 x 4 matrix in row-major order.
Constructors
Constructs a 4 x 4 identity matrix.
Constructs a 4 x 4 matrix with specified components.
Constructs a 4 x 4 matrix with the components of a specified matrix.
Functions
Computes the bounding rectangle for a unit square after applying a transformation matrix to the square's four corners.
Returns this symmetric matrix's eigenvectors. The eigenvectors are returned in the specified result arguments in order of descending magnitude (most prominent to least prominent). Each eigenvector has length equal to its corresponding eigenvalue.
This method returns false if this matrix is not a symmetric matrix.
Returns this viewing matrix's eye point. In model coordinates, a viewing matrix's eye point is the point the viewer is looking from and maps to the center of the screen.
The result of this method is undefined if this matrix is not a viewing matrix.
Returns this viewing matrix's forward vector.
The result of this method is undefined if this matrix is not a viewing matrix.
Returns this viewing matrix's heading angle. The roll argument enables the caller to disambiguate heading and roll when the two rotation axes for heading and roll are parallel, causing gimbal lock.
The result of this method is undefined if this matrix is not a viewing matrix.
Extracts the scale components from this matrix and stores them in the specified result vector.
Returns this viewing matrix's tilt angle.
The result of this method is undefined if this matrix is not a viewing matrix.
Inverts the specified matrix and stores the result in this matrix.
This throws an exception if the specified matrix is singular.
The result of this method is undefined if this matrix is passed in as the matrix to invert.
Inverts this orthonormal transform matrix in place. This matrix's upper 3x3 is transposed, then its fourth column is transformed by the transposed upper 3x3 and negated.
The result of this method is undefined if this matrix's values are not consistent with those of an orthonormal transform.
Inverts the specified orthonormal transform matrix and stores the result in 'this' matrix. The specified matrix's upper 3x3 is transposed, then its fourth column is transformed by the transposed upper 3x3 and negated. The result is stored in 'this' matrix.
The result of this method is undefined if this matrix is passed in as the matrix to invert, or if the matrix's values are not consistent with those of an orthonormal transform.
Multiplies this matrix by a specified matrix.
Multiplies this matrix by a matrix specified by individual components.
Multiplies this matrix by a scale matrix with specified values.
Multiplies this matrix by a translation matrix with specified translation values.
Applies a specified depth offset to this projection matrix. The depth offset may be any real number and is typically used to draw geometry slightly closer to the user's eye in order to give those shapes visual priority over nearby or geometry. An offset of zero has no effect. An offset less than zero brings depth values closer to the eye, while an offset greater than zero pushes depth values away from the eye.
The result of this method is undefined if this matrix is not a projection matrix. Projection matrices can be created by calling setToPerspectiveProjection or setToScreenProjection
Depth offset may be applied to both perspective and screen projection matrices. The effect on each type is outlined here:
Perspective Projection
The effect of depth offset on a perspective projection increases exponentially with distance from the eye. This has the effect of adjusting the offset for the loss in depth precision with geometry drawn further from the eye. Distant geometry requires a greater offset to differentiate itself from nearby geometry, while close geometry does not.
Screen Projection
The effect of depth offset on an screen projection increases linearly with distance from the eye. While it is reasonable to apply a depth offset to an screen projection, the effect is most appropriate when applied to the projection used to draw the scene. For example, when an object's coordinates are projected by a perspective projection into screen coordinates then drawn using a screen projection, it is best to apply the offset to the original perspective projection. The method RenderContext.project performs the correct behavior for the projection type used to draw the scene.
Projects a Cartesian point to screen coordinates. This method assumes this matrix represents an inverse modelview-projection matrix. The result of this method is undefined if this matrix is not an inverse modelview-projection matrix.
The resultant screen point is in OpenGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This stores the projected point in the result argument, and returns a boolean value indicating whether or not the projection is successful. This returns false if the Cartesian point is clipped by the near clipping plane or the far clipping plane.
Sets the rotation components of this matrix to a specified axis and angle. Positive angles are interpreted as counter-clockwise rotation about the axis when viewed when viewed from the positive end of the axis, looking toward the negative end of the axis.
The result of this method is undefined if the axis components are not a unit vector.
Sets this matrix to the symmetric covariance Matrix computed from an array of points.
The computed covariance matrix represents the correlation between each pair of x-, y-, and z-coordinates as they're distributed about the point array's arithmetic mean. Its layout is as follows:
C(x, x) C(x, y) C(x, z) <br> C(x, y) C(y, y) C(y, z) <br> C(x, z) C(y, z) C(z, z)
C(i, j) is the covariance of coordinates i and j, where i or j are a coordinate's dispersion about its mean value. If any entry is zero, then there's no correlation between the two coordinates defining that entry. If the returned matrix is diagonal, then all three coordinates are uncorrelated, and the specified point is distributed evenly about its mean point.
Sets this matrix to the 4 x 4 identity matrix.
Sets this matrix to an infinite perspective projection matrix for the specified viewport dimensions, vertical field of view and near clip distance.
An infinite perspective projection matrix maps points in a manner similar to a standard projection matrix, but is not bounded by depth. Objects at any depth greater than or equal to the near distance may be rendered. In addition, this matrix interprets vertices with a w-coordinate of 0 as infinitely far from the camera in the direction indicated by the point's coordinates.
The field of view must be positive and less than 180. The near distance must be positive.
Sets this matrix to the matrix product of two specified matrices.
Sets this matrix to a perspective projection matrix for the specified viewport dimensions, vertical field of view and clip distances.
A perspective projection matrix maps points in eye coordinates into clip coordinates in a way that causes distant objects to appear smaller, and preserves the appropriate depth information for each point. In model coordinates, a perspective projection is defined by frustum originating at the eye position and extending outward in the viewer's direction. The near distance and the far distance identify the minimum and maximum distance, respectively, at which an object in the scene is visible.
The field of view must be positive and less than 180. Near and far distances must be positive and must not be equal to one another.
Sets this matrix to a rotation matrix with a specified axis and angle. Positive angles are interpreted as counter-clockwise rotation about the axis when viewed when viewed from the positive end of the axis, looking toward the negative end of the axis.
The result of this method is undefined if the axis components are not a unit vector.
Sets this matrix to a scale matrix with specified scale components.
Sets this matrix to a screen projection matrix for the specified viewport dimensions.
A screen projection matrix is an orthographic projection that interprets points in model coordinates as representing a screen XY and a Z depth. Screen projection matrices therefore map coordinates directly into screen coordinates without modification. A point's XY coordinates are interpreted as literal screen coordinates and must be in the viewport to be visible. A point's Z coordinate is interpreted as a depth value that ranges from 0 to 1. Additionally, the screen projection matrix preserves the depth value returned by RenderContext.project.
Sets this matrix to a translation matrix with specified translation components.
Sets the translation components of this matrix to specified values.
Sets this matrix to the transpose of a specified matrix.
Transposes this matrix, storing the result in the specified single precision array. The result is compatible with GLSL uniform matrices, and can be passed to the function glUniformMatrix4fv.
Un-projects a screen coordinate point to Cartesian coordinates at the near clip plane and the far clip plane. This method assumes this matrix represents an inverse modelview-projection matrix. The result of this method is undefined if this matrix is not an inverse modelview-projection matrix.
The screen point is understood to be in OpenGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This function stores the un-projected points in the result argument, and a boolean value indicating whether the un-projection is successful.
Un-projects a screen coordinate point at a given normalized depth to Cartesian coordinates. This method assumes this matrix represents an inverse modelview-projection matrix; the result is undefined otherwise.
The screen point is in OpenGL screen coordinates (origin at the bottom-left). The depth value is the normalized depth-buffer value in [0, 1] as read from the depth buffer at the screen point.