public final class Affine2 extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
float |
m00 |
float |
m01 |
float |
m02 |
float |
m10 |
float |
m11 |
float |
m12 |
Constructor and Description |
---|
Affine2()
Constructs an identity matrix.
|
Affine2(Affine2 other)
Constructs a matrix from the given affine matrix.
|
Modifier and Type | Method and Description |
---|---|
void |
applyTo(Vector2 point)
Applies the affine transformation on a vector.
|
float |
det()
Calculates the determinant of the matrix.
|
Vector2 |
getTranslation(Vector2 position)
Get the x-y translation component of the matrix.
|
Affine2 |
idt()
Sets this matrix to the identity matrix
|
Affine2 |
inv()
Inverts this matrix given that the determinant is != 0.
|
boolean |
isIdt()
Check if this is an indentity matrix.
|
boolean |
isTranslation()
Check if the this is a plain translation matrix.
|
Affine2 |
mul(Affine2 other)
Postmultiplies this matrix with the provided matrix and stores the result in this matrix.
|
Affine2 |
preMul(Affine2 other)
Premultiplies this matrix with the provided matrix and stores the result in this matrix.
|
Affine2 |
preRotate(float degrees)
Premultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Affine2 |
preRotateRad(float radians)
Premultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Affine2 |
preScale(float scaleX,
float scaleY)
Premultiplies this matrix with a scale matrix.
|
Affine2 |
preScale(Vector2 scale)
Premultiplies this matrix with a scale matrix.
|
Affine2 |
preShear(float shearX,
float shearY)
Premultiplies this matrix by a shear matrix.
|
Affine2 |
preShear(Vector2 shear)
Premultiplies this matrix by a shear matrix.
|
Affine2 |
preTranslate(float x,
float y)
Premultiplies this matrix by a translation matrix.
|
Affine2 |
preTranslate(Vector2 trn)
Premultiplies this matrix by a translation matrix.
|
Affine2 |
rotate(float degrees)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Affine2 |
rotateRad(float radians)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Affine2 |
scale(float scaleX,
float scaleY)
Postmultiplies this matrix with a scale matrix.
|
Affine2 |
scale(Vector2 scale)
Postmultiplies this matrix with a scale matrix.
|
Affine2 |
set(Affine2 other)
Copies the values from the provided affine matrix to this matrix.
|
Affine2 |
set(Matrix3 matrix)
Copies the values from the provided matrix to this matrix.
|
Affine2 |
set(Matrix4 matrix)
Copies the 2D transformation components from the provided 4x4 matrix.
|
Affine2 |
setToProduct(Affine2 l,
Affine2 r)
Sets this matrix to the product of two matrices.
|
Affine2 |
setToRotation(float degrees)
Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis.
|
Affine2 |
setToRotation(float cos,
float sin)
Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis.
|
Affine2 |
setToRotationRad(float radians)
Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis.
|
Affine2 |
setToScaling(float scaleX,
float scaleY)
Sets this matrix to a scaling matrix.
|
Affine2 |
setToScaling(Vector2 scale)
Sets this matrix to a scaling matrix.
|
Affine2 |
setToShearing(float shearX,
float shearY)
Sets this matrix to a shearing matrix.
|
Affine2 |
setToShearing(Vector2 shear)
Sets this matrix to a shearing matrix.
|
Affine2 |
setToTranslation(float x,
float y)
Sets this matrix to a translation matrix.
|
Affine2 |
setToTranslation(Vector2 trn)
Sets this matrix to a translation matrix.
|
Affine2 |
setToTrnRotRadScl(float x,
float y,
float radians,
float scaleX,
float scaleY)
Sets this matrix to a concatenation of translation, rotation and scale.
|
Affine2 |
setToTrnRotRadScl(Vector2 trn,
float radians,
Vector2 scale)
Sets this matrix to a concatenation of translation, rotation and scale.
|
Affine2 |
setToTrnRotScl(float x,
float y,
float degrees,
float scaleX,
float scaleY)
Sets this matrix to a concatenation of translation, rotation and scale.
|
Affine2 |
setToTrnRotScl(Vector2 trn,
float degrees,
Vector2 scale)
Sets this matrix to a concatenation of translation, rotation and scale.
|
Affine2 |
setToTrnScl(float x,
float y,
float scaleX,
float scaleY)
Sets this matrix to a concatenation of translation and scale.
|
Affine2 |
setToTrnScl(Vector2 trn,
Vector2 scale)
Sets this matrix to a concatenation of translation and scale.
|
Affine2 |
shear(float shearX,
float shearY)
Postmultiplies this matrix by a shear matrix.
|
Affine2 |
shear(Vector2 shear)
Postmultiplies this matrix by a shear matrix.
|
String |
toString() |
Affine2 |
translate(float x,
float y)
Postmultiplies this matrix by a translation matrix.
|
Affine2 |
translate(Vector2 trn)
Postmultiplies this matrix by a translation matrix.
|
public float m00
public float m01
public float m02
public float m10
public float m11
public float m12
public Affine2()
public Affine2(Affine2 other)
other
- The affine matrix to copy. This matrix will not be modified.public Affine2 idt()
public Affine2 set(Affine2 other)
other
- The affine matrix to copy.public Affine2 set(Matrix3 matrix)
matrix
- The matrix to copy, assumed to be an affine transformation.public Affine2 set(Matrix4 matrix)
[ M00 M01 M03 ] [ M10 M11 M13 ] [ 0 0 1 ]
matrix
- The source matrix, assumed to be an affine transformation within XY plane. This matrix will not be modified.public Affine2 setToTranslation(float x, float y)
x
- The translation in xy
- The translation in ypublic Affine2 setToTranslation(Vector2 trn)
trn
- The translation vector.public Affine2 setToScaling(float scaleX, float scaleY)
scaleX
- The scale in x.scaleY
- The scale in y.public Affine2 setToScaling(Vector2 scale)
scale
- The scale vector.public Affine2 setToRotation(float degrees)
degrees
- The angle in degrees.public Affine2 setToRotationRad(float radians)
radians
- The angle in radians.public Affine2 setToRotation(float cos, float sin)
cos
- The angle cosine.sin
- The angle sine.public Affine2 setToShearing(float shearX, float shearY)
shearX
- The shear in x direction.shearY
- The shear in y direction.public Affine2 setToShearing(Vector2 shear)
shear
- The shear vector.public Affine2 setToTrnRotScl(float x, float y, float degrees, float scaleX, float scaleY)
idt().translate(x, y).rotate(degrees).scale(scaleX, scaleY)
x
- The translation in x.y
- The translation in y.degrees
- The angle in degrees.scaleX
- The scale in y.scaleY
- The scale in x.public Affine2 setToTrnRotScl(Vector2 trn, float degrees, Vector2 scale)
idt().translate(trn).rotate(degrees).scale(scale)
trn
- The translation vector.degrees
- The angle in degrees.scale
- The scale vector.public Affine2 setToTrnRotRadScl(float x, float y, float radians, float scaleX, float scaleY)
idt().translate(x, y).rotateRad(radians).scale(scaleX, scaleY)
x
- The translation in x.y
- The translation in y.radians
- The angle in radians.scaleX
- The scale in y.scaleY
- The scale in x.public Affine2 setToTrnRotRadScl(Vector2 trn, float radians, Vector2 scale)
idt().translate(trn).rotateRad(radians).scale(scale)
trn
- The translation vector.radians
- The angle in radians.scale
- The scale vector.public Affine2 setToTrnScl(float x, float y, float scaleX, float scaleY)
idt().translate(x, y).scale(scaleX, scaleY)
x
- The translation in x.y
- The translation in y.scaleX
- The scale in y.scaleY
- The scale in x.public Affine2 setToTrnScl(Vector2 trn, Vector2 scale)
idt().translate(trn).scale(scale)
trn
- The translation vector.scale
- The scale vector.public Affine2 setToProduct(Affine2 l, Affine2 r)
l
- Left matrix.r
- Right matrix.public Affine2 inv()
GdxRuntimeException
- if the matrix is singular (not invertible)public Affine2 mul(Affine2 other)
A.mul(B) results in A := AB
other
- Matrix to multiply by.public Affine2 preMul(Affine2 other)
A.preMul(B) results in A := BA
other
- The other Matrix to multiply bypublic Affine2 translate(float x, float y)
x
- The x-component of the translation vector.y
- The y-component of the translation vector.public Affine2 translate(Vector2 trn)
trn
- The translation vector.public Affine2 preTranslate(float x, float y)
x
- The x-component of the translation vector.y
- The y-component of the translation vector.public Affine2 preTranslate(Vector2 trn)
trn
- The translation vector.public Affine2 scale(float scaleX, float scaleY)
scaleX
- The scale in the x-axis.scaleY
- The scale in the y-axis.public Affine2 scale(Vector2 scale)
scale
- The scale vector.public Affine2 preScale(float scaleX, float scaleY)
scaleX
- The scale in the x-axis.scaleY
- The scale in the y-axis.public Affine2 preScale(Vector2 scale)
scale
- The scale vector.public Affine2 rotate(float degrees)
degrees
- The angle in degreespublic Affine2 rotateRad(float radians)
radians
- The angle in radianspublic Affine2 preRotate(float degrees)
degrees
- The angle in degreespublic Affine2 preRotateRad(float radians)
radians
- The angle in radianspublic Affine2 shear(float shearX, float shearY)
shearX
- The shear in x direction.shearY
- The shear in y direction.public Affine2 shear(Vector2 shear)
shear
- The shear vector.public Affine2 preShear(float shearX, float shearY)
shearX
- The shear in x direction.shearY
- The shear in y direction.public Affine2 preShear(Vector2 shear)
shear
- The shear vector.public float det()
public Vector2 getTranslation(Vector2 position)
position
- Output vector.public boolean isTranslation()
public boolean isIdt()
public void applyTo(Vector2 point)
Copyright © 2017. All rights reserved.