java.lang.Object
technology.sola.math.linear.Matrix3D
Credit to OneLoneCoder for guiding through this implementation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBoundingBoxForTransform
(int width, int height) Returns a bounding box for this matrix transform applied to a rectangle with width and height.static Matrix3D
identity()
invert()
Creates and returns a newMatrix3D
that is the inverse of this matrix.multiply
(float x, float y) Multiples this matrix with a point specified by (x, y).Multiplies two matrices together returning a new instance as the result.Multiplies this matrix with a point.static Matrix3D
rotate
(float radians) Creates a new rotation matrix for the desired radians value.static Matrix3D
scale
(float sx, float sy) Creates a new scale matrix for the desired x-axis and y-axis values.static Matrix3D
sheer
(float sx, float sy) Creates a new sheer matrix for the desired x,y values.static Matrix3D
translate
(float tx, float ty) Creates a new translation matrix for the desired x,y values.
-
Constructor Details
-
Matrix3D
public Matrix3D()
-
-
Method Details
-
identity
- Returns:
- the identity matrix instance
-
translate
Creates a new translation matrix for the desired x,y values.- Parameters:
tx
- the x translatety
- the y translate- Returns:
- new translation matrix
-
scale
Creates a new scale matrix for the desired x-axis and y-axis values.- Parameters:
sx
- the x-axis scalesy
- the y-axis scale- Returns:
- new scale matrix
-
rotate
Creates a new rotation matrix for the desired radians value.- Parameters:
radians
- the radians for the rotation- Returns:
- new rotation matrix
-
sheer
Creates a new sheer matrix for the desired x,y values.- Parameters:
sx
- the x sheersy
- the y sheer- Returns:
- new sheer matrix
-
multiply
Multiplies two matrices together returning a new instance as the result.- Parameters:
matrix3D
- the matrix to multiply with- Returns:
- new matrix with the multiplied result
-
multiply
Multiples this matrix with a point specified by (x, y).- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the point- Returns:
- a
Vector2D
of the matrix multiplied with the point
-
multiply
Multiplies this matrix with a point.- Parameters:
point
- theVector2D
to be multiplied with- Returns:
- a
Vector2D
of the matrix multiplied with the point
-
invert
Creates and returns a newMatrix3D
that is the inverse of this matrix.- Returns:
- a new, inverted matrix
-
getBoundingBoxForTransform
Returns a bounding box for this matrix transform applied to a rectangle with width and height.- Parameters:
width
- the original width of the rectangleheight
- the original height of the rectangle- Returns:
- the bounding box after matrix transform is applied
-