hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
384 lines (169 loc) • 4.34 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [Matrix2](./server.matrix2.md)
## Matrix2 class
Represents a 2x2 matrix.
**Signature:**
```typescript
export default class Matrix2 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 2x2 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, m10, m11)](./server.matrix2._constructor_.md)
</td><td>
</td><td>
Constructs a new instance of the `Matrix2` 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.matrix2.determinant.md)
</td><td>
`readonly`
</td><td>
number
</td><td>
The determinant of the matrix.
</td></tr>
<tr><td>
[frobeniusNorm](./server.matrix2.frobeniusnorm.md)
</td><td>
`readonly`
</td><td>
number
</td><td>
The frobenius normal 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(matrix2)](./server.matrix2.add.md)
</td><td>
</td><td>
Adds a matrix to the current matrix.
</td></tr>
<tr><td>
[adjoint()](./server.matrix2.adjoint.md)
</td><td>
</td><td>
Sets the adjugate of the current matrix.
</td></tr>
<tr><td>
[clone()](./server.matrix2.clone.md)
</td><td>
</td><td>
Clones the current matrix.
</td></tr>
<tr><td>
[copy(matrix2)](./server.matrix2.copy.md)
</td><td>
</td><td>
Copies a matrix to the current matrix.
</td></tr>
<tr><td>
[create()](./server.matrix2.create.md)
</td><td>
`static`
</td><td>
Creates a new `Matrix2` instance.
</td></tr>
<tr><td>
[equals(matrix2)](./server.matrix2.equals.md)
</td><td>
</td><td>
Checks if the current matrix is approximately equal to another matrix.
</td></tr>
<tr><td>
[exactEquals(matrix2)](./server.matrix2.exactequals.md)
</td><td>
</td><td>
Checks if the current matrix is exactly equal to another matrix.
</td></tr>
<tr><td>
[fromRotation(angle)](./server.matrix2.fromrotation.md)
</td><td>
`static`
</td><td>
Creates a new `Matrix2` instance from a rotation of identity matrix.
</td></tr>
<tr><td>
[fromScaling(scale)](./server.matrix2.fromscaling.md)
</td><td>
`static`
</td><td>
Creates a new `Matrix2` instance from a scale of identity matrix.
</td></tr>
<tr><td>
[identity()](./server.matrix2.identity.md)
</td><td>
</td><td>
Sets the current matrix to the identity matrix.
</td></tr>
<tr><td>
[invert()](./server.matrix2.invert.md)
</td><td>
</td><td>
Inverts the current matrix.
</td></tr>
<tr><td>
[multiply(matrix2)](./server.matrix2.multiply.md)
</td><td>
</td><td>
Multiplies the current matrix by another matrix.
</td></tr>
<tr><td>
[multiplyScalar(scalar)](./server.matrix2.multiplyscalar.md)
</td><td>
</td><td>
Multiplies each element of the current matrix by a scalar value.
</td></tr>
<tr><td>
[rotate(angle)](./server.matrix2.rotate.md)
</td><td>
</td><td>
Rotates the current matrix by an angle in radians.
</td></tr>
<tr><td>
[subtract(matrix2)](./server.matrix2.subtract.md)
</td><td>
</td><td>
Subtracts a matrix from the current matrix.
</td></tr>
<tr><td>
[toString()](./server.matrix2.tostring.md)
</td><td>
</td><td>
Returns a string representation of the current matrix.
</td></tr>
<tr><td>
[transpose()](./server.matrix2.transpose.md)
</td><td>
</td><td>
Transposes the current matrix.
</td></tr>
</tbody></table>