|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sunflow.math.Matrix4
public final class Matrix4
This class is used to represent general affine transformations in 3D. The bottom row of the matrix is assumed to be [0,0,0,1]. Note that the rotation matrices assume a right-handed convention.
| Field Summary | |
|---|---|
static Matrix4 |
IDENTITY
|
static Matrix4 |
ZERO
|
| Constructor Summary | |
|---|---|
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 |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Matrix4 ZERO
public static final Matrix4 IDENTITY
| Constructor Detail |
|---|
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 3
public 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 form| Method Detail |
|---|
public 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 multiplication
this*mpublic final BoundingBox transform(BoundingBox b)
b - original bounding box
public final Vector3 transformV(Vector3 v)
[0,0,0,1].
v - vector to multiply
this*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 multiply
this*v
public 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 multiply
public 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 multiply
public 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 multiply
public 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 multiply
public 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 multiply
public 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 multiply
public 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 multiply
public 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 multiply
public 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 multiply
public static final Matrix4 translation(float x,
float y,
float z)
x - x component of translationy - y component of translationz - z component of translation
public static final Matrix4 rotateX(float theta)
theta - angle to rotate about the X axis in radians
public static final Matrix4 rotateY(float theta)
theta - angle to rotate about the Y axis in radians
public static final Matrix4 rotateZ(float theta)
theta - angle to rotate about the Z axis in radians
public 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 radians
public static final Matrix4 scale(float s)
s - scale factor for all three axes
public 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 dimension
public 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
public static final Matrix4 blend(Matrix4 m0,
Matrix4 m1,
float t)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||