Matrix2d
class Matrix2d
a Matrix2d Object.
the identity matrix and parameters position :
Constructor
new Matrix2d(args: Matrix2d | Matrix3d | number) → {}
Name | Type | Description |
---|---|---|
args | Matrix2d | Matrix3d | number |
an instance of me.Matrix2d or me.Matrix3d to copy from, or individual matrix components (See Matrix2d.setTransform). If not arguments are given, the matrix will be set to Identity. |
Summary
Methods from Matrix2d
Public Properties
Public Methods
apply(v: Vector2d | Vector3d) → {Vector2d | Vector3d}
apply the current transform to the given 2d or 3d vector
applyInverse(v: Vector2d) → {Vector2d}
apply the inverted current transform to the given 2d vector
Name | Type | Description |
---|---|---|
v | Vector2d |
the vector object to be transformed |
Type | Description |
---|---|
Vector2d |
result vector object. |
copy(m: Matrix2d) → {Matrix2d}
Copies over the values from another me.Matrix2d.
Name | Type | Description |
---|---|---|
m | Matrix2d |
the matrix object to copy from |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
equals(m: Matrix2d) → {boolean}
return true if the two matrices are identical
Name | Type | Description |
---|---|---|
m | Matrix2d |
the other matrix |
Type | Description |
---|---|
boolean |
true if both are equals |
fromMat3d(m: Matrix3d) → {Matrix2d}
Copies over the upper-left 3x3 values from the given me.Matrix3d
Name | Type | Description |
---|---|---|
m | Matrix3d |
the matrix object to copy from |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
identity() → {Matrix2d}
reset the transformation matrix to the identity matrix (no transformation).
the identity matrix and parameters position :
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
invert() → {Matrix2d}
invert this matrix, causing it to apply the opposite transformation.
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
isIdentity() → {boolean}
returns true if the matrix is an identity matrix.
Type | Description |
---|---|
boolean |
multiply(m: Matrix2d) → {Matrix2d}
multiply both matrix
Name | Type | Description |
---|---|---|
m | Matrix2d |
the other matrix |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
rotate(angle: number) → {Matrix2d}
rotate the matrix (counter-clockwise) by the specified angle (in radians).
Name | Type | Description |
---|---|---|
angle | number |
Rotation angle in radians. |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
scale(x: number, y: number) → {Matrix2d}
scale the matrix
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x | number |
a number representing the abscissa of the scaling vector. |
||
y | number |
<optional> |
x |
a number representing the ordinate of the scaling vector. |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
scaleV(v: Vector2d) → {Matrix2d}
adds a 2D scaling transformation.
Name | Type | Description |
---|---|---|
v | Vector2d |
scaling vector |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
scaleX(x: number) → {Matrix2d}
specifies a 2D scale operation using the [sx, 1] scaling vector
Name | Type | Description |
---|---|---|
x | number |
x scaling vector |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
scaleY(y: number) → {Matrix2d}
specifies a 2D scale operation using the [1,sy] scaling vector
Name | Type | Description |
---|---|---|
y | number |
y scaling vector |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
setTransform(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) → {Matrix2d}
set the matrix to the specified value
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
a | number | |||
b | number | |||
c | number | |||
d | number | |||
e | number | |||
f | number | |||
g | number |
<optional> |
0 | |
h | number |
<optional> |
0 | |
i | number |
<optional> |
1 |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
toArray() → {Float32Array}
return an array representation of this Matrix
Type | Description |
---|---|
Float32Array |
toString() → {string}
convert the object to a string representation
Type | Description |
---|---|
string |
transform(a: number, b: number, c: number, d: number, e: number, f: number) → {Matrix2d}
Multiplies the current transformation with the matrix described by the arguments of this method
Name | Type | Description |
---|---|---|
a | number | |
b | number | |
c | number | |
d | number | |
e | number | |
f | number |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
translate(x: number | Vector2d, y: number) → {Matrix2d}
translate the matrix position on the horizontal and vertical axis
Name | Type | Attributes | Description |
---|---|---|---|
x | number | Vector2d |
the x coordindates or a vector to translate the matrix by |
|
y | number |
<optional> |
the y coordindates to translate the matrix by |
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |
transpose() → {Matrix2d}
Transpose the value of this matrix.
Type | Description |
---|---|
Matrix2d |
Reference to this object for method chaining |