Constructor
new Matrix3(m11, m12, m13, m21, m22, m23, m31, m32, m33)
Constructs a 3 x 3 matrix.
Parameters:
Name | Type | Description |
---|---|---|
m11 |
Number | matrix element at row 1, column 1. |
m12 |
Number | matrix element at row 1, column 2. |
m13 |
Number | matrix element at row 1, column 3. |
m21 |
Number | matrix element at row 2, column 1. |
m22 |
Number | matrix element at row 2, column 2. |
m23 |
Number | matrix element at row 2, column 3. |
m31 |
Number | matrix element at row 3, column 1. |
m32 |
Number | matrix element at row 3, column 2. |
m33 |
Number | matrix element at row 3, column 3. |
- Source:
Methods
columnMajorComponents(result) → {Float32Array}
Stores this matrix's components in column-major order in a specified array.
The array must have space for at least 9 elements. This matrix's components are stored in the array starting with row 0 column 0 in index 0, row 1 column 0 in index 1, row 2 column 0 in index 2, and so on.
Parameters:
Name | Type | Description |
---|---|---|
result |
Float32Array | Float64Array | Array.<Number> | An array of at least 9 elements. Upon return, contains this matrix's components in column-major. |
- Source:
Throws:
-
If the specified result array in null or undefined.
- Type
- ArgumentError
Returns:
The specified result array.
- Type
- Float32Array
multiplyByTileTransform(src, dst) → {Matrix3}
Multiplies this matrix by a matrix that transforms normalized coordinates from a source sector to a destination
sector. Normalized coordinates within a sector range from 0 to 1, with (0, 0) indicating the lower left corner
and (1, 1) indicating the upper right. The resultant matrix maps a normalized source coordinate (X, Y) to its
corresponding normalized destination coordinate (X', Y').
This matrix typically necessary to transform texture coordinates from one geographic region to another. For
example, the texture coordinates for a terrain tile spanning one region must be transformed to coordinates
appropriate for an image tile spanning a potentially different region.
Parameters:
Name | Type | Description |
---|---|---|
src |
Sector | the source sector |
dst |
Sector | the destination sector |
- Source:
Returns:
this matrix multiplied by the transform matrix implied by values described above
- Type
- Matrix3
multiplyMatrix(matrix) → {Matrix3}
Multiplies this matrix by a specified matrix.
Parameters:
Name | Type | Description |
---|---|---|
matrix |
Matrix3 | The matrix to multiply with this matrix. |
- Source:
Throws:
-
if the specified matrix is null or undefined.
- Type
- ArgumentError
Returns:
This matrix after multiplying it by the specified matrix.
- Type
- Matrix3
setToUnitYFlip() → {Matrix3}
Sets this matrix to one that flips and shifts the y-axis.
The resultant matrix maps Y=0 to Y=1 and Y=1 to Y=0. All existing values are overwritten. This matrix is usually used to change the coordinate origin from an upper left coordinate origin to a lower left coordinate origin. This is typically necessary to align the coordinate system of images (top-left origin) with that of OpenGL (bottom-left origin).
- Source:
Returns:
This matrix set to values described above.
- Type
- Matrix3
(static) fromIdentity() → {Matrix3}
Creates an identity matrix.
- Source:
Returns:
A new identity matrix.
- Type
- Matrix3