Package com.aspose.threed
Class Matrix4
- java.lang.Object
-
- com.aspose.threed.Matrix4
-
- All Implemented Interfaces:
com.aspose.csporter.helpers.Struct<Matrix4>
,java.io.Serializable
,java.lang.Cloneable
public final class Matrix4 extends java.lang.Object implements com.aspose.csporter.helpers.Struct<Matrix4>, java.io.Serializable
4x4 matrix implementation.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description double
m00
The m00.double
m01
The m01.double
m02
The m02.double
m03
The m03.double
m10
The m10.double
m11
The m11.double
m12
The m12.double
m13
The m13.double
m20
The m20.double
m21
The m21.double
m22
The m22.double
m23
The m23.double
m30
The m30.double
m31
The m31.double
m32
The m32.double
m33
The m33.
-
Constructor Summary
Constructors Constructor Description Matrix4()
Matrix4(double[] m)
Initializes a new instance of theMatrix4
struct.Matrix4(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
Initializes a new instance of theMatrix4
struct.Matrix4(Vector4 r0, Vector4 r1, Vector4 r2, Vector4 r3)
Constructs matrix from 4 rows.
-
Method Summary
Modifier and Type Method Description Matrix4
clone()
Matrix4
concatenate(Matrix4 m2)
Concatenates the two matricesvoid
copyFrom(Matrix4 src)
boolean
decompose(Vector3 translation, Vector3 scaling, Quaternion rotation)
Decompose the transformation matrix.boolean
equals(java.lang.Object obj)
double
getDeterminant()
Gets the determinant of the matrix.static Matrix4
getIdentity()
Gets the identity matrix.int
hashCode()
Matrix4
inverse()
Inverses this instance.static Matrix4
mul(Matrix4 lhs, double v)
Multiply the matrix and double valuestatic Matrix4
mul(Matrix4 lhs, Matrix4 rhs)
Multiply the two matricesstatic Vector3
mul(Matrix4 lhs, Vector3 v)
Multiply the matrix and vector3static Vector4
mul(Matrix4 lhs, Vector4 v)
Multiply the matrix and vector4Matrix4
normalize()
Normalizes this instance.static Matrix4
rotate(double angle, Vector3 axis)
Create a rotation matrix by rotation angle and axisstatic Matrix4
rotate(Quaternion q)
Create a rotation matrix from a quaternionstatic Matrix4
rotateFromEuler(double rx, double ry, double rz)
Create a rotation matrix from euler anglestatic Matrix4
rotateFromEuler(Vector3 eul)
Create a rotation matrix from euler anglestatic Matrix4
scale(double s)
Creates a matrix that scales along the x-axis, the y-axis and the z-axis.static Matrix4
scale(double sx, double sy, double sz)
Creates a matrix that scales along the x-axis, the y-axis and the z-axis.static Matrix4
scale(Vector3 s)
Creates a matrix that scales along the x-axis, the y-axis and the z-axis.void
setTRS(Vector3 translation, Vector3 rotation, Vector3 scale)
Initializes the matrix with translation/rotation/scaledouble[]
toArray()
Converts matrix to array.java.lang.String
toString()
Returns aString
that represents the currentMatrix4
.static Matrix4
translate(double tx, double ty, double tz)
Creates a matrix that translates along the x-axis, the y-axis and the z-axisstatic Matrix4
translate(Vector3 t)
Creates a matrix that translates along the x-axis, the y-axis and the z-axisMatrix4
transpose()
Transposes this instance.
-
-
-
Field Detail
-
m00
public double m00
The m00.
-
m01
public double m01
The m01.
-
m02
public double m02
The m02.
-
m03
public double m03
The m03.
-
m10
public double m10
The m10.
-
m11
public double m11
The m11.
-
m12
public double m12
The m12.
-
m13
public double m13
The m13.
-
m20
public double m20
The m20.
-
m21
public double m21
The m21.
-
m22
public double m22
The m22.
-
m23
public double m23
The m23.
-
m30
public double m30
The m30.
-
m31
public double m31
The m31.
-
m32
public double m32
The m32.
-
m33
public double m33
The m33.
-
-
Constructor Detail
-
Matrix4
public Matrix4(Vector4 r0, Vector4 r1, Vector4 r2, Vector4 r3)
Constructs matrix from 4 rows.- Parameters:
r0
- R0.r1
- R1.r2
- R2.r3
- R3.
-
Matrix4
public Matrix4(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
Initializes a new instance of theMatrix4
struct.- Parameters:
m00
- M00.m01
- M01.m02
- M02.m03
- M03.m10
- M10.m11
- M11.m12
- M12.m13
- M13.m20
- M20.m21
- M21.m22
- M22.m23
- M23.m30
- M30.m31
- M31.m32
- M32.m33
- M33.
-
Matrix4
public Matrix4(double[] m)
Initializes a new instance of theMatrix4
struct.- Parameters:
m
- M.
-
Matrix4
public Matrix4()
-
-
Method Detail
-
getIdentity
public static Matrix4 getIdentity()
Gets the identity matrix.
-
concatenate
public Matrix4 concatenate(Matrix4 m2)
Concatenates the two matrices- Parameters:
m2
- M2.- Returns:
- New matrix4
-
transpose
public Matrix4 transpose()
Transposes this instance.- Returns:
- The transposed matrix.
-
normalize
public Matrix4 normalize()
Normalizes this instance.- Returns:
- Normalize matrix4
-
inverse
public Matrix4 inverse()
Inverses this instance.- Returns:
- Inverse matrix4
-
getDeterminant
public double getDeterminant()
Gets the determinant of the matrix.
-
mul
public static Matrix4 mul(Matrix4 lhs, Matrix4 rhs)
Multiply the two matrices- Parameters:
lhs
- Lhs.rhs
- Rhs.- Returns:
- Result matrix
-
mul
public static Vector3 mul(Matrix4 lhs, Vector3 v)
Multiply the matrix and vector3- Parameters:
lhs
- Lhs.v
- V.- Returns:
- Result matrix
-
setTRS
public void setTRS(Vector3 translation, Vector3 rotation, Vector3 scale)
Initializes the matrix with translation/rotation/scale- Parameters:
translation
- Translation.rotation
- Euler angles for rotation, fields are in degree.scale
- Scale.
-
mul
public static Vector4 mul(Matrix4 lhs, Vector4 v)
Multiply the matrix and vector4- Parameters:
lhs
- Lhs.v
- V.- Returns:
- Result matrix
-
mul
public static Matrix4 mul(Matrix4 lhs, double v)
Multiply the matrix and double value- Parameters:
lhs
- Lhs.v
- V.- Returns:
- Result matrix
-
toArray
public double[] toArray()
Converts matrix to array.- Returns:
- The array.
-
decompose
public boolean decompose(Vector3 translation, Vector3 scaling, Quaternion rotation)
Decompose the transformation matrix.- Parameters:
translation
- The translation.scaling
- The scaling.rotation
- The rotation.- Returns:
- True if successed.
-
toString
public java.lang.String toString()
Returns aString
that represents the currentMatrix4
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A
String
that represents the currentMatrix4
.
-
translate
public static Matrix4 translate(Vector3 t)
Creates a matrix that translates along the x-axis, the y-axis and the z-axis- Parameters:
t
- Translate offset
-
translate
public static Matrix4 translate(double tx, double ty, double tz)
Creates a matrix that translates along the x-axis, the y-axis and the z-axis- Parameters:
tx
- X-coordinate offsetty
- Y-coordinate offsettz
- Z-coordinate offset
-
scale
public static Matrix4 scale(Vector3 s)
Creates a matrix that scales along the x-axis, the y-axis and the z-axis.- Parameters:
s
- Scaling factories applies to the x-axis, the y-axis and the z-axis
-
scale
public static Matrix4 scale(double s)
Creates a matrix that scales along the x-axis, the y-axis and the z-axis.- Parameters:
s
- Scaling factories applies to all axises
-
scale
public static Matrix4 scale(double sx, double sy, double sz)
Creates a matrix that scales along the x-axis, the y-axis and the z-axis.- Parameters:
sx
- Scaling factories applies to the x-axissy
- Scaling factories applies to the y-axissz
- Scaling factories applies to the z-axis
-
rotateFromEuler
public static Matrix4 rotateFromEuler(Vector3 eul)
Create a rotation matrix from euler angle- Parameters:
eul
- Rotation in radian
-
rotateFromEuler
public static Matrix4 rotateFromEuler(double rx, double ry, double rz)
Create a rotation matrix from euler angle- Parameters:
rx
- Rotation in x axis in radianry
- Rotation in y axis in radianrz
- Rotation in z axis in radian
-
rotate
public static Matrix4 rotate(double angle, Vector3 axis)
Create a rotation matrix by rotation angle and axis- Parameters:
angle
- Rotate angle in radianaxis
- Rotation axis
-
rotate
public static Matrix4 rotate(Quaternion q)
Create a rotation matrix from a quaternion- Parameters:
q
- Rotation quaternion
-
clone
public Matrix4 clone()
- Specified by:
clone
in interfacecom.aspose.csporter.helpers.Struct<Matrix4>
- Overrides:
clone
in classjava.lang.Object
-
copyFrom
public void copyFrom(Matrix4 src)
- Specified by:
copyFrom
in interfacecom.aspose.csporter.helpers.Struct<Matrix4>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-