An affine 2D 2x3 matrix.
Matrix properties are as follows:
[a, c, x]
[b, d, y]
Constructor
Variables
Methods
inlinegetPosition(?p:Point):Null<Point>
Returns a Point with x
and y
of the Matrix.
Parameters:
p | Optional Point instance to use. Otherwise returns new instance. |
---|
inlinegetScale():Point
Returns a Point with a total scaling applied by the Matrix.
Parameters:
p | Optional Point instance. If provided, sets values of given Point and returns it. Otherwise returns new Point instance. |
---|
inlineidentity():Void
Sets the matrix values to ones that would perform no transformation.
[1, 0, 0]
[0, 1, 0]
inlineinitRotate(angle:Float):Void
Sets the matrix values to ones that would only rotate the transformed position by given angle
.
[cos(angle), -sin(angle), 0]
[sin(angle), cos(angle), 0]
inlineinitScale(sx:Float, sy:Float):Void
Sets the matrix values to ones that would only scale the transformed positions by given sx
and sy
.
[sx, 0, 0]
[0, sy, 0]
inlineinitSkew(sx:Float, sy:Float):Void
Sets the matrix values to ones that would only skew the transformed position by given sx
and sy
.
[1, tan(sx), 0]
[tan(sy), 1, 0]
inlineinitTranslate(x:Float, y:Float):Void
Sets the matrix values to ones that would only move the transformed positions by given x
and y
.
[1, 0, x]
[0, 1, y]
invert():Void
Inverts the matrix to perform the opposite transformation. Can be used to undo the previously applied transformation.
See also:
multiply(a:Matrix, b:Matrix):Void
Concatenates Matrix a
and b
and stores the result in this Matrix.
Matrix can be the target of of it's own multiply
.
Keep in mind that order of matrixes matter in concatenation.
inlineprependTranslate(x:Float, y:Float):Void
Transforms given x
and y
with current Matrix values (excluding translation) and
applies translation transform to Matrix by resulting x
and y
.
inlineprependTranslateX(x:Float):Void
Transforms given x
with current Matrix values (excluding translation) and
applies translation transform on X-axis to Matrix by resulting x
and y
.
Equivalent of matrix.x += matrix.a * x
.
inlineprependTranslateY(y:Float):Void
Transforms given y
with current Matrix values (excluding translation) and
applies translation transform on Y-axis to Matrix by resulting y
.
Equivalent of matrix.y += matrix.d * y
.
inlinetransform(pt:Point):Point
Returns a new Point that is a result of transforming Point pt
by this Matrix.
inlinetranslateX(x:Float):Void
Applies translation transform on X-axis to Matrix by given x
. Equivalent of matrix.x += x
.
inlinetranslateY(y:Float):Void
Applies translation transform on Y-axis to Matrix by given y
. Equivalent of matrix.y += y
.