public class Matrix4
extends java.lang.Object
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
Constructor and Description |
---|
Matrix4()
Default constructor will make identity four-dimensional matrix.
|
Matrix4(double n11,
double n12,
double n13,
double n14,
double n21,
double n22,
double n23,
double n24,
double n31,
double n32,
double n33,
double n34,
double n41,
double n42,
double n43,
double n44)
This constructor will create four-dimensional matrix.
|
Modifier and Type | Method and Description |
---|---|
Float32Array |
applyToVector3Array(Float32Array array) |
Float32Array |
applyToVector3Array(Float32Array array,
int offset,
int length) |
Matrix4 |
clone()
Clone the current matrix.
|
Matrix4 |
compose(Vector3 position,
Quaternion quaternion,
Vector3 scale) |
Matrix4 |
copy(Matrix4 m)
Sets the value of this matrix to the values of input matrix.
|
Matrix4 |
copyPosition(Matrix4 m) |
Matrix4 |
decompose(Vector3 position,
Quaternion quaternion,
Vector3 scale) |
double |
determinant()
get the current matrix determinant.
|
Matrix4 |
extractRotation(Matrix4 m)
Setting rotation values to the rotation values of the input matrix.
|
Float32Array |
flattenToArrayOffset(Float32Array flat)
Sets the value of input array to the values of the current matrix.
|
Float32Array |
flattenToArrayOffset(Float32Array flat,
int offset)
Sets the value of input array to the values of the current matrix.
|
Float32Array |
getArray()
get the current Matrix which is represented
by Array[16] which the following indexes:
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
|
Matrix4 |
getInverse(Matrix4 m)
Sets the value of this matrix to the matrix inverse of the passed matrix
m.
|
double |
getMaxScaleOnAxis() |
Matrix4 |
identity()
Make make identity four-dimensional matrix.
|
Matrix4 |
lookAt(Vector3 eye,
Vector3 target,
Vector3 up)
Modifies the current matrix by looking at target on defined eye.
|
Matrix4 |
makeFrustum(double left,
double right,
double bottom,
double top,
double near,
double far)
Creates a frustum matrix.
|
Matrix4 |
makeOrthographic(double left,
double right,
double top,
double bottom,
double near,
double far)
Making Orthographic Projection Matrix
|
Matrix4 |
makePerspective(double fov,
double aspect,
double near,
double far)
Making Perspective Projection Matrix
|
Matrix4 |
makeRotationAxis(Vector3 axis,
double angle)
The method will make rotation matrix on XYZ-axis using defining angle theta.
|
Matrix4 |
makeRotationFromEuler(Euler euler) |
Matrix4 |
makeRotationFromQuaternion(Quaternion q) |
Matrix4 |
makeRotationX(double theta)
The method will make rotation matrix on X-axis using defining angle theta.
|
Matrix4 |
makeRotationY(double theta)
The method will make rotation matrix on Y-axis using defining angle theta.
|
Matrix4 |
makeRotationZ(double theta)
The method will make rotation matrix on Z-axis using defining angle theta.
|
Matrix4 |
makeScale(double x,
double y,
double z)
Make a scaled matrix on the X, Y, Z coordinates.
|
Matrix4 |
makeTranslation(double x,
double y,
double z)
This method will make translation matrix using X, Y,Z coordinates
|
Matrix4 |
multiply(double s)
Sets the value of this matrix to the scalar multiplication of the scale
factor with this.
|
Matrix4 |
multiply(Matrix4 m)
Sets the value of this matrix to the matrix multiplication of itself and
matrix m.
|
Matrix4 |
multiply(Matrix4 m1,
Matrix4 m2)
Sets the value of this matrix to the matrix multiplication of m1 and
vector m2.
|
void |
scale(Vector3 v)
Scale the current matrix.
|
Matrix4 |
set(double n11,
double n12,
double n13,
double n14,
double n21,
double n22,
double n23,
double n24,
double n31,
double n32,
double n33,
double n34,
double n41,
double n42,
double n43,
double n44)
Setting input values n11-n44 to the current matrix.
|
Matrix4 |
setPosition(Vector3 v)
Setting position values of the current matrix to the values of
input vector.
|
java.lang.String |
toString()
get matrix information by printing list of matrix's elements.
|
Matrix4 |
transpose()
Transpose the current matrix where its rows will be the
columns or its columns are the rows of the current matrix.
|
public Matrix4()
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
public Matrix4(double n11, double n12, double n13, double n14, double n21, double n22, double n23, double n24, double n31, double n32, double n33, double n34, double n41, double n42, double n43, double n44)
n11 n12 n13 n14
n21 n22 n23 n24
n31 n32 n33 n34
n41 n42 n43 n44
public Float32Array getArray()
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
public Matrix4 set(double n11, double n12, double n13, double n14, double n21, double n22, double n23, double n24, double n31, double n32, double n33, double n34, double n41, double n42, double n43, double n44)
n11 n12 n13 n14
n21 n22 n23 n24
n31 n32 n33 n34
n41 n42 n43 n44
public Matrix4 identity()
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
public Matrix4 copy(Matrix4 m)
m
- the matrix values which we wat to copypublic Matrix4 extractRotation(Matrix4 m)
m
- the input matrixpublic Matrix4 makeRotationFromQuaternion(Quaternion q)
public Matrix4 lookAt(Vector3 eye, Vector3 target, Vector3 up)
eye
- the Eye vectortarget
- the Target vectorup
- the Up vectorpublic Matrix4 multiply(Matrix4 m1, Matrix4 m2)
m1
- the first matrixm2
- the second matrixpublic Matrix4 multiply(Matrix4 m)
(this = this * m)
m
- the other matrixpublic Matrix4 multiply(double s)
s
- the scalar valuepublic Float32Array applyToVector3Array(Float32Array array)
public Float32Array applyToVector3Array(Float32Array array, int offset, int length)
public double determinant()
public Matrix4 transpose()
public Float32Array flattenToArrayOffset(Float32Array flat)
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
flat
- the array for storing matrix valuespublic Float32Array flattenToArrayOffset(Float32Array flat, int offset)
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
flat
- the array for storing matrix valuesoffset
- the offset valuepublic Matrix4 setPosition(Vector3 v)
v
- the input vectorpublic Matrix4 getInverse(Matrix4 m)
m
- the matrix to be invertedpublic void scale(Vector3 v)
v
- the vector to scale the current matrixpublic double getMaxScaleOnAxis()
public Matrix4 makeTranslation(double x, double y, double z)
x
- the X coordinatey
- the Y coordinatez
- the Z coordinatepublic Matrix4 makeRotationX(double theta)
theta
- the angle to make rotation matrixpublic Matrix4 makeRotationY(double theta)
theta
- the angle to make rotation matrixpublic Matrix4 makeRotationZ(double theta)
theta
- the angle to make rotation matrixpublic Matrix4 makeRotationAxis(Vector3 axis, double angle)
axis
- the axis on which rotate the matrixangle
- the angle to make rotation matrixpublic Matrix4 makeScale(double x, double y, double z)
x
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatepublic Matrix4 compose(Vector3 position, Quaternion quaternion, Vector3 scale)
public Matrix4 decompose(Vector3 position, Quaternion quaternion, Vector3 scale)
public Matrix4 makeFrustum(double left, double right, double bottom, double top, double near, double far)
public Matrix4 makePerspective(double fov, double aspect, double near, double far)
fov
- the field Of Viewaspect
- the aspect rationnear
- the near valuefar
- the far valuepublic Matrix4 makeOrthographic(double left, double right, double top, double bottom, double near, double far)
public Matrix4 clone()
matrix.clone() != matrix
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object