Package javaforce.gl
Class Matrix
java.lang.Object
javaforce.gl.Matrix
- All Implemented Interfaces:
Cloneable
4x4 matrix
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRotate(float angle, float ax, float ay, float az) Adds rotation assuming there is currently no translation.voidaddRotate2(float angle, float ax, float ay, float az) Adds rotation with current translation.voidaddRotate3(float angle, float ax, float ay, float az) Adds rotation adjusted to current rotation but assuming there is currently no translation.voidaddRotate4(float angle, float ax, float ay, float az) Adds rotation adjusted to current rotation with current translation.voidaddScale(float sx, float sy, float sz) Adds scale using full matrix multiple.voidaddTranslate(float tx, float ty, float tz) Adds translation assuming there is currently no rotation.voidaddTranslate(Matrix src) Adds translation assuming there is currently no rotation.voidaddTranslate2(float tx, float ty, float tz) Adds translation with current rotation.voidaddTranslate3(float tx, float ty, float tz) Adds translation adjusted for scaling assuming there is currently no rotation.voidaddTranslate4(float tx, float ty, float tz) Adds translation adjusted for scaling with current rotation.clone()floatReturn the determinant.voidfrustum(float left, float right, float bottom, float top, float znear, float zfar) floatget(int i, int j) booleaninvert()Full matrix inversion in place.voidSets the matrix to look at a point from a specified point.void3x3 matrix multiple (rotation only)voidMultiply another 3x1 matrix with this one (3x3 part only) Effectively rotates the Vector3 by the rotation of this matrixvoidMultiply another 4x1 matrix with this one (full matrix)voidMultiply this matrix with another (rotation/scale only)voidMultiply this matrix with anothervoidortho(float left, float right, float bottom, float top, float near, float far) voidperspective(float fovyInDegrees, float aspectRatio, float znear, float zfar) voidvoidset(int i, int j, float v) voidvoidset(Quaternion q) Set rotation from Quaternion.voidsetAA(float angle, float x, float y, float z) voidsetAATranslate(float angle, float x, float y, float z, float tx, float ty, float tz) voidvoidvoidsetScale(float x, float y, float z) voidsetTranslate(float x, float y, float z) toString()voidTranspose this matrix in place.
-
Field Details
-
m
public float[] m -
TX
public static final int TX- See Also:
-
TY
public static final int TY- See Also:
-
TZ
public static final int TZ- See Also:
-
SX
public static final int SX- See Also:
-
SY
public static final int SY- See Also:
-
SZ
public static final int SZ- See Also:
-
-
Constructor Details
-
Matrix
public Matrix()
-
-
Method Details
-
clone
-
setIdentity
public void setIdentity() -
setIdentity3x3
public void setIdentity3x3() -
set
-
setAA
public void setAA(float angle, float x, float y, float z) -
set
Set rotation from Quaternion. -
setAATranslate
public void setAATranslate(float angle, float x, float y, float z, float tx, float ty, float tz) -
setTranslate
public void setTranslate(float x, float y, float z) -
setScale
public void setScale(float x, float y, float z) -
addRotate
public void addRotate(float angle, float ax, float ay, float az) Adds rotation assuming there is currently no translation. -
addRotate2
public void addRotate2(float angle, float ax, float ay, float az) Adds rotation with current translation. -
addRotate3
public void addRotate3(float angle, float ax, float ay, float az) Adds rotation adjusted to current rotation but assuming there is currently no translation. -
addRotate4
public void addRotate4(float angle, float ax, float ay, float az) Adds rotation adjusted to current rotation with current translation. -
addTranslate
public void addTranslate(float tx, float ty, float tz) Adds translation assuming there is currently no rotation. -
addTranslate
Adds translation assuming there is currently no rotation. -
addTranslate2
public void addTranslate2(float tx, float ty, float tz) Adds translation with current rotation. -
addTranslate3
public void addTranslate3(float tx, float ty, float tz) Adds translation adjusted for scaling assuming there is currently no rotation. Warning : Any zero scaling will result in divide by zero. -
addTranslate4
public void addTranslate4(float tx, float ty, float tz) Adds translation adjusted for scaling with current rotation. Warning : Any zero scaling will result in divide by zero. -
addScale
public void addScale(float sx, float sy, float sz) Adds scale using full matrix multiple. -
mult4x4
Multiply this matrix with another -
mult3x3
Multiply this matrix with another (rotation/scale only) -
mult
3x3 matrix multiple (rotation only) -
mult
Multiply another 3x1 matrix with this one (3x3 part only) Effectively rotates the Vector3 by the rotation of this matrix -
mult
Multiply another 4x1 matrix with this one (full matrix) -
get
public float get(int i, int j) -
set
public void set(int i, int j, float v) -
transpose
public void transpose()Transpose this matrix in place. -
determinant
public float determinant()Return the determinant. Computed across the zeroth row. -
invert
public boolean invert()Full matrix inversion in place. If matrix is singular, returns false and matrix contents are untouched. If you know the matrix is orthonormal, you can call transpose() instead. -
reverseTranslate
public void reverseTranslate() -
frustum
public void frustum(float left, float right, float bottom, float top, float znear, float zfar) -
perspective
public void perspective(float fovyInDegrees, float aspectRatio, float znear, float zfar) -
ortho
public void ortho(float left, float right, float bottom, float top, float near, float far) -
lookAt
Sets the matrix to look at a point from a specified point. Note:input vectors are clobbered.- Parameters:
eye- = camera positionat- = point to look atup- = camera up vector (usually 0,1,0)
-
toString
-