|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.math.Matrix3
public class Matrix3
A 3x3 column major matrix; useful for 2D transforms.
Field Summary | |
---|---|
static int |
M00
|
static int |
M01
|
static int |
M02
|
static int |
M10
|
static int |
M11
|
static int |
M12
|
static int |
M20
|
static int |
M21
|
static int |
M22
|
float[] |
val
|
Constructor Summary | |
---|---|
Matrix3()
|
|
Matrix3(float[] values)
Constructs a matrix from the given float array. |
|
Matrix3(Matrix3 matrix)
|
Method Summary | |
---|---|
float |
det()
|
float |
getRotation()
|
float |
getRotationRad()
|
Vector2 |
getScale(Vector2 scale)
|
Vector2 |
getTranslation(Vector2 position)
|
float[] |
getValues()
Get the values in this matrix. |
Matrix3 |
idt()
Sets this matrix to the identity matrix |
Matrix3 |
inv()
Inverts this matrix given that the determinant is != 0. |
Matrix3 |
mul(Matrix3 m)
Postmultiplies this matrix with the provided matrix and stores the result in this matrix. |
Matrix3 |
mulLeft(Matrix3 m)
Premultiplies this matrix with the provided matrix and stores the result in this matrix. |
Matrix3 |
rotate(float degrees)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix. |
Matrix3 |
rotateRad(float radians)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix. |
Matrix3 |
scale(float scaleX,
float scaleY)
Postmultiplies this matrix with a scale matrix. |
Matrix3 |
scale(Vector2 scale)
Postmultiplies this matrix with a scale matrix. |
Matrix3 |
scl(float scale)
Scale the matrix in the both the x and y components by the scalar value. |
Matrix3 |
scl(Vector2 scale)
Scale this matrix using the x and y components of the vector but leave the rest of the matrix alone. |
Matrix3 |
scl(Vector3 scale)
Scale this matrix using the x and y components of the vector but leave the rest of the matrix alone. |
Matrix3 |
set(float[] values)
Sets the matrix to the given matrix as a float array. |
Matrix3 |
set(Matrix3 mat)
Copies the values from the provided matrix to this matrix. |
Matrix3 |
set(Matrix4 mat)
Sets this 3x3 matrix to the top left 3x3 corner of the provided 4x4 matrix. |
Matrix3 |
setToRotation(float degrees)
Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis. |
Matrix3 |
setToRotation(Vector3 axis,
float degrees)
|
Matrix3 |
setToRotation(Vector3 axis,
float cos,
float sin)
|
Matrix3 |
setToRotationRad(float radians)
Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis. |
Matrix3 |
setToScaling(float scaleX,
float scaleY)
Sets this matrix to a scaling matrix. |
Matrix3 |
setToTranslation(float x,
float y)
Sets this matrix to a translation matrix. |
Matrix3 |
setToTranslation(Vector2 translation)
Sets this matrix to a translation matrix. |
String |
toString()
|
Matrix3 |
translate(float x,
float y)
Postmultiplies this matrix by a translation matrix. |
Matrix3 |
translate(Vector2 translation)
Postmultiplies this matrix by a translation matrix. |
Matrix3 |
transpose()
Transposes the current matrix. |
Matrix3 |
trn(float x,
float y)
Adds a translational component to the matrix in the 3rd column. |
Matrix3 |
trn(Vector2 vector)
Adds a translational component to the matrix in the 3rd column. |
Matrix3 |
trn(Vector3 vector)
Adds a translational component to the matrix in the 3rd column. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int M00
public static final int M01
public static final int M02
public static final int M10
public static final int M11
public static final int M12
public static final int M20
public static final int M21
public static final int M22
public float[] val
Constructor Detail |
---|
public Matrix3()
public Matrix3(Matrix3 matrix)
public Matrix3(float[] values)
values
- The float array to copy. Remember that this matrix is in column major order. (The float array is
not modified.)Method Detail |
---|
public Matrix3 idt()
public Matrix3 mul(Matrix3 m)
A.mul(B) results in A := AB
m
- Matrix to multiply by.
public Matrix3 mulLeft(Matrix3 m)
A.mulLeft(B) results in A := BA
m
- The other Matrix to multiply by
public Matrix3 setToRotation(float degrees)
degrees
- the angle in degrees.
public Matrix3 setToRotationRad(float radians)
radians
- the angle in degrees.
public Matrix3 setToRotation(Vector3 axis, float degrees)
public Matrix3 setToRotation(Vector3 axis, float cos, float sin)
public Matrix3 setToTranslation(float x, float y)
x
- the translation in xy
- the translation in y
public Matrix3 setToTranslation(Vector2 translation)
translation
- The translation vector.
public Matrix3 setToScaling(float scaleX, float scaleY)
scaleX
- the scale in xscaleY
- the scale in y
public String toString()
toString
in class Object
public float det()
public Matrix3 inv()
GdxRuntimeException
- if the matrix is singular (not invertible)public Matrix3 set(Matrix3 mat)
mat
- The matrix to copy.
public Matrix3 set(Matrix4 mat)
mat
- The matrix whose top left corner will be copied. This matrix will not be modified.
public Matrix3 set(float[] values)
values
- The matrix, in float form, that is to be copied. Remember that this matrix is in column major order.
public Matrix3 trn(Vector2 vector)
vector
- The translation vector.
public Matrix3 trn(float x, float y)
x
- The x-component of the translation vector.y
- The y-component of the translation vector.
public Matrix3 trn(Vector3 vector)
vector
- The translation vector. (The z-component of the vector is ignored because this is a 3x3 matrix)
public Matrix3 translate(float x, float y)
x
- The x-component of the translation vector.y
- The y-component of the translation vector.
public Matrix3 translate(Vector2 translation)
translation
- The translation vector.
public Matrix3 rotate(float degrees)
degrees
- The angle in degrees
public Matrix3 rotateRad(float radians)
radians
- The angle in degrees
public Matrix3 scale(float scaleX, float scaleY)
scaleX
- The scale in the x-axis.scaleY
- The scale in the y-axis.
public Matrix3 scale(Vector2 scale)
scale
- The vector to scale the matrix by.
public float[] getValues()
public Vector2 getTranslation(Vector2 position)
public Vector2 getScale(Vector2 scale)
public float getRotation()
public float getRotationRad()
public Matrix3 scl(float scale)
scale
- The single value that will be used to scale both the x and y components.
public Matrix3 scl(Vector2 scale)
scale
- The Vector3
to use to scale this matrix.
public Matrix3 scl(Vector3 scale)
scale
- The Vector3
to use to scale this matrix. The z component will be ignored.
public Matrix3 transpose()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |