public final class Matrix4
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static Matrix4 |
IDENTITY |
static Matrix4 |
ZERO |
| Constructor and Description |
|---|
Matrix4(float[] m,
boolean rowMajor)
Initialize a matrix from the specified 16 element array.
|
Matrix4(float m00,
float m01,
float m02,
float m03,
float m10,
float m11,
float m12,
float m13,
float m20,
float m21,
float m22,
float m23)
Creates a matrix with the specified elements
|
| Modifier and Type | Method and Description |
|---|---|
float[] |
asColMajor() |
float[] |
asRowMajor() |
static Matrix4 |
blend(Matrix4 m0,
Matrix4 m1,
float t) |
float |
determinant()
Compute the matrix determinant.
|
boolean |
equals(Matrix4 m) |
static Matrix4 |
fromBasis(OrthoNormalBasis basis)
Creates a rotation matrix from an OrthonormalBasis.
|
Matrix4 |
inverse()
Compute the inverse of this matrix and return it as a new object.
|
boolean |
isIndentity() |
static Matrix4 |
lookAt(Point3 eye,
Point3 target,
Vector3 up)
Creates a camera positioning matrix from the given eye and target points
and up vector.
|
Matrix4 |
multiply(Matrix4 m)
Computes this*m and return the result as a new Matrix4
|
static Matrix4 |
rotate(float x,
float y,
float z,
float theta)
Creates a rotation matrix about the specified axis.
|
static Matrix4 |
rotateX(float theta)
Creates a rotation matrix about the X axis.
|
static Matrix4 |
rotateY(float theta)
Creates a rotation matrix about the Y axis.
|
static Matrix4 |
rotateZ(float theta)
Creates a rotation matrix about the Z axis.
|
static Matrix4 |
scale(float s)
Create a uniform scaling matrix.
|
static Matrix4 |
scale(float sx,
float sy,
float sz)
Creates a non-uniform scaling matrix.
|
BoundingBox |
transform(BoundingBox b)
Transforms each corner of the specified axis-aligned bounding box and
returns a new bounding box which incloses the transformed corners.
|
Point3 |
transformP(Point3 p)
Computes this*p and returns the result as a new Point3 object.
|
float |
transformPX(float x,
float y,
float z)
Computes the x component of this*(x,y,z,1).
|
float |
transformPY(float x,
float y,
float z)
Computes the y component of this*(x,y,z,1).
|
float |
transformPZ(float x,
float y,
float z)
Computes the z component of this*(x,y,z,1).
|
Vector3 |
transformTransposeV(Vector3 v)
Computes (this^T)*v and returns the result as a new Vector3 object.
|
float |
transformTransposeVX(float x,
float y,
float z)
Computes the x component of (this^T)*(x,y,z,0).
|
float |
transformTransposeVY(float x,
float y,
float z)
Computes the y component of (this^T)*(x,y,z,0).
|
float |
transformTransposeVZ(float x,
float y,
float z)
Computes the z component of (this^T)*(x,y,z,0).
|
Vector3 |
transformV(Vector3 v)
Computes this*v and returns the result as a new Vector3 object.
|
float |
transformVX(float x,
float y,
float z)
Computes the x component of this*(x,y,z,0).
|
float |
transformVY(float x,
float y,
float z)
Computes the y component of this*(x,y,z,0).
|
float |
transformVZ(float x,
float y,
float z)
Computes the z component of this*(x,y,z,0).
|
static Matrix4 |
translation(float x,
float y,
float z)
Create a translation matrix for the specified vector.
|
public Matrix4(float m00,
float m01,
float m02,
float m03,
float m10,
float m11,
float m12,
float m13,
float m20,
float m21,
float m22,
float m23)
m00 - value at row 0, col 0m01 - value at row 0, col 1m02 - value at row 0, col 2m03 - value at row 0, col 3m10 - value at row 1, col 0m11 - value at row 1, col 1m12 - value at row 1, col 2m13 - value at row 1, col 3m20 - value at row 2, col 0m21 - value at row 2, col 1m22 - value at row 2, col 2m23 - value at row 2, col 3public Matrix4(float[] m,
boolean rowMajor)
m - a 16 element array in row or column major formrowMajor - true if the array is in row major form,
falseif it is in column major formpublic final boolean isIndentity()
public final boolean equals(Matrix4 m)
public final float[] asRowMajor()
public final float[] asColMajor()
public final float determinant()
public final Matrix4 inverse()
null is returned.null if not
invertiblepublic final Matrix4 multiply(Matrix4 m)
m - right hand side of the multiplicationthis*mpublic final BoundingBox transform(BoundingBox b)
b - original bounding boxpublic final Vector3 transformV(Vector3 v)
[0,0,0,1].v - vector to multiplythis*vpublic final Vector3 transformTransposeV(Vector3 v)
[0,0,0,1].v - vector to multiply(this^T)*vpublic final Point3 transformP(Point3 p)
[0,0,0,1].p - point to multiplythis*vpublic final float transformVX(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformVY(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformVZ(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformTransposeVX(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformTransposeVY(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformTransposeVZ(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformPX(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformPY(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic final float transformPZ(float x,
float y,
float z)
x - x coordinate of the vector to multiplyy - y coordinate of the vector to multiplyz - z coordinate of the vector to multiplypublic static final Matrix4 translation(float x, float y, float z)
x - x component of translationy - y component of translationz - z component of translationpublic static final Matrix4 rotateX(float theta)
theta - angle to rotate about the X axis in radianspublic static final Matrix4 rotateY(float theta)
theta - angle to rotate about the Y axis in radianspublic static final Matrix4 rotateZ(float theta)
theta - angle to rotate about the Z axis in radianspublic static final Matrix4 rotate(float x, float y, float z, float theta)
x - x component of the axis vectory - y component of the axis vectorz - z component of the axis vectortheta - angle to rotate about the axis in radianspublic static final Matrix4 scale(float s)
s - scale factor for all three axespublic static final Matrix4 scale(float sx, float sy, float sz)
sx - scale factor in the x dimensionsy - scale factor in the y dimensionsz - scale factor in the z dimensionpublic static final Matrix4 fromBasis(OrthoNormalBasis basis)
basis - public static final Matrix4 lookAt(Point3 eye, Point3 target, Vector3 up)
eye - location of the eyetarget - location of the targetup - vector pointing upwards