public final class Mat4x4 extends java.lang.Object implements IValueCopy<Mat4x4>
| Modifier and Type | Field and Description |
|---|---|
static Mat4x4 |
IDENTITY
Don't modify the value.
|
float[] |
m
Matrix elements, in OpenGL ordering
|
| Constructor and Description |
|---|
Mat4x4()
A matrix with all elements of 0.
|
Mat4x4(float... m) |
| Modifier and Type | Method and Description |
|---|---|
Mat4x4 |
abs3x3() |
static Mat4x4[] |
allocate(int num) |
Mat4x4 |
clone() |
float |
determinant() |
float |
determinant3x3() |
float |
distance(Mat4x4 m) |
boolean |
equals(java.lang.Object obj) |
Vec3 |
getAnglesXYZ(Vec3 dst)
Convert this matrix into angles ordered: x, y, z
Reference: http://jeux.developpez.com/faq/matquat/? |
Vec3 |
getAnglesZYX(Vec3 dst)
Convert this matrix into angles ordered: z, y, x
Reference: http://jeux.developpez.com/faq/matquat/? |
Vec3 |
getAxisX(Vec3 dst) |
Vec3 |
getAxisY(Vec3 dst) |
Vec3 |
getAxisZ(Vec3 dst) |
Vec3 |
getLookAtForward(Vec3 dst) |
Vec3 |
getLookAtLeft(Vec3 dst) |
Vec3 |
getLookAtPosition(Vec3 dst) |
Quat |
getLookAtRotation(Quat dst) |
Vec3 |
getLookAtUp(Vec3 dst) |
float |
getPerspectiveFar() |
float |
getPerspectiveNear() |
void |
getRotationAndScale(Quat q,
Vec3 scale)
WARNING: This is not a general way to convert a matrix into a quaternion !
|
Vec3 |
getScale(Vec3 dst) |
Vec3 |
getScale3x3(Vec3 dst) |
Vec3 |
getTranslationLocal(Vec3 dst) |
Vec3 |
getTranslationWorld(Vec3 dst) |
int |
hashCode() |
static Mat4x4 |
identity() |
Mat4x4 |
inverse(Mat4x4 src)
Inverse the source matric in this
|
Mat4x4 |
inverse3x3(Mat4x4 src)
Inverse the 3x3 block of the source matrix in this
|
Mat4x4 |
inverseTranspose(Mat4x4 src)
Inverse and transpose the source matrix in this
|
boolean |
isIdentity() |
Mat4x4 |
lookAt(float eyeX,
float eyeY,
float eyeZ,
float refX,
float refY,
float refZ,
float upX,
float upY,
float upZ)
Create a look at matrix, and store in this matrix
|
Mat4x4 |
lookAt(Quat q,
Vec3 position)
Create a look at matrix, and store in this matrix
|
Mat4x4 |
lookAt(Vec3 eye,
Vec3 ref,
Vec3 up)
Create a look at matrix, and store in this matrix
|
Mat4x4 |
lookAt(Vec3 left,
Vec3 up,
Vec3 forward,
Vec3 position)
Create a look at matrix, and store in this matrix
|
Mat4x4 |
multiply(Mat4x4 mat1,
Mat4x4 mat2)
Multiply two matrices and store the result in
this matrix. |
static Mat4x4 |
multiply(Mat4x4 dst,
Mat4x4 m1,
Mat4x4 m2) |
Vec3 |
multiply(Vec3 dst,
Vec3 src)
Multiply (rotate and translate) a vector by this matrix.
|
Vec4 |
multiply(Vec4 dst,
Vec4 src)
Multiply (rotate and translate) a vector by this matrix.
|
Mat4x4 |
multiply3x3(Mat4x4 mat1,
Mat4x4 mat2)
Multiply the 3x3 block of two matrices and store the result into the 3x3 block of
this matrix. |
Mat4x4 |
multiply3x4(Mat4x4 mat1,
Mat4x4 mat2)
Multiply the 3x4 block of two matrices and store the result in
this matrix. |
Vec3 |
multiplyDivW(Vec3 dst,
Vec3 src)
Multiply a vector by this matrix, with perspective correction.
|
Vec3 |
multiplyInverseLookAt(Vec3 dst,
Vec3 src)
Equivalent: new Mat4x4().inverse(this).multiply(dst, src)
Only valid if this is a lookAt matrix |
Mat4x4 |
multiplyProjectionModelview(Mat4x4 proj,
Mat4x4 view)
A fast perspective * modelview multiplication (support Lengyel mperspective matrix).
|
Vec4 |
multiplyTransposed(Vec4 dst,
Vec4 src)
Multiply (rotate and translate) a vector by the transpose of this matrix.
|
void |
obliqueClipPlane(Mat4x4 proj,
Mat4x4 view,
Plane clipPlane)
References:
[1] http://www.nvidia.fr/object/oblique_frustum_clipping.html [2] Modifying the Projection Matrix to Perform Oblique Near-Plane Clipping (Lengyel’s Frustum) http://www.terathon.com/code/oblique.html Lengyel, Eric. |
Mat4x4 |
rotate(Quat q)
Multiply the 3x3 matrix block o this matrix with the specified quaternion.
|
Mat4x4 |
scale(Vec3 scale)
Scale the 4x3 block of this matrix.
|
Mat4x4 |
scale3x3(Vec3 scale)
Scale the 3x3 block of this matrix.
|
Mat4x4 |
set(Mat4x4 src) |
Mat4x4 |
set3x3(Mat4x4 src) |
Mat4x4 |
setAnglesXYZ(float angleXInRadians,
float angleYInRadians,
float angleZInRadians)
Create a matrix from angles, as defined by the order: x, y, z
This method is equivalent to (code has been optimized): final Mat4x4 m_ = new Mat4x4(); setIdentity3x3(); multiply3x3(this, m_.setXRotation(angleXInRadians)); multiply3x3(this, m_.setYRotation(angleYInRadians)); multiply3x3(this, m_.setZRotation(angleZInRadians)); |
Mat4x4 |
setAnglesZYX(float angleXInRadians,
float angleYInRadians,
float angleZInRadians)
Create a matrix from angles, as defined by the order: z, y, x
This method is equivalent to (code has been optimized): final Mat4x4 m_ = new Mat4x4(); setIdentity3x3(); multiply3x3(this, m_.setZRotation(angleZInRadians)); multiply3x3(this, m_.setYRotation(angleYInRadians)); multiply3x3(this, m_.setXRotation(angleXInRadians)); |
Mat4x4 |
setAxisAngle(Vec3 axis,
float angleInRadians)
Set 3x3 matrix block to represent the specified rotation.
|
Mat4x4 |
setFrustumProjection(float left,
float right,
float bottom,
float top,
float zNear,
float zFar)
Set this matrix as a frustum matrix
|
Mat4x4 |
setIdentity()
Set this matrix as the identity matrix
|
Mat4x4 |
setIdentity3x3()
Set this matrix as the identity matrix
|
Mat4x4 |
setOrthographicProjection(float left,
float right,
float bottom,
float top,
float near,
float far)
Set this matrix as an orthographic matrix
|
Mat4x4 |
setPerspectiveProjection(float fovYInDegrees,
float aspect,
float zNear,
float zFar)
Set this matrix as a perspective matrix
|
Mat4x4 |
setPickMatrix(float x,
float y,
float width,
float height,
Viewport viewport)
Create a matrix equivalent to gluPickMatrix
|
Mat4x4 |
setRotation(Quat q)
Set 3x3 matrix block to represent the specified rotation.
|
Mat4x4 |
setRotation(Vec3 axisX,
Vec3 axisY,
Vec3 axisZ)
Set 3x3 matrix block to represent the specified rotation.
|
Mat4x4 |
setRotationX(float angleInRadians)
Set 3x3 matrix block to represent the specified rotation.
|
Mat4x4 |
setRotationY(float angleInRadians)
Set 3x3 matrix block to represent the specified rotation.
|
Mat4x4 |
setRotationZ(float angleInRadians)
Set 3x3 matrix block to represent the specified rotation.
|
Mat4x4 |
setTranslationWorld(Vec3 translate) |
java.lang.String |
toString() |
float |
trace() |
float |
trace3x3() |
Vec3 |
transform(Vec3 dst,
Vec3 src)
Transform (rotate) a vector by this matrix.
|
Vec3 |
transformInverseLookAt(Vec3 dst,
Vec3 src)
Equivalent: new Mat4x4().inverse(this).transform(dst, src)
Only valid if this is a lookAt matrix |
Vec3 |
transformTransposed(Vec3 dst,
Vec3 src)
Transform (rotate) a vector by this matrix transposed.
|
Mat4x4 |
translateLocal(Vec3 translate) |
Mat4x4 |
translateWorld(Vec3 translate) |
Mat4x4 |
transpose()
Transpose this matrix
This is an optimized version of #transpose(Mat4x4),
in the case of the source and destination matrix are identical |
Mat4x4 |
transpose(Mat4x4 src)
Transpose the
src matrix into this matrix. |
Mat4x4 |
transpose3x3()
Transpose the 3x3 block of this matrix.
|
Mat4x4 |
transpose3x3(Mat4x4 src)
Transpose the 3x3 block of the specified matrix into this
|
Mat4x4 |
unscale()
Unscale the 4x3 block of this matrix.
|
Mat4x4 |
unscale3x3()
Unscale the 3x3 block of this matrix.
|
public static final Mat4x4 IDENTITY
public final float[] m
public Mat4x4()
identity()public Mat4x4(float... m)
throws java.lang.IllegalArgumentException
m - a float[16]IllegalArgumentException, - when array is null or length is not 16java.lang.IllegalArgumentExceptionpublic static final Mat4x4 identity()
public static final Mat4x4[] allocate(int num)
public final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Objectpublic final java.lang.String toString()
toString in class java.lang.Objectpublic final Mat4x4 clone()
clone in interface IValueCopy<Mat4x4>clone in class java.lang.Objectpublic final boolean isIdentity()
public final float distance(Mat4x4 m)
public final Mat4x4 set(Mat4x4 src)
set in interface IValueCopy<Mat4x4>src - source matrix to copy to this matrixpublic final Mat4x4 set3x3(Mat4x4 src)
src - source matrix to copy to this matrixpublic final Mat4x4 setIdentity()
public final Mat4x4 setIdentity3x3()
public final Mat4x4 abs3x3()
public final Mat4x4 translateLocal(Vec3 translate)
translate - local translation vectorpublic final Vec3 getTranslationLocal(Vec3 dst)
dst - destination vector to store the local translation.public final Mat4x4 translateWorld(Vec3 translate)
translate - world translation vectorpublic final Mat4x4 setTranslationWorld(Vec3 translate)
translate - world translation vectorpublic final Vec3 getTranslationWorld(Vec3 dst)
dst - destination vector to store the world translationpublic final Mat4x4 setAxisAngle(Vec3 axis, float angleInRadians)
angleInRadians - angle in radianspublic final Mat4x4 setRotation(Vec3 axisX, Vec3 axisY, Vec3 axisZ)
axisX - x axis. If not normalized, the magnitude of the vector will be the scale along x.axisY - y axis. If not normalized, the magnitude of the vector will be the scale along y.axisZ - z axis. If not normalized, the magnitude of the vector will be the scale along z.public final Mat4x4 setRotationX(float angleInRadians)
angleInRadians - x rotation angle in radianspublic final Mat4x4 setRotationY(float angleInRadians)
angleInRadians - y rotation angle in radianspublic final Mat4x4 setRotationZ(float angleInRadians)
angleInRadians - z rotation angle in radianspublic final Mat4x4 setRotation(Quat q)
q - a quaternion defining the rotationQuat.getMatrix3x3(Mat4x4)public final Mat4x4 rotate(Quat q)
q - a quaternion defining a rotation matrixpublic final void getRotationAndScale(Quat q, Vec3 scale)
Transform representation.q - destination to store the rotation of this matrixscale - destination to store the scale of this matrixTransform.getMatrix(Mat4x4)public final Vec3 getAxisX(Vec3 dst)
dst - destination vector to store the axis x.public final Vec3 getAxisY(Vec3 dst)
dst - destination vector to store the axis y.public final Vec3 getAxisZ(Vec3 dst)
dst - destination vector to store the axis z.public final Mat4x4 setAnglesXYZ(float angleXInRadians, float angleYInRadians, float angleZInRadians)
final Mat4x4 m_ = new Mat4x4(); setIdentity3x3(); multiply3x3(this, m_.setXRotation(angleXInRadians)); multiply3x3(this, m_.setYRotation(angleYInRadians)); multiply3x3(this, m_.setZRotation(angleZInRadians));
angleXInRadians - rotation around x, in radiansangleYInRadians - rotation around y, in radiansangleZInRadians - rotation around z, in radianspublic final Mat4x4 setAnglesZYX(float angleXInRadians, float angleYInRadians, float angleZInRadians)
final Mat4x4 m_ = new Mat4x4(); setIdentity3x3(); multiply3x3(this, m_.setZRotation(angleZInRadians)); multiply3x3(this, m_.setYRotation(angleYInRadians)); multiply3x3(this, m_.setXRotation(angleXInRadians));
angleXInRadians - rotation around x, in radiansangleYInRadians - rotation around y, in radiansangleZInRadians - rotation around z, in radianspublic final Vec3 getAnglesXYZ(Vec3 dst)
dst - destination vector to store the angles in radians (angleX, angleY, angleZ)public final Vec3 getAnglesZYX(Vec3 dst)
dst - destination vector to store the angles in radians (angleX, angleY, angleZ)public final Mat4x4 scale(Vec3 scale)
#scale3x3(Vector3f) scale - a scale vector defining teh scale along x, y and z axis.scale3x3(Vec3)public final Mat4x4 scale3x3(Vec3 scale)
scale - a scale vector defining the scale along x, y and z axis.public final Vec3 getScale(Vec3 dst)
dst - destination vector to store the (positive) scale of this matrixgetRotationAndScale(Quat, Vec3),
Transformpublic final Vec3 getScale3x3(Vec3 dst)
dst - destination vector to store the (positive) scale of the 3x3 block of this matrixgetRotationAndScale(Quat, Vec3),
Transformpublic final Mat4x4 unscale()
#unscale3x3() unscale3x3()public final Mat4x4 unscale3x3()
#unscale3x3() unscale3x3()public final Mat4x4 multiplyProjectionModelview(Mat4x4 proj, Mat4x4 view)
#multiply(Mat4x4, Mat4x4), but faster.proj - a perspective projection matrix.view - a modelview matrix.multiply(Mat4x4, Mat4x4)public final Mat4x4 multiply(Mat4x4 mat1, Mat4x4 mat2)
this matrix.mat1 - first matrix, can be this or mat2.mat2 - second matrix, can be this or mat1.public final Mat4x4 multiply3x4(Mat4x4 mat1, Mat4x4 mat2)
this matrix.#multiply(Mat4x4, Mat4x4) ,
given that the last row of the matrices is (0, 0, 0, 1).mat1 - first matrix, can be this or mat2.mat2 - second matrix, can be this or mat1.public final Mat4x4 multiply3x3(Mat4x4 mat1, Mat4x4 mat2)
this matrix.mat1 - first matrix, can be this or mat2.mat2 - second matrix, can be this or mat1.public final Mat4x4 lookAt(float eyeX, float eyeY, float eyeZ, float refX, float refY, float refZ, float upX, float upY, float upZ)
eyeX - eye position, x componenteyeY - eye position, y componenteyeZ - eye position, z componentrefX - look at point, x componentrefY - look at point, y componentrefZ - look at point, z componentupX - up direction, x componentupY - up direction, y componentupZ - up direction, z componentpublic final Mat4x4 lookAt(Vec3 eye, Vec3 ref, Vec3 up)
eye - eye positionref - look at pointup - up directionpublic final Mat4x4 lookAt(Vec3 left, Vec3 up, Vec3 forward, Vec3 position)
left - left normalized vectorup - up normalized vectorforward - forward normalized vectorposition - eye view point/positionpublic final Mat4x4 lookAt(Quat q, Vec3 position)
q - a quaternion defining the left/up/forward vectorsposition - eye positionpublic final Vec3 getLookAtLeft(Vec3 dst)
dst - destination vector to store the left vector of this look at matrixpublic final Vec3 getLookAtUp(Vec3 dst)
dst - destination vector to store the up vector of this look at matrixpublic final Vec3 getLookAtForward(Vec3 dst)
dst - destination vector to store the forward vector of this look at matrixpublic final Vec3 getLookAtPosition(Vec3 dst)
dst - destination vector to store the eye position vector of this look at matrixpublic final Quat getLookAtRotation(Quat dst)
dst - destination quaternion to store the orientation (left/forward/up vectors) of this look at matrix.public final Vec3 multiply(Vec3 dst, Vec3 src)
src - source vectordst - destination vector to store the resultpublic final Vec4 multiply(Vec4 dst, Vec4 src)
src - source vectordst - destination vector to store the resultpublic final Vec4 multiplyTransposed(Vec4 dst, Vec4 src)
src - source vectordst - destination vector to store the resultpublic Vec3 multiplyInverseLookAt(Vec3 dst, Vec3 src)
public final Vec3 multiplyDivW(Vec3 dst, Vec3 src)
src - source vectordst - destination vector to store the resultpublic final Vec3 transform(Vec3 dst, Vec3 src)
src - source vectordst - destination vector to store the resultpublic final Vec3 transformTransposed(Vec3 dst, Vec3 src)
src - source vectordst - destination vector to store the resultpublic Vec3 transformInverseLookAt(Vec3 dst, Vec3 src)
public final Mat4x4 transpose3x3(Mat4x4 src)
src - source matrix to transposepublic final Mat4x4 transpose3x3()
#transpose3x3(Mat4x4),
in the case of the source and destination matrix are identicaltranspose3x3(Mat4x4)public final Mat4x4 transpose(Mat4x4 src)
src matrix into this matrix.src - matrix to transpose in thissrc transposedpublic final Mat4x4 transpose()
#transpose(Mat4x4),
in the case of the source and destination matrix are identicaltranspose(Mat4x4)public final float trace()
public final float trace3x3()
public final float determinant()
public final float determinant3x3()
public final Mat4x4 inverse(Mat4x4 src)
src - source matrix to inversejava.lang.IllegalArgumentException - if determinant of src matrix is 0public final Mat4x4 inverse3x3(Mat4x4 src)
src - source matrix to inversejava.lang.IllegalArgumentException - if determinant of src matrix is 0public final Mat4x4 inverseTranspose(Mat4x4 src)
src - source matrix to inverse and transposejava.lang.IllegalArgumentException - if determinant of src matrix is 0public final Mat4x4 setFrustumProjection(float left, float right, float bottom, float top, float zNear, float zFar)
left - right - bottom - top - zNear - zFar - public final Mat4x4 setPerspectiveProjection(float fovYInDegrees, float aspect, float zNear, float zFar)
fovYInDegrees - fov Y angle in degreeaspect - zNear - zFar - public void obliqueClipPlane(Mat4x4 proj, Mat4x4 view, Plane clipPlane)
proj - view - public final float getPerspectiveNear()
Mat4x4 must be a perspective matrix as defined by OpenGL.setPerspectiveProjection(float, float, float, float)public final float getPerspectiveFar()
Mat4x4 must be a perspective matrix as defined by OpenGL.setPerspectiveProjection(float, float, float, float)public final Mat4x4 setOrthographicProjection(float left, float right, float bottom, float top, float near, float far)
left - right - bottom - top - near - far - Bonzai Engine 1.4.1-20200831 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2019 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com