Stability: 1 (Only additions & fixes)
2x3 Transformation matrix used in 2D (column-major) represented as a 8 coordinates array
[m11:Number, m12:Number, m13:Number, m21:Number, m22:Number, m23:Number, cache:Array(5), dirty:Boolean]
cache = [xScale:Number, yScale:Number, xSkew:Number, yScale:Number, rotation:Number]
-
why cache? Speed improvements in exchange of memory to avoid tan/atan2/sqrt.
-
why dirty? Matrix.transform could be expensive with large polygons, keep track of this variable to transform only when necessary.
todo: dSetSkewX / dSetSkewY
-
create (): Matrix23
Creates a new identity 2x3 matrix
-
fromPoints (): Matrix23
Creates a new matrix given 4 points(a Rectangle)
see: http://jsfiddle.net/dFrHS/1/
-
fromAngle (): Matrix23
Creates a new matrix given 4 points(a Rectangle)
see: http://jsfiddle.net/dFrHS/1/
-
copy (out: Matrix23, m2d: Matrix23): Matrix23
Copy m2d into out
-
identity (out: Matrix23): Matrix23
Copy m2d into out
-
dRotate (out: Matrix23, m2d: Matrix23, degrees: Number (Degrees)): Matrix23
Rotates a Matrix23 by the given angle in degrees(increment rotation)
note: increment rotation
todo: increment rotation
-
rotate (out: Matrix23, m2d: Matrix23, radians: Number (Radians)): Matrix23
Rotates a Matrix23 by the given angle in radians(increment rotation)
note: increment rotation
todo: increment rotation
-
dRotation (out: Matrix23, m2d: Matrix23, degrees: Number (Degrees)): Matrix23
Set rotation of a Matrix23 by the given angle in degrees(set rotation)
note: set rotation
todo: set rotation
-
rotation (out: Matrix23, m2d: Matrix23, radians: Number (Radians)): Matrix23
Set rotation of a Matrix23 by the given angle in radians(set rotation)
note: set rotation
todo: set rotation
-
translate (out: Matrix23, m2d: Matrix23, vec2: Vec2): Matrix23
Translates given Matrix23 by the dimensions in the given vec2
note: This translation is affected by rotation/skew
todo: This translation is affected by rotation/skew
note: increment position
todo: increment position
see: gTranslate
-
gTranslate (out: Matrix23, m2d: Matrix23, vec2: Vec2): Matrix23
Translates given Matrix23 by the dimensions in the given vec2
note: This translation is NOT affected by rotation/skew
todo: This translation is NOT affected by rotation/skew
note: increment position
todo: increment position
see: translate
-
position (out: Matrix23, m2d: Matrix23, vec2: Vec2): Matrix23
Set Matrix23 position
note: This translation is NOT affected by rotation/skew
todo: This translation is NOT affected by rotation/skew
note: set position
todo: set position
see: gTranslate
see: translate
-
scale (out: Matrix23, m2d: Matrix23, vec2: Vec2): Matrix23
Scales the Matrix23 by the dimensions in the given vec2
note: incremental scale
todo: incremental scale
note: do not affect position
todo: do not affect position
see: scalation
-
scalation (out: Matrix23, m2d: Matrix23, vec2: Vec2): Matrix23
Set the Matrix23 scale by the dimensions in the given vec2
note: set scale
todo: set scale
note: do not affect position
todo: do not affect position
see: scale
-
dSkewX (out: Matrix23, m2d: Matrix23, degrees: Number (Degrees)): Matrix23
Increment the Matrix23 x-skew by given degrees
note: increment skewX
todo: increment skewX
see: skewX
-
skewX (out: Matrix23, m2d: Matrix23, radians: Number (Radians)): Matrix23
Increment the Matrix23 x-skew by given radians
note: increment skewX
todo: increment skewX
-
dSkewY (out: Matrix23, m2d: Matrix23, degrees: Number (Degrees)): Matrix23
Increment the Matrix23 y-skew by given degrees
note: increment skewY
todo: increment skewY
-
skewY (out: Matrix23, m2d: Matrix23, radians: Number (Radians)): Matrix23
Increment the Matrix23 y-skew by given radians
note: increment skewY
todo: increment skewY
-
dSkew (out: Matrix23, m2d: Matrix23, vec2_degrees: Vec2 (Degrees)): Matrix23
Increment the Matrix23 skew y by given degrees in vec2_degrees
note: increment skew
todo: increment skew
see: dSetSkew
-
skew (out: Matrix23, m2d: Matrix23, vec2_radians: Vec2 (Radians)): Matrix23
Increment the Matrix23 skew y by given radians in vec2
note: increment skew
todo: increment skew
-
dSetSkew (out: Matrix23, m2d: Matrix23, vec2_degrees: Vec2 (Degrees)): Matrix23
Set the Matrix23 skew y by given degrees in vec2_degrees
note: set skew
todo: set skew
see: setSkew
-
setSkew (out: Matrix23, m2d: Matrix23, vec2_radians: Vec2 (Radians)): Matrix23
Set the Matrix23 skew y by given radians in vec2
note: set skew
todo: set skew
-
multiply (out: Matrix23, m2d: Matrix23, m2d_2: Matrix23): Matrix23
Multiplies two Matrix23's
-
multiplyVec2 (out_vec2: Vec2, m2d: Matrix23, vec2: Vec2): Vec2
Multiplies a Matrix23 and a Vec2
-
getPosition (out_vec2: Vec2, m2d: Matrix23): Vec2
Retrieve current position as Vec2
-
getScale (out_vec2: Vec2, m2d: Matrix23): Vec2
Retrieve current scale as Vec2
-
getSkew (out_vec2: Vec2, m2d: Matrix23): Vec2
Retrieve current skew as Vec2
-
reflect (out: Matrix23, m2d: Matrix23): Matrix23
Alias of rotate 180º(PI)
-
transpose (out: Matrix23, m2d: Matrix23)
todo: needed ?
-
determinant (m2d: Matrix23): Number
todo: review & test
-
translationMatrix (x: Number, y: Number): Matrix23
Returns a 3x2 2D column-major translation matrix for x and y.
-
dSkewXMatrix (degrees: Number (Degrees)): Matrix23
Returns a 3x2 2D column-major y-skew matrix for the given degrees.
-
skewXMatrix (radians: Number (Radians)): Matrix23
Returns a 3x2 2D column-major y-skew matrix for the given radians.
-
dSkewYMatrix (degrees: Number (Degrees)): Matrix23
Returns a 3x2 2D column-major y-skew matrix for the given degrees.
-
skewYMatrix (radians: Number (Radians)): Matrix23
Returns a 3x2 2D column-major y-skew matrix for the given radians.
-
rotationMatrix (radians: Number (Radians)): Matrix23
Returns a 3x2 2D column-major y-skew matrix for the given radians.
-
scalingMatrix (x: Number, y: Number)
Returns a 3x2 2D column-major scaling matrix for x and y.
-
interpolate (out: Matrix23, m2d: Matrix23, m2d_2: Matrix23, factor: Number): Matrix23
Interpolate two matrixes by given factor.
Used in conjunction with Transitions and you will have nice transformations :)
-
toAngle (m2d: Matrix23)
For completeness because it's not need in the current implementation just get: m2d[6][4]
-
transform (out_vec2: Vec2, m2d: Matrix23, vec2: Vec2): Vec2
Transform a vector by given matrix
-
dSetRotation (out: Matrix23, m2d: Matrix23, degrees: Number (Degrees))
see: dRotation
-
setRotation (out: Matrix23, m2d: Matrix23, radians: Number (Radians))
see: rotation
-
setPosition (out: Matrix23, m2d: Matrix23, vec2: Vec2)
see: position
-
setScale (out: Matrix23, m2d: Matrix23, vec2: Vec2)
see: scalation