Creates a Matrix4
from an object representation.
Creates a 4x4 matrix from a set of row-major components.
Returns true if the matrix is an identity matrix.
A type guard to check if obj
is of type Matrix4
.
Returns a matrix that has the basis components (upper left 3x3 matrix) set to the following x, y, and z axis.
x.x y.x z.x 0
x.y y.y z.y 0
x.z y.z z.z 0
0 0 0 0
A matrix with its basis components populated.
Creates a matrix used for perspective projections.
The viewing volume is frustum-shaped and defined by the six parameters. Left, right, top, and bottom specify coordinates in the near clipping plane where the frustum edges intersect it, and the near and far parameters define the forward distances of the view volume. The resulting volume can be vertically and horizontally asymmetrical around the center of the near plane.
The left coordinate at the near plane.
The right coordinate at the near plane.
The top coordinate at the near plane.
The bottom coordinate at the near plane.
The near distance.
The far distance.
A matrix representing a view frustum.
Returns a new identity matrix.
Matrix becomes a combination of translation and rotation.
Matrix becomes a combination of a translation to the position of 'eye' and a rotation matrix which orients an object to point towards 'center' along its z-axis. Use this function if you want an object to look at a point from another point in space.
The position of the object.
The point which the object is looking at.
The direction which the object considers up.
A matrix.
Matrix becomes a combination of an inverse translation and rotation.
Related to: gluLookAt. This creates the inverse of makeLookAtMatrix. The matrix will be an opposite translation from the 'eye' position, and it will rotate things in the opposite direction of the eye-to-center orientation. This is definitely confusing, but the main reason to use this transform is to set up a view matrix for a camera that's looking at a certain point. To achieve the effect of moving the camera somewhere and rotating it so that it points at something, the rest of the world is moved in the opposite direction and rotated in the opposite way around the camera. This way, you get the same effect as moving the actual camera, but all the projection math can still be done with the camera positioned at the origin (which makes it way simpler).
The position of the object.
The point which the object is looking at.
The direction which the object considers up.
A matrix.
Creates an orthographic projection matrix.
Related to: gluOrtho. The viewing volume is cube-shaped and defined by the six parameters. The left and right values represent the coordinates of the vertical clipping planes, top and bottom values represent the coordinates of the horizontal clipping planes, and near and far values represent the coordinates of the depth clipping planes.
The coordinate of the left horizontal clipping plane.
The coordinate of the right horizontal clipping plane.
The coordinate of the bottom vertical clipping plane.
The coordinate of the top vertical clipping plane.
The coordinate of the near depth clipping plane.
The coordinate of the far depth clipping plane.
A matrix.
Creates a perspective projection matrix.
Related to: gluPerspective. The viewing volume is frustum-shaped amd defined by the four parameters. The fovy and aspect ratio are used to compute the positions of the left, right, top, and bottom sides of the viewing volume in the zNear plane. The fovy is the y field-of-view, the angle made by the top and bottom sides of frustum if they were to intersect. The aspect ratio is the width of the frustum divided by its height. Note that the resulting volume is both vertically and horizontally symmetrical around the center of the near plane.
The near Z value.
The far Z value.
The field of view.
The aspect ratio.
A matrix.
Creates a rotation matrix.
1-2y²-2z², 2xy-2zw, 2xz+2yw, 0,
2xy+2zw, 1-2x²-2z², 2yz-2xw, 0,
2xz-2yw, 2yz+2xw, 1-2x²-2y², 0,
0, 0, 0, 1,
A quaternion representing the rotation.
A rotation matrix.
Creates a matrix that has translation, rotation and scale applied to it.
The translation applied to the matrix.
The rotation applied to the matrix.
The scale applied to the matrix.
A transformed matrix.
Returns a matrix with all values as 0.
Returns an object representation of a Matrix4
.
A type alias representing a 4x4 column-major matrix.
The common use-case for 4x4 matrices in 3D computer graphics are for transformation matrices. This allows a point in 3D space to be projected onto a 2D screen using transformations such as translation, rotation and scale.