UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

652 lines (285 loc) 8.12 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [Matrix4](./server.matrix4.md) ## Matrix4 class Represents a 4x4 matrix. **Signature:** ```typescript export default class Matrix4 extends Float32Array ``` **Extends:** Float32Array ## Remarks All matrix methods result in mutation of the matrix instance. This class extends `Float32Array` to provide an efficient way to create and manipulate a 4x4 matrix. Various convenience methods are provided for common matrix operations. ## Constructors <table><thead><tr><th> Constructor </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [(constructor)(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33)](./server.matrix4._constructor_.md) </td><td> </td><td> Constructs a new instance of the `Matrix4` class </td></tr> </tbody></table> ## Properties <table><thead><tr><th> Property </th><th> Modifiers </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> [determinant](./server.matrix4.determinant.md) </td><td> `readonly` </td><td> number </td><td> The determinant of the matrix. </td></tr> <tr><td> [frobeniusNorm](./server.matrix4.frobeniusnorm.md) </td><td> `readonly` </td><td> number </td><td> The frobenius norm of the matrix. </td></tr> </tbody></table> ## Methods <table><thead><tr><th> Method </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [add(matrix4)](./server.matrix4.add.md) </td><td> </td><td> Adds a matrix to the current matrix. </td></tr> <tr><td> [adjoint()](./server.matrix4.adjoint.md) </td><td> </td><td> Sets the adjugate of the current matrix. </td></tr> <tr><td> [clone()](./server.matrix4.clone.md) </td><td> </td><td> Clones the current matrix. </td></tr> <tr><td> [copy(matrix4)](./server.matrix4.copy.md) </td><td> </td><td> Copies a matrix to the current matrix. </td></tr> <tr><td> [create()](./server.matrix4.create.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance. </td></tr> <tr><td> [equals(matrix4)](./server.matrix4.equals.md) </td><td> </td><td> Checks if the current matrix is approximately equal to another matrix. </td></tr> <tr><td> [exactEquals(matrix4)](./server.matrix4.exactequals.md) </td><td> </td><td> Checks if the current matrix is exactly equal to another matrix. </td></tr> <tr><td> [fromQuaternion(quaternion)](./server.matrix4.fromquaternion.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a `Quaternion` object. </td></tr> <tr><td> [fromRotation(angle, axis)](./server.matrix4.fromrotation.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from an angle and axis. </td></tr> <tr><td> [fromRotationTranslation(rotation, translation)](./server.matrix4.fromrotationtranslation.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a rotation and translation. </td></tr> <tr><td> [fromRotationTranslationScale(rotation, translation, scale)](./server.matrix4.fromrotationtranslationscale.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a rotation, translation, and scale. </td></tr> <tr><td> [fromRotationTranslationScaleOrigin(rotation, translation, scale, origin)](./server.matrix4.fromrotationtranslationscaleorigin.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a rotation, translation, scale, and origin. </td></tr> <tr><td> [fromScaling(scale)](./server.matrix4.fromscaling.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a scale of identity matrix. </td></tr> <tr><td> [fromTranslation(translation)](./server.matrix4.fromtranslation.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a translation of identity matrix. </td></tr> <tr><td> [fromXRotation(angle)](./server.matrix4.fromxrotation.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from an x-rotation of identity matrix. </td></tr> <tr><td> [fromYRotation(angle)](./server.matrix4.fromyrotation.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a y-rotation of identity matrix. </td></tr> <tr><td> [fromZRotation(angle)](./server.matrix4.fromzrotation.md) </td><td> `static` </td><td> Creates a new `Matrix4` instance from a z-rotation of identity matrix. </td></tr> <tr><td> [frustrum(left, right, bottom, top, near, far)](./server.matrix4.frustrum.md) </td><td> </td><td> Sets the current matrix to a frustrum matrix with the given bounds. </td></tr> <tr><td> [identity()](./server.matrix4.identity.md) </td><td> </td><td> Sets the current matrix to the identity matrix. </td></tr> <tr><td> [invert()](./server.matrix4.invert.md) </td><td> </td><td> Inverts the current matrix. </td></tr> <tr><td> [lookAt(eye, center, up)](./server.matrix4.lookat.md) </td><td> </td><td> Sets the current matrix to a look-at matrix with the given eye, center, and up vectors. </td></tr> <tr><td> [multiply(matrix4)](./server.matrix4.multiply.md) </td><td> </td><td> Multiplies the current matrix by another matrix. </td></tr> <tr><td> [multiplyScalar(scalar)](./server.matrix4.multiplyscalar.md) </td><td> </td><td> Multiplies each element of the current matrix by a scalar value. </td></tr> <tr><td> [orthographic(left, right, bottom, top, near, far)](./server.matrix4.orthographic.md) </td><td> </td><td> Sets the current matrix to an orthographic projection matrix with the given bounds. </td></tr> <tr><td> [perspective(fovy, aspect, near, far)](./server.matrix4.perspective.md) </td><td> </td><td> Sets the current matrix to a perspective matrix with the given field of view, aspect ratio, and near and far bounds. </td></tr> <tr><td> [rotate(angle, axis)](./server.matrix4.rotate.md) </td><td> </td><td> Rotates the current matrix by an angle in radians around an axis. </td></tr> <tr><td> [rotateX(angle)](./server.matrix4.rotatex.md) </td><td> </td><td> Rotates the current matrix by an angle in radians around the x-axis. </td></tr> <tr><td> [rotateY(angle)](./server.matrix4.rotatey.md) </td><td> </td><td> Rotates the current matrix by an angle in radians around the y-axis. </td></tr> <tr><td> [rotateZ(angle)](./server.matrix4.rotatez.md) </td><td> </td><td> Rotates the current matrix by an angle in radians around the z-axis. </td></tr> <tr><td> [scale(vector3)](./server.matrix4.scale.md) </td><td> </td><td> Scales the current matrix by a vector. </td></tr> <tr><td> [subtract(matrix4)](./server.matrix4.subtract.md) </td><td> </td><td> Subtracts a matrix from the current matrix. </td></tr> <tr><td> [targetTo(eye, center, up)](./server.matrix4.targetto.md) </td><td> </td><td> Sets the current matrix to a matrix that looks at a target. </td></tr> <tr><td> [toString()](./server.matrix4.tostring.md) </td><td> </td><td> Returns a string representation of the current matrix. </td></tr> <tr><td> [translate(vector3)](./server.matrix4.translate.md) </td><td> </td><td> Translates the current matrix by a vector. </td></tr> <tr><td> [transpose()](./server.matrix4.transpose.md) </td><td> </td><td> Transposes the current matrix. </td></tr> </tbody></table>