public class Matrix44
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double[] |
m
The matrix elements stored contiguously in an array, as in OpenGL.
|
Constructor and Description |
---|
Matrix44()
Constructs an identity matrix.
|
Matrix44(double[] m)
Constructs a matrix with specified elements.
|
Matrix44(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)
Constructs a matrix with specified elements.
|
Matrix44(Matrix44 m)
Constructs a copy of the specified matrix.
|
Modifier and Type | Method and Description |
---|---|
static Matrix44 |
frustum(double left,
double right,
double bottom,
double top,
double znear,
double zfar)
Returns a new perspective-projection matrix.
|
static Matrix44 |
identity()
Returns a new identity matrix.
|
Matrix44 |
inverse()
Returns the inverse Minv of this matrix M.
|
Matrix44 |
inverseEquals()
Replaces this matrix M with its inverse Minv.
|
static Matrix44 |
ortho(double left,
double right,
double bottom,
double top,
double znear,
double zfar)
Returns a new orthographic-projection matrix.
|
static Matrix44 |
perspective(double fovy,
double aspect,
double znear,
double zfar)
Returns a new perspective-projection matrix.
|
static Matrix44 |
rotate(double ra,
double rx,
double ry,
double rz)
Returns a new rotation matrix.
|
static Matrix44 |
rotate(double ra,
Vector3 rv)
Returns a new rotation matrix.
|
static Matrix44 |
rotateX(double ra)
Returns a new rotation matrix.
|
static Matrix44 |
rotateY(double ra)
Returns a new rotation matrix.
|
static Matrix44 |
rotateZ(double ra)
Returns a new rotation matrix.
|
static Matrix44 |
scale(double sx,
double sy,
double sz)
Returns a new scaling matrix.
|
void |
set(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)
Sets all elements of this matrix.
|
Matrix44 |
setFrustum(double left,
double right,
double bottom,
double top,
double znear,
double zfar)
Sets this matrix to a perspective-projection matrix.
|
Matrix44 |
setIdentity()
Sets this matrix to an identity matrix.
|
Matrix44 |
setOrtho(double left,
double right,
double bottom,
double top,
double znear,
double zfar)
Sets this matrix to a orthographic-projection matrix.
|
Matrix44 |
setPerspective(double fovy,
double aspect,
double znear,
double zfar)
Sets this matrix to a perspective-projection matrix.
|
Matrix44 |
setRotate(double ra,
double rx,
double ry,
double rz)
Sets this matrix to a rotation-only matrix.
|
Matrix44 |
setRotate(double ra,
Vector3 rv)
Sets this matrix to a rotation-only matrix.
|
Matrix44 |
setRotateX(double ra)
Sets this matrix to a rotation-only matrix.
|
Matrix44 |
setRotateY(double ra)
Sets this matrix to a rotation-only matrix.
|
Matrix44 |
setRotateZ(double ra)
Sets this matrix to a rotation-only matrix.
|
Matrix44 |
setScale(double sx,
double sy,
double sz)
Sets this matrix to a scaling-only matrix.
|
Matrix44 |
setTranslate(double tx,
double ty,
double tz)
Sets this matrix to a translation-only matrix.
|
Matrix44 |
setTranslate(Vector3 tv)
Sets this matrix to a translation-only matrix.
|
Matrix44 |
times(Matrix44 a)
Returns the product MA of this matrix M and a matrix A.
|
Point3 |
times(Point3 p)
Returns the product Mp of this matrix M and a point p.
|
Point4 |
times(Point4 p)
Returns the product Mp of this matrix M and a point p.
|
Vector3 |
times(Vector3 v)
Returns the product Mv of this matrix M and a vector v.
|
Matrix44 |
timesEquals(Matrix44 a)
Replaces this matrix M with the matrix product MA.
|
Matrix44 |
timesTranspose(Matrix44 a)
Returns the product MA' of this matrix M and the transpose of a matrix A.
|
Matrix44 |
timesTransposeEquals(Matrix44 a)
Replaces this matrix M with the matrix product MA'.
|
java.lang.String |
toString() |
static Matrix44 |
translate(double tx,
double ty,
double tz)
Returns a new translation matrix.
|
static Matrix44 |
translate(Vector3 tv)
Returns a new translation matrix.
|
Matrix44 |
transpose()
Returns the transpose M' of this matrix M.
|
Matrix44 |
transposeEquals()
Replaces this matrix M with its transpose M'.
|
Matrix44 |
transposeTimes(Matrix44 a)
Returns the product M'A of the transpose of this matrix M and a matrix A.
|
Point3 |
transposeTimes(Point3 p)
Returns the product M'p of the transpose of this matrix M and a point p.
|
Point4 |
transposeTimes(Point4 p)
Returns the product M'p of the transpose of this matrix M and a point p.
|
Vector3 |
transposeTimes(Vector3 v)
Returns the product M'v of the transpose of this matrix M and a vector v.
|
Matrix44 |
transposeTimesEquals(Matrix44 a)
Replaces this matrix M with the matrix product M'A.
|
public double[] m
| m00 m01 m02 m03 | | m[ 0] m[ 4] m[ 8] m[12] |
| m10 m11 m12 m13 | = | m[ 1] m[ 5] m[ 9] m[13] |
| m20 m21 m22 m23 | | m[ 2] m[ 6] m[10] m[14] |
| m30 m31 m32 m03 | | m[ 3] m[ 7] m[11] m[15] |
public Matrix44()
public Matrix44(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)
m00
- the element with (row,col) indices (0,0)m01
- the element with (row,col) indices (0,1)m02
- the element with (row,col) indices (0,2)m03
- the element with (row,col) indices (0,3)m10
- the element with (row,col) indices (1,0)m11
- the element with (row,col) indices (1,1)m12
- the element with (row,col) indices (1,2)m13
- the element with (row,col) indices (1,3)m20
- the element with (row,col) indices (2,0)m21
- the element with (row,col) indices (2,1)m22
- the element with (row,col) indices (2,2)m23
- the element with (row,col) indices (2,3)m30
- the element with (row,col) indices (3,0)m31
- the element with (row,col) indices (3,1)m32
- the element with (row,col) indices (3,2)m33
- the element with (row,col) indices (3,3)public Matrix44(double[] m)
m
- the array[16] of matrix elements.public Matrix44(Matrix44 m)
m
- the matrix.public void set(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)
m00
- the element with (row,col) indices (0,0)m01
- the element with (row,col) indices (0,1)m02
- the element with (row,col) indices (0,2)m03
- the element with (row,col) indices (0,3)m10
- the element with (row,col) indices (1,0)m11
- the element with (row,col) indices (1,1)m12
- the element with (row,col) indices (1,2)m13
- the element with (row,col) indices (1,3)m20
- the element with (row,col) indices (2,0)m21
- the element with (row,col) indices (2,1)m22
- the element with (row,col) indices (2,2)m23
- the element with (row,col) indices (2,3)m30
- the element with (row,col) indices (3,0)m31
- the element with (row,col) indices (3,1)m32
- the element with (row,col) indices (3,2)m33
- the element with (row,col) indices (3,3)public Matrix44 inverse()
public Matrix44 inverseEquals()
public Matrix44 transpose()
public Matrix44 transposeEquals()
public Matrix44 times(Matrix44 a)
a
- the matrix A.public Matrix44 timesEquals(Matrix44 a)
a
- the matrix A.public Matrix44 timesTranspose(Matrix44 a)
a
- the matrix A.public Matrix44 timesTransposeEquals(Matrix44 a)
a
- the matrix A.public Matrix44 transposeTimes(Matrix44 a)
a
- the matrix A.public Matrix44 transposeTimesEquals(Matrix44 a)
a
- the matrix A.public Point3 times(Point3 p)
p
- the point p.public Point4 times(Point4 p)
p
- the point p.public Point3 transposeTimes(Point3 p)
p
- the point p.public Point4 transposeTimes(Point4 p)
p
- the point p.public Vector3 times(Vector3 v)
v
- the vector v.public Vector3 transposeTimes(Vector3 v)
v
- the vector v.public static Matrix44 identity()
public static Matrix44 translate(double tx, double ty, double tz)
tx
- the x component of the translation.ty
- the y component of the translation.tz
- the z component of the translation.public static Matrix44 translate(Vector3 tv)
tv
- the translation vector.public static Matrix44 scale(double sx, double sy, double sz)
sx
- the x component of the scaling.sy
- the y component of the scaling.sz
- the z component of the scaling.public static Matrix44 rotate(double ra, double rx, double ry, double rz)
ra
- the angle of rotation, in degrees.rx
- the x component of the vector axis of rotationry
- the y component of the vector axis of rotationrz
- the z component of the vector axis of rotationpublic static Matrix44 rotate(double ra, Vector3 rv)
ra
- the angle of rotation, in degrees.rv
- the vector axis of rotation.public static Matrix44 rotateX(double ra)
ra
- the angle of rotation, in degrees.public static Matrix44 rotateY(double ra)
ra
- the angle of rotation, in degrees.public static Matrix44 rotateZ(double ra)
ra
- the angle of rotation, in degrees.public static Matrix44 ortho(double left, double right, double bottom, double top, double znear, double zfar)
left
- the coordinate for the left clipping plane.right
- the coordinate for the right clipping plane.bottom
- the coordinate for the bottom clipping plane.top
- the coordinate for the top clipping plane.znear
- the distance to the near depth clipping planezfar
- the distance to the far depth clipping planepublic static Matrix44 frustum(double left, double right, double bottom, double top, double znear, double zfar)
left
- the coordinate for the left clipping plane.right
- the coordinate for the right clipping plane.bottom
- the coordinate for the bottom clipping plane.top
- the coordinate for the top clipping plane.znear
- the distance to the near depth clipping planezfar
- the distance to the far depth clipping planepublic static Matrix44 perspective(double fovy, double aspect, double znear, double zfar)
fovy
- the field of view, in degrees, in the vertical direction.aspect
- the aspect ratio width/height.znear
- the distance to the near depth clipping planezfar
- the distance to the far depth clipping planepublic Matrix44 setIdentity()
public Matrix44 setTranslate(double tx, double ty, double tz)
tx
- the x component of the translation.ty
- the y component of the translation.tz
- the z component of the translation.public Matrix44 setTranslate(Vector3 tv)
tv
- the translation vector.public Matrix44 setScale(double sx, double sy, double sz)
sx
- the x component of the scaling.sy
- the y component of the scaling.sz
- the z component of the scaling.public Matrix44 setRotate(double ra, double rx, double ry, double rz)
ra
- the angle of rotation, in degrees.rx
- the x component of the vector axis of rotationry
- the y component of the vector axis of rotationrz
- the z component of the vector axis of rotationpublic Matrix44 setRotate(double ra, Vector3 rv)
ra
- the angle of rotation, in degrees.rv
- the vector axis of rotation.public Matrix44 setRotateX(double ra)
ra
- the angle of rotation, in degrees.public Matrix44 setRotateY(double ra)
ra
- the angle of rotation, in degrees.public Matrix44 setRotateZ(double ra)
ra
- the angle of rotation, in degrees.public Matrix44 setOrtho(double left, double right, double bottom, double top, double znear, double zfar)
left
- the coordinate for the left clipping plane.right
- the coordinate for the right clipping plane.bottom
- the coordinate for the bottom clipping plane.top
- the coordinate for the top clipping plane.znear
- the distance to the near depth clipping planezfar
- the distance to the far depth clipping planepublic Matrix44 setFrustum(double left, double right, double bottom, double top, double znear, double zfar)
left
- the coordinate for the left clipping plane.right
- the coordinate for the right clipping plane.bottom
- the coordinate for the bottom clipping plane.top
- the coordinate for the top clipping plane.znear
- the distance to the near depth clipping planezfar
- the distance to the far depth clipping planepublic Matrix44 setPerspective(double fovy, double aspect, double znear, double zfar)
fovy
- the field of view, in degrees, in the vertical direction.aspect
- the aspect ratio width/height.znear
- the distance to the near depth clipping planezfar
- the distance to the far depth clipping planepublic java.lang.String toString()
toString
in class java.lang.Object