Class twodee.Matrix
A matrix with 3x3 entries.
Defined in: Matrix.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Constructs a new matrix initialized as an identity matrix.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
twodee.Matrix.counter
Instance counter.
|
The matrix entry 0;0.
|
|
The matrix entry 0;1.
|
|
The matrix entry 0;2.
|
|
The matrix entry 1;0.
|
|
The matrix entry 1;1.
|
|
The matrix entry 1;2.
|
|
The matrix entry 0;0.
|
|
The matrix entry 0;1.
|
|
The matrix entry 0;2.
|
Method Attributes | Method Name and Description |
---|---|
copy(target)
Returns a copy of this matrix.
|
|
divide(f)
Divides this matrix by the specified factor.
|
|
Returns the determinant of the matrix.
|
|
Returns the rotation angle in anti-clockwise RAD.
|
|
Returns The translation vector of the current matrix.
|
|
Returns the X translation of the matrix.
|
|
Returns the Y translation of the matrix.
|
|
invert()
Inverts this matrix.
|
|
multiply(f)
Multiplies this matrix with the specified factor.
|
|
rotate(r)
Rotates this matrix by the specified angle
|
|
scale(fx, fy)
Scales this matrix by the specified factors
|
|
scaleX(f)
X-Scales this matrix by the specified factor
|
|
scaleY(f)
Y-Scales this matrix by the specified factor
|
|
set(m00, m01, m02, m10, m11, m12, m20, m21, m22)
Sets the matrix entries.
|
|
Sets the entries of this matrix to an identity matrix.
|
|
setRotate(angle)
Sets the entries of this matrix to a rotation matrix.
|
|
setScale(fx, fy)
Sets the entries of this matrix to a scaling matrix.
|
|
setScaleX(f)
Sets the entries of this matrix to a X scaling matrix.
|
|
setScaleY(f)
Sets the entries of this matrix to a Y scaling matrix.
|
|
setTransform(transform)
Sets the matrix entries.
|
|
setTranslate(dx, dy)
Sets the entries of this matrix to a translation matrix.
|
|
Sets the entries of this matrix to a X translation matrix.
|
|
Sets the entries of this matrix to a Y translation matrix.
|
|
transform(m)
Multiplies this matrix with the specified matrix.
|
|
translate(dx, dy)
Translates this matrix by the specified deltas
|
|
translateX(d)
X-Translates this matrix by the specified delta
|
|
translateY(d)
Y-Translates this matrix by the specified delta
|
Field Detail
<static>
twodee.Matrix.counter
Instance counter.
m00
The matrix entry 0;0.
m01
The matrix entry 0;1.
m02
The matrix entry 0;2.
m10
The matrix entry 1;0.
m11
The matrix entry 1;1.
m12
The matrix entry 1;2.
m20
The matrix entry 0;0.
m21
The matrix entry 0;1.
m22
The matrix entry 0;2.
Method Detail
{twodee.Matrix}
copy(target)
Returns a copy of this matrix. If a target matrix is specified then the
matrix is copied into this target matrix. If not specified then a new
fresh matrix is created.
- Parameters:
- {twodee.Matrix} target
- Optional target matrix
- Returns:
- {twodee.Matrix} A copy of this matrix
{twodee.Matrix}
divide(f)
Divides this matrix by the specified factor.
- Parameters:
- {number} f
- The factor
- Returns:
- {twodee.Matrix} This matrix
{number}
getDeterminant()
Returns the determinant of the matrix.
- Returns:
- {number} The determinant of the matrix
{number}
getRotationAngle()
Returns the rotation angle in anti-clockwise RAD.
- Returns:
- {number} The rotation angle in anti-clockwise RAD
{twodee.Vector}
getTranslation()
Returns The translation vector of the current matrix. Attention! This
vector is reused and updated to the current translation whenever this
method is called. So you may want to clone the vector if you need it for
a longer time.
- Returns:
- {twodee.Vector} The translation vector of the matrix
{number}
getTranslationX()
Returns the X translation of the matrix.
- Returns:
- {number} The X translation
{number}
getTranslationY()
Returns the Y translation of the matrix.
- Returns:
- {number} The Y translation
{twodee.Matrix}
invert()
Inverts this matrix.
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
multiply(f)
Multiplies this matrix with the specified factor.
- Parameters:
- {number} f
- The factor
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
rotate(r)
Rotates this matrix by the specified angle
- Parameters:
- {number} r
- The angle in anti-clockwise RAD
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
scale(fx, fy)
Scales this matrix by the specified factors
- Parameters:
- {number} fx
- The X factor
- {number=} fy
- The Y factor. Optional. Defaults to fx.
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
scaleX(f)
X-Scales this matrix by the specified factor
- Parameters:
- {number} f
- The factor
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
scaleY(f)
Y-Scales this matrix by the specified factor
- Parameters:
- {number} f
- The factor
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
set(m00, m01, m02, m10, m11, m12, m20, m21, m22)
Sets the matrix entries.
- Parameters:
- {number} m00
- The matrix entry 0;0
- {number} m01
- The matrix entry 0;1
- {number} m02
- The matrix entry 0;2
- {number} m10
- The matrix entry 1;0
- {number} m11
- The matrix entry 1;1
- {number} m12
- The matrix entry 1;2
- {number} m20
- The matrix entry 2;0
- {number} m21
- The matrix entry 2;1
- {number} m22
- The matrix entry 2;2
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setIdentity()
Sets the entries of this matrix to an identity matrix.
- Returns:
- {twodee.Matrix} The matrix
{twodee.Matrix}
setRotate(angle)
Sets the entries of this matrix to a rotation matrix.
- Parameters:
- {number} angle
- The rotation angle in anti-clockwise RAD
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setScale(fx, fy)
Sets the entries of this matrix to a scaling matrix.
- Parameters:
- {number} fx
- The X scale factor
- {number=} fy
- The Y scale factor. Optional. Defaults to fx.
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setScaleX(f)
Sets the entries of this matrix to a X scaling matrix.
- Parameters:
- {number} f
- The scale factor
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setScaleY(f)
Sets the entries of this matrix to a Y scaling matrix.
- Parameters:
- {number} f
- The scale factor
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setTransform(transform)
Sets the matrix entries.
- Parameters:
- {twodee.Matrix} transform
- The matrix to get the entries from
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setTranslate(dx, dy)
Sets the entries of this matrix to a translation matrix.
- Parameters:
- {number} dx
- The X delta
- {number} dy
- The Y delta.
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setTranslateX(d)
Sets the entries of this matrix to a X translation matrix.
- Parameters:
- {number} d
- The delta
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
setTranslateY(d)
Sets the entries of this matrix to a Y translation matrix.
- Parameters:
- {number} d
- The delta
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
transform(m)
Multiplies this matrix with the specified matrix. The result is written
to this matrix.
- Parameters:
- {twodee.Matrix} m
- The other matrix
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
translate(dx, dy)
Translates this matrix by the specified deltas
- Parameters:
- {number} dx
- The X delta
- {number} dy
- The Y delta
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
translateX(d)
X-Translates this matrix by the specified delta
- Parameters:
- {number} d
- The delta
- Returns:
- {twodee.Matrix} This matrix
{twodee.Matrix}
translateY(d)
Y-Translates this matrix by the specified delta
- Parameters:
- {number} d
- The delta
- Returns:
- {twodee.Matrix} This matrix