JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.test.junit.math.Matrix4fb Class Reference

Basic 4x4 float matrix implementation using fields for intensive use-cases (host operations). More...

Collaboration diagram for com.jogamp.opengl.test.junit.math.Matrix4fb:

Public Member Functions

 Matrix4fb ()
 Creates a new identity matrix. More...
 
 Matrix4fb (final Matrix4fb src)
 Creates a new matrix copying the values of the given src matrix. More...
 
 Matrix4fb (final float[] m)
 Creates a new matrix based on given float[4*4] column major order. More...
 
 Matrix4fb (final float[] m, final int m_off)
 Creates a new matrix based on given float[4*4] column major order. More...
 
final Matrix4fb loadIdentity ()
 Set this matrix to identity. More...
 
Matrix4fb load (final Matrix4fb src)
 Load the values of the given matrix b to this matrix. More...
 
Matrix4fb load (final float[] src)
 Load the values of the given matrix src to this matrix. More...
 
Matrix4fb load (final float[] src, final int src_off)
 Load the values of the given matrix src to this matrix. More...
 
Matrix4fb load (final FloatBuffer src)
 Load the values of the given matrix src to this matrix. More...
 
float get (final int i)
 Gets the ith component, 0 <= i < 16. More...
 
Vec4f getColumn (final int column, final Vec4f v_out)
 Get the named column of the given column-major matrix to v_out. More...
 
Vec3f getColumn (final int column, final Vec3f v_out)
 Get the named column of the given column-major matrix to v_out. More...
 
Vec4f getRow (final int row, final Vec4f v_out)
 Get the named row of the given column-major matrix to v_out. More...
 
Vec3f getRow (final int row, final Vec3f v_out)
 Get the named row of the given column-major matrix to v_out. More...
 
float[] get (final float[] dst, final int dst_off)
 Get this matrix into the given float[16] array at dst_off in column major order. More...
 
float[] get (final float[] dst)
 Get this matrix into the given float[16] array in column major order. More...
 
FloatBuffer get (final FloatBuffer dst)
 Get this matrix into the given FloatBuffer in column major order. More...
 
float determinant ()
 Returns the determinant of this matrix. More...
 
final Matrix4fb transpose ()
 Transpose this matrix. More...
 
final Matrix4fb transpose (final Matrix4fb src)
 Transpose the given src matrix into this matrix. More...
 
boolean invert ()
 Invert this matrix. More...
 
boolean invert (final Matrix4fb src)
 Invert the src matrix values into this matrix. More...
 
final Matrix4fb mul (final Matrix4fb b)
 Multiply matrix: [this] = [this] x [b]. More...
 
final Matrix4fb mul (final Matrix4fb a, final Matrix4fb b)
 Multiply matrix: [this] = [a] x [b]. More...
 
final float[] mulVec4f (final float[] v_in, final float[] v_out)
 
final Vec4f mulVec4f (final Vec4f v_in, final Vec4f v_out)
 
final float[] mulVec3f (final float[] v_in, final float[] v_out)
 Affine 3f-vector transformation by 4x4 matrix. More...
 
final Vec3f mulVec3f (final Vec3f v_in, final Vec3f v_out)
 Affine 3f-vector transformation by 4x4 matrix. More...
 
final Matrix4fb setToTranslation (final float x, final float y, final float z)
 Set this matrix to translation. More...
 
final Matrix4fb setToTranslation (final Vec3f t)
 Set this matrix to translation. More...
 
final Matrix4fb setToScale (final float x, final float y, final float z)
 Set this matrix to scale. More...
 
final Matrix4fb setToRotationAxis (final float ang_rad, float x, float y, float z)
 Set this matrix to rotation from the given axis and angle in radians. More...
 
final Matrix4fb setToRotationAxis (final float ang_rad, final Vec3f axis)
 Set this matrix to rotation from the given axis and angle in radians. More...
 
Matrix4fb setToRotationEuler (final float bankX, final float headingY, final float attitudeZ)
 Set this matrix to rotation from the given Euler rotation angles in radians. More...
 
final Matrix4fb setToRotation (final Quaternion q)
 Set this matrix to rotation using the given Quaternion. More...
 
final Quaternion getRotation (final Quaternion res)
 Returns the rotation [m[0+0*4] . More...
 
Matrix4fb setToOrtho (final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
 Set this matrix to orthogonal projection. More...
 
Matrix4fb setToFrustum (final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws IllegalArgumentException
 Set this matrix to frustum. More...
 
Matrix4fb setToPerspective (final float fovy_rad, final float aspect, final float zNear, final float zFar) throws IllegalArgumentException
 Set this matrix to perspective frustum projection. More...
 
Matrix4fb setToPerspective (final FovHVHalves fovhv, final float zNear, final float zFar) throws IllegalArgumentException
 Set this matrix to perspective frustum projection. More...
 
void updateFrustumPlanes (final Frustum frustum)
 Calculate the frustum planes in world coordinates using the passed float[16] as premultiplied P*MV (column major order). More...
 
Matrix4fb setToLookAt (final Vec3f eye, final Vec3f center, final Vec3f up, final Matrix4fb tmp)
 Make given matrix the look-at matrix based on given parameters. More...
 
final Matrix4fb rotate (final float ang_rad, final float x, final float y, final float z, final Matrix4fb tmp)
 Rotate this matrix about give axis and angle in radians, i.e. More...
 
final Matrix4fb rotate (final float ang_rad, final Vec3f axis, final Matrix4fb tmp)
 Rotate this matrix about give axis and angle in radians, i.e. More...
 
final Matrix4fb rotate (final Quaternion quat, final Matrix4fb tmp)
 Rotate this matrix with the given Quaternion, i.e. More...
 
final Matrix4fb translate (final float x, final float y, final float z, final Matrix4fb tmp)
 Translate this matrix, i.e. More...
 
final Matrix4fb translate (final Vec3f t, final Matrix4fb tmp)
 Translate this matrix, i.e. More...
 
final Matrix4fb scale (final float x, final float y, final float z, final Matrix4fb tmp)
 Scale this matrix, i.e. More...
 
final Matrix4fb scale (final float s, final Matrix4fb tmp)
 Scale this matrix, i.e. More...
 
final void push ()
 Push the matrix to it's stack, while preserving this matrix values. More...
 
final void pop ()
 Pop the current matrix from it's stack, replacing this matrix values. More...
 
boolean isEqual (final Matrix4fb o, final float epsilon)
 Equals check using a given FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float). More...
 
boolean isEqual (final Matrix4fb o)
 Equals check using FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float). More...
 
boolean equals (final Object o)
 
StringBuilder toString (final StringBuilder sb, final String rowPrefix, final String f)
 
String toString ()
 

Static Public Member Functions

static boolean mapObjToWin (final Vec3f obj, final Matrix4fb mMv, final Matrix4fb mP, final int[] viewport, final float[] winPos)
 Map object coordinates to window coordinates. More...
 
static boolean mapObjToWin (final Vec3f obj, final Matrix4fb mPMv, final int[] viewport, final float[] winPos)
 Map object coordinates to window coordinates. More...
 
static boolean mapWinToObj (final float winx, final float winy, final float winz, final Matrix4fb mMv, final Matrix4fb mP, final int[] viewport, final Vec3f objPos, final Matrix4fb mat4Tmp)
 Map window coordinates to object coordinates. More...
 
static boolean mapWinToObj (final float winx, final float winy, final float winz, final Matrix4fb invPMv, final int[] viewport, final Vec3f objPos, final Matrix4fb mat4Tmp)
 Map window coordinates to object coordinates. More...
 
static boolean mapWinToObj (final float winx, final float winy, final float winz1, final float winz2, final Matrix4fb invPMv, final int[] viewport, final Vec3f objPos1, final Vec3f objPos2, final Matrix4fb mat4Tmp)
 Map two window coordinates to two object coordinates, distinguished by their z component. More...
 
static boolean mapWinToObj4 (final float winx, final float winy, final float winz, final float clipw, final Matrix4fb mMv, final Matrix4fb mP, final int[] viewport, final float near, final float far, final Vec4f objPos, final Matrix4fb mat4Tmp)
 Map window coordinates to object coordinates. More...
 
static boolean mapWinToRay (final float winx, final float winy, final float winz0, final float winz1, final Matrix4fb mMv, final Matrix4fb mP, final int[] viewport, final Ray ray, final Matrix4fb mat4Tmp1, final Matrix4fb mat4Tmp2)
 Map two window coordinates w/ shared X/Y and distinctive Z to a Ray. More...
 

Detailed Description

Basic 4x4 float matrix implementation using fields for intensive use-cases (host operations).

Implementation covers FloatUtil matrix functionality, exposed in an object oriented manner.

Unlike PMVMatrix, this class only represents one single matrix without a complete GLMatrixFunc implementation.

For array operations the layout is expected in column-major order matching OpenGL's implementation, illustration:

 Row-Major                       Column-Major (OpenGL):

     |  0   1   2  tx |
     |                |
     |  4   5   6  ty |
 M = |                |
     |  8   9  10  tz |
     |                |
     | 12  13  14  15 |

        R   C                      R   C
      m[0*4+3] = tx;             m[0+4*3] = tx;
      m[1*4+3] = ty;             m[1+4*3] = ty;
      m[2*4+3] = tz;             m[2+4*3] = tz;

       RC (std subscript order)   RC (std subscript order)
      m[0+3*4] = tx;                  m[0+3*4] = tx;
      m[1+3*4] = ty;                  m[1+3*4] = ty;
      m[2+3*4] = tz;                  m[2+3*4] = tz;

Implementation utilizes unrolling of small vertices and matrices wherever possible while trying to access memory in a linear fashion for performance reasons, see:

See also
com.jogamp.opengl.util.PMVMatrix
FloatUtil

Definition at line 97 of file Matrix4fb.java.

Constructor & Destructor Documentation

◆ Matrix4fb() [1/4]

com.jogamp.opengl.test.junit.math.Matrix4fb.Matrix4fb ( )

Creates a new identity matrix.

Definition at line 102 of file Matrix4fb.java.

Here is the call graph for this function:

◆ Matrix4fb() [2/4]

com.jogamp.opengl.test.junit.math.Matrix4fb.Matrix4fb ( final Matrix4fb  src)

Creates a new matrix copying the values of the given src matrix.

Definition at line 109 of file Matrix4fb.java.

Here is the call graph for this function:

◆ Matrix4fb() [3/4]

com.jogamp.opengl.test.junit.math.Matrix4fb.Matrix4fb ( final float[]  m)

Creates a new matrix based on given float[4*4] column major order.

Parameters
m4x4 matrix in column-major order

Definition at line 117 of file Matrix4fb.java.

Here is the call graph for this function:

◆ Matrix4fb() [4/4]

com.jogamp.opengl.test.junit.math.Matrix4fb.Matrix4fb ( final float[]  m,
final int  m_off 
)

Creates a new matrix based on given float[4*4] column major order.

Parameters
m4x4 matrix in column-major order
m_offoffset for matrix m

Definition at line 126 of file Matrix4fb.java.

Here is the call graph for this function:

Member Function Documentation

◆ determinant()

float com.jogamp.opengl.test.junit.math.Matrix4fb.determinant ( )

Returns the determinant of this matrix.

Returns
the matrix determinant

Definition at line 308 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ equals()

boolean com.jogamp.opengl.test.junit.math.Matrix4fb.equals ( final Object  o)

Definition at line 1475 of file Matrix4fb.java.

Here is the call graph for this function:

◆ get() [1/4]

float[] com.jogamp.opengl.test.junit.math.Matrix4fb.get ( final float[]  dst)

Get this matrix into the given float[16] array in column major order.

Parameters
dstfloat[16] array storage in column major order
Returns
dst for chaining

Definition at line 280 of file Matrix4fb.java.

◆ get() [2/4]

float[] com.jogamp.opengl.test.junit.math.Matrix4fb.get ( final float[]  dst,
final int  dst_off 
)

Get this matrix into the given float[16] array at dst_off in column major order.

Parameters
dstfloat[16] array storage in column major order
dst_offoffset
Returns
dst for chaining

Definition at line 269 of file Matrix4fb.java.

◆ get() [3/4]

FloatBuffer com.jogamp.opengl.test.junit.math.Matrix4fb.get ( final FloatBuffer  dst)

Get this matrix into the given FloatBuffer in column major order.

Implementation uses relative FloatBuffer#put(float), hence caller may want to issue FloatBuffer#reset() thereafter.

Parameters
dstFloatBuffer array storage in column major order
Returns
dst for chaining

Definition at line 295 of file Matrix4fb.java.

◆ get() [4/4]

float com.jogamp.opengl.test.junit.math.Matrix4fb.get ( final int  i)

Gets the ith component, 0 <= i < 16.

Definition at line 204 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ getColumn() [1/2]

Vec3f com.jogamp.opengl.test.junit.math.Matrix4fb.getColumn ( final int  column,
final Vec3f  v_out 
)

Get the named column of the given column-major matrix to v_out.

Parameters
columnnamed column to copy
v_outthe column-vector storage
Returns
given result vector v_out for chaining

Definition at line 228 of file Matrix4fb.java.

Here is the call graph for this function:

◆ getColumn() [2/2]

Vec4f com.jogamp.opengl.test.junit.math.Matrix4fb.getColumn ( final int  column,
final Vec4f  v_out 
)

Get the named column of the given column-major matrix to v_out.

Parameters
columnnamed column to copy
v_outthe column-vector storage
Returns
given result vector v_out for chaining

Definition at line 214 of file Matrix4fb.java.

Here is the call graph for this function:

◆ getRotation()

final Quaternion com.jogamp.opengl.test.junit.math.Matrix4fb.getRotation ( final Quaternion  res)

Returns the rotation [m[0+0*4] .

. m[2+2*4]] fields converted to a Quaternion.

Parameters
resresulting Quaternion
Returns
the resulting Quaternion for chaining.
See also
Quaternion::setFromMat(float, float, float, float, float, float, float, float, float)
setToRotation(Quaternion)

Definition at line 1038 of file Matrix4fb.java.

Here is the call graph for this function:

◆ getRow() [1/2]

Vec3f com.jogamp.opengl.test.junit.math.Matrix4fb.getRow ( final int  row,
final Vec3f  v_out 
)

Get the named row of the given column-major matrix to v_out.

Parameters
rownamed row to copy
v_outthe row-vector storage
Returns
given result vector v_out for chaining

Definition at line 255 of file Matrix4fb.java.

Here is the call graph for this function:

◆ getRow() [2/2]

Vec4f com.jogamp.opengl.test.junit.math.Matrix4fb.getRow ( final int  row,
final Vec4f  v_out 
)

Get the named row of the given column-major matrix to v_out.

Parameters
rownamed row to copy
v_outthe row-vector storage
Returns
given result vector v_out for chaining

Definition at line 241 of file Matrix4fb.java.

Here is the call graph for this function:

◆ invert() [1/2]

boolean com.jogamp.opengl.test.junit.math.Matrix4fb.invert ( )

Invert this matrix.

Returns
false if this matrix is singular and inversion not possible, otherwise true

Definition at line 388 of file Matrix4fb.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invert() [2/2]

boolean com.jogamp.opengl.test.junit.math.Matrix4fb.invert ( final Matrix4fb  src)

Invert the src matrix values into this matrix.

Parameters
srcthe source matrix, which values are to be inverted
Returns
false if src matrix is singular and inversion not possible, otherwise true

Definition at line 476 of file Matrix4fb.java.

Here is the call graph for this function:

◆ isEqual() [1/2]

boolean com.jogamp.opengl.test.junit.math.Matrix4fb.isEqual ( final Matrix4fb  o)

Equals check using FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float).

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Parameters
ocomparison value
Returns
true if all components differ less than FloatUtil#EPSILON, otherwise false.

Definition at line 1470 of file Matrix4fb.java.

Here is the call graph for this function:

◆ isEqual() [2/2]

boolean com.jogamp.opengl.test.junit.math.Matrix4fb.isEqual ( final Matrix4fb  o,
final float  epsilon 
)

Equals check using a given FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float).

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Parameters
ocomparison value
epsilonconsider using FloatUtil#EPSILON
Returns
true if all components differ less than epsilon, otherwise false.

Definition at line 1445 of file Matrix4fb.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load() [1/4]

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.load ( final float[]  src)

Load the values of the given matrix src to this matrix.

Parameters
src4x4 matrix float[16] in column-major order
Returns
this matrix for chaining

Definition at line 169 of file Matrix4fb.java.

◆ load() [2/4]

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.load ( final float[]  src,
final int  src_off 
)

Load the values of the given matrix src to this matrix.

Parameters
src4x4 matrix float[16] in column-major order
src_offoffset for matrix src
Returns
this matrix for chaining

Definition at line 180 of file Matrix4fb.java.

◆ load() [3/4]

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.load ( final FloatBuffer  src)

Load the values of the given matrix src to this matrix.

Implementation uses relative FloatBuffer#get(), hence caller may want to issue FloatBuffer#reset() thereafter.

Parameters
src4x4 matrix FloatBuffer in column-major order
Returns
this matrix for chaining

Definition at line 194 of file Matrix4fb.java.

Here is the call graph for this function:

◆ load() [4/4]

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.load ( final Matrix4fb  src)

Load the values of the given matrix b to this matrix.

Parameters
srcthe source values
Returns
this matrix for chaining

Definition at line 159 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ loadIdentity()

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.loadIdentity ( )

Set this matrix to identity.

Translation matrix (Column Order):
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
 
Returns
this matrix for chaining

Definition at line 145 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ mapObjToWin() [1/2]

static boolean com.jogamp.opengl.test.junit.math.Matrix4fb.mapObjToWin ( final Vec3f  obj,
final Matrix4fb  mMv,
final Matrix4fb  mP,
final int[]  viewport,
final float[]  winPos 
)
static

Map object coordinates to window coordinates.

Traditional gluProject implementation.

Parameters
objobject position, 3 component vector
mMvmodelview matrix
mPprojection matrix
viewport4 component viewport vector
winPos3 component window coordinate, the result
Returns
true if successful, otherwise false (z is 1)

Definition at line 1500 of file Matrix4fb.java.

Here is the call graph for this function:

◆ mapObjToWin() [2/2]

static boolean com.jogamp.opengl.test.junit.math.Matrix4fb.mapObjToWin ( final Vec3f  obj,
final Matrix4fb  mPMv,
final int[]  viewport,
final float[]  winPos 
)
static

Map object coordinates to window coordinates.

Traditional gluProject implementation.

Parameters
objobject position, 3 component vector
mPMv[projection] x [modelview] matrix, i.e. P x Mv
viewport4 component viewport vector
winPos3 component window coordinate, the result
Returns
true if successful, otherwise false (z is 1)

Definition at line 1541 of file Matrix4fb.java.

Here is the call graph for this function:

◆ mapWinToObj() [1/3]

static boolean com.jogamp.opengl.test.junit.math.Matrix4fb.mapWinToObj ( final float  winx,
final float  winy,
final float  winz,
final Matrix4fb  invPMv,
final int[]  viewport,
final Vec3f  objPos,
final Matrix4fb  mat4Tmp 
)
static

Map window coordinates to object coordinates.

Traditional gluUnProject implementation.

Parameters
winx
winy
winz
invPMvinverse [projection] x [modelview] matrix, i.e. Inv(P x Mv)
viewport4 component viewport vector
objPos3 component object coordinate, the result
mat4Tmp16 component matrix for temp storage
Returns
true if successful, otherwise false (failed to invert matrix, or becomes infinity due to zero z)

Definition at line 1628 of file Matrix4fb.java.

Here is the call graph for this function:

◆ mapWinToObj() [2/3]

static boolean com.jogamp.opengl.test.junit.math.Matrix4fb.mapWinToObj ( final float  winx,
final float  winy,
final float  winz,
final Matrix4fb  mMv,
final Matrix4fb  mP,
final int[]  viewport,
final Vec3f  objPos,
final Matrix4fb  mat4Tmp 
)
static

Map window coordinates to object coordinates.

Traditional gluUnProject implementation.

Parameters
winx
winy
winz
mMv4x4 modelview matrix
mP4x4 projection matrix
viewport4 component viewport vector
objPos3 component object coordinate, the result
mat4Tmp16 component matrix for temp storage
Returns
true if successful, otherwise false (failed to invert matrix, or becomes infinity due to zero z)

Definition at line 1582 of file Matrix4fb.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapWinToObj() [3/3]

static boolean com.jogamp.opengl.test.junit.math.Matrix4fb.mapWinToObj ( final float  winx,
final float  winy,
final float  winz1,
final float  winz2,
final Matrix4fb  invPMv,
final int[]  viewport,
final Vec3f  objPos1,
final Vec3f  objPos2,
final Matrix4fb  mat4Tmp 
)
static

Map two window coordinates to two object coordinates, distinguished by their z component.

Traditional gluUnProject implementation.

Parameters
winx
winy
winz1
winz2
invPMvinverse [projection] x [modelview] matrix, i.e. Inv(P x Mv)
viewport4 component viewport vector
objPos13 component object coordinate, the result
mat4Tmp16 component matrix for temp storage
Returns
true if successful, otherwise false (failed to invert matrix, or becomes infinity due to zero z)

Definition at line 1670 of file Matrix4fb.java.

Here is the call graph for this function:

◆ mapWinToObj4()

static boolean com.jogamp.opengl.test.junit.math.Matrix4fb.mapWinToObj4 ( final float  winx,
final float  winy,
final float  winz,
final float  clipw,
final Matrix4fb  mMv,
final Matrix4fb  mP,
final int[]  viewport,
final float  near,
final float  far,
final Vec4f  objPos,
final Matrix4fb  mat4Tmp 
)
static

Map window coordinates to object coordinates.

Traditional gluUnProject4 implementation.

Parameters
winx
winy
winz
clipw
mMv4x4 modelview matrix
mP4x4 projection matrix
viewport4 component viewport vector
near
far
obj_pos4 component object coordinate, the result
mat4Tmp16 component matrix for temp storage
Returns
true if successful, otherwise false (failed to invert matrix, or becomes infinity due to zero z)

Definition at line 1728 of file Matrix4fb.java.

Here is the call graph for this function:

◆ mapWinToRay()

static boolean com.jogamp.opengl.test.junit.math.Matrix4fb.mapWinToRay ( final float  winx,
final float  winy,
final float  winz0,
final float  winz1,
final Matrix4fb  mMv,
final Matrix4fb  mP,
final int[]  viewport,
final Ray  ray,
final Matrix4fb  mat4Tmp1,
final Matrix4fb  mat4Tmp2 
)
static

Map two window coordinates w/ shared X/Y and distinctive Z to a Ray.

The resulting Ray maybe used for picking using a bounding box.

Notes for picking winz0 and winz1:

Parameters
winx
winy
winz0
winz1
mMv4x4 modelview matrix
mP4x4 projection matrix
viewport4 component viewport vector
raystorage for the resulting Ray
mat4Tmp116 component matrix for temp storage
mat4Tmp216 component matrix for temp storage
Returns
true if successful, otherwise false (failed to invert matrix, or becomes z is infinity)

Definition at line 1782 of file Matrix4fb.java.

Here is the call graph for this function:

◆ mul() [1/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.mul ( final Matrix4fb  a,
final Matrix4fb  b 
)

Multiply matrix: [this] = [a] x [b].

Roughly 13% faster than mul(Matrix4fb) Roughly 11% faster than FloatUtil#multMatrix(float[], float[])

Parameters
a4x4 matrix
b4x4 matrix
Returns
this matrix for chaining
See also
mul(Matrix4fb)

Definition at line 636 of file Matrix4fb.java.

◆ mul() [2/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.mul ( final Matrix4fb  b)

Multiply matrix: [this] = [this] x [b].

Roughly 15% slower than mul(Matrix4fb, Matrix4fb) Roughly 3% slower than FloatUtil#multMatrix(float[], float[])

Parameters
b4x4 matrix
Returns
this matrix for chaining
See also
mul(Matrix4fb, Matrix4fb)

Definition at line 569 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ mulVec3f() [1/2]

final float[] com.jogamp.opengl.test.junit.math.Matrix4fb.mulVec3f ( final float[]  v_in,
final float[]  v_out 
)

Affine 3f-vector transformation by 4x4 matrix.

4x4 matrix multiplication with 3-component vector, using 1 for for v_in[3] and dropping v_out[3], which shall be 1.

Parameters
v_in3-component column-vector
v_outm_in * v_in, 3-component column-vector
Returns
v_out for chaining

Definition at line 733 of file Matrix4fb.java.

◆ mulVec3f() [2/2]

final Vec3f com.jogamp.opengl.test.junit.math.Matrix4fb.mulVec3f ( final Vec3f  v_in,
final Vec3f  v_out 
)

Affine 3f-vector transformation by 4x4 matrix.

4x4 matrix multiplication with 3-component vector, using 1 for for v_in.w() and dropping v_out.w(), which shall be 1.

Parameters
v_in3-component column-vector Vec3f
v_outm_in * v_in, 3-component column-vector Vec3f
Returns
v_out for chaining

Definition at line 753 of file Matrix4fb.java.

Here is the call graph for this function:

◆ mulVec4f() [1/2]

final float[] com.jogamp.opengl.test.junit.math.Matrix4fb.mulVec4f ( final float[]  v_in,
final float[]  v_out 
)
Parameters
v_in4-component column-vector
v_outthis * v_in
Returns
v_out for chaining

Definition at line 697 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ mulVec4f() [2/2]

final Vec4f com.jogamp.opengl.test.junit.math.Matrix4fb.mulVec4f ( final Vec4f  v_in,
final Vec4f  v_out 
)
Parameters
v_in4-component column-vector
v_outthis * v_in
Returns
v_out for chaining

Definition at line 712 of file Matrix4fb.java.

Here is the call graph for this function:

◆ pop()

final void com.jogamp.opengl.test.junit.math.Matrix4fb.pop ( )

Pop the current matrix from it's stack, replacing this matrix values.

See also
push()

Definition at line 1424 of file Matrix4fb.java.

◆ push()

final void com.jogamp.opengl.test.junit.math.Matrix4fb.push ( )

Push the matrix to it's stack, while preserving this matrix values.

See also
pop()

Definition at line 1416 of file Matrix4fb.java.

◆ rotate() [1/3]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.rotate ( final float  ang_rad,
final float  x,
final float  y,
final float  z,
final Matrix4fb  tmp 
)

Rotate this matrix about give axis and angle in radians, i.e.

multiply by axis-rotation matrix.

See also
Matrix-FAQ Q38
Parameters
angradangle in radians
xx of rotation axis
yy of rotation axis
zz of rotation axis
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1339 of file Matrix4fb.java.

Here is the call graph for this function:

◆ rotate() [2/3]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.rotate ( final float  ang_rad,
final Vec3f  axis,
final Matrix4fb  tmp 
)

Rotate this matrix about give axis and angle in radians, i.e.

multiply by axis-rotation matrix.

See also
Matrix-FAQ Q38
Parameters
angradangle in radians
axisrotation axis
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1351 of file Matrix4fb.java.

Here is the call graph for this function:

◆ rotate() [3/3]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.rotate ( final Quaternion  quat,
final Matrix4fb  tmp 
)

Rotate this matrix with the given Quaternion, i.e.

multiply by Quaternion's rotation matrix.

Parameters
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1360 of file Matrix4fb.java.

Here is the call graph for this function:

◆ scale() [1/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.scale ( final float  s,
final Matrix4fb  tmp 
)

Scale this matrix, i.e.

multiply by scale matrix.

Parameters
sscale for x-, y- and z-axis
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1404 of file Matrix4fb.java.

Here is the call graph for this function:

◆ scale() [2/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.scale ( final float  x,
final float  y,
final float  z,
final Matrix4fb  tmp 
)

Scale this matrix, i.e.

multiply by scale matrix.

Parameters
xx scale
yy scale
zz scale
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1394 of file Matrix4fb.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setToFrustum()

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToFrustum ( final float  left,
final float  right,
final float  bottom,
final float  top,
final float  zNear,
final float  zFar 
) throws IllegalArgumentException

Set this matrix to frustum.

Frustum matrix (Column Order):
2*zNear/dx   0          0   0
0            2*zNear/dy 0   0
A            B          C  -1
0            0          D   0
 
Parameters
left
right
bottom
top
zNear
zFar
Returns
this matrix for chaining
Exceptions
IllegalArgumentExceptionif zNear <= 0 or zFar <= zNear or left == right, or bottom == top.

Definition at line 1108 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ setToLookAt()

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToLookAt ( final Vec3f  eye,
final Vec3f  center,
final Vec3f  up,
final Matrix4fb  tmp 
)

Make given matrix the look-at matrix based on given parameters.

Consist out of two matrix multiplications:

  R = L x T,
  with L for look-at matrix and
       T for eye translation.

  Result R can be utilized for projection or modelview multiplication, i.e.
         M = M x R,
         with M being the projection or modelview matrix.
Parameters
eye3 component eye vector
center3 component center vector
up3 component up vector
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1290 of file Matrix4fb.java.

Here is the call graph for this function:

◆ setToOrtho()

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToOrtho ( final float  left,
final float  right,
final float  bottom,
final float  top,
final float  zNear,
final float  zFar 
)

Set this matrix to orthogonal projection.

Ortho matrix (Column Order):
2/dx  0     0    0
0     2/dy  0    0
0     0     2/dz 0
tx    ty    tz   1
 
Parameters
left
right
bottom
top
zNear
zFar
Returns
this matrix for chaining

Definition at line 1060 of file Matrix4fb.java.

◆ setToPerspective() [1/2]

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToPerspective ( final float  fovy_rad,
final float  aspect,
final float  zNear,
final float  zFar 
) throws IllegalArgumentException

Set this matrix to perspective frustum projection.

Parameters
fovy_radangle in radians
aspectaspect ratio width / height
zNear
zFar
Returns
this matrix for chaining
Exceptions
IllegalArgumentExceptionif zNear <= 0 or zFar <= zNear
See also
setToFrustum(float, float, float, float, float, float)

Definition at line 1157 of file Matrix4fb.java.

Here is the call graph for this function:

◆ setToPerspective() [2/2]

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToPerspective ( final FovHVHalves  fovhv,
final float  zNear,
final float  zFar 
) throws IllegalArgumentException

Set this matrix to perspective frustum projection.

Parameters
fovhvFovHVHalves field of view in both directions, may not be centered, either in radians or tangent
zNear
zFar
Returns
this matrix for chaining
Exceptions
IllegalArgumentExceptionif zNear <= 0 or zFar <= zNear
See also
setToFrustum(float, float, float, float, float, float)
Frustum::updateByFovDesc(float[], int, boolean, Frustum.FovDesc)

Definition at line 1176 of file Matrix4fb.java.

Here is the call graph for this function:

◆ setToRotation()

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToRotation ( final Quaternion  q)

Set this matrix to rotation using the given Quaternion.

Implementation Details:

Parameters
qthe Quaternion representing the rotation
Returns
this matrix for chaining
See also
Matrix-FAQ Q54
Quaternion::toMatrix(float[])
getRotation()

Definition at line 977 of file Matrix4fb.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setToRotationAxis() [1/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToRotationAxis ( final float  ang_rad,
final Vec3f  axis 
)

Set this matrix to rotation from the given axis and angle in radians.

 Rotation matrix (Column Order):
 xx(1-c)+c  xy(1-c)+zs xz(1-c)-ys 0
 xy(1-c)-zs yy(1-c)+c  yz(1-c)+xs 0
 xz(1-c)+ys yz(1-c)-xs zz(1-c)+c  0
 0          0          0          1
See also
Matrix-FAQ Q38
Parameters
ang_radangle in radians
axisrotation axis
Returns
this matrix for chaining

Definition at line 902 of file Matrix4fb.java.

Here is the call graph for this function:

◆ setToRotationAxis() [2/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToRotationAxis ( final float  ang_rad,
float  x,
float  y,
float  z 
)

Set this matrix to rotation from the given axis and angle in radians.

 Rotation matrix (Column Order):
 xx(1-c)+c  xy(1-c)+zs xz(1-c)-ys 0
 xy(1-c)-zs yy(1-c)+c  yz(1-c)+xs 0
 xz(1-c)+ys yz(1-c)-xs zz(1-c)+c  0
 0          0          0          1
See also
Matrix-FAQ Q38
Parameters
ang_radangle in radians
xx of rotation axis
yy of rotation axis
zz of rotation axis
Returns
this matrix for chaining

Definition at line 850 of file Matrix4fb.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setToRotationEuler()

Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToRotationEuler ( final float  bankX,
final float  headingY,
final float  attitudeZ 
)

Set this matrix to rotation from the given Euler rotation angles in radians.

The rotations are applied in the given order:

  • y - heading
  • z - attitude
  • x - bank
Parameters
bankXthe Euler pitch angle in radians. (rotation about the X axis)
headingYthe Euler yaw angle in radians. (rotation about the Y axis)
attitudeZthe Euler roll angle in radians. (rotation about the Z axis)
Returns
this matrix for chaining

Implementation does not use Quaternion and hence is exposed to Gimbal-Lock, consider using setToRotation(Quaternion).

See also
Matrix-FAQ Q36
euclideanspace.com-eulerToMatrix
setToRotation(Quaternion)

Definition at line 929 of file Matrix4fb.java.

Here is the call graph for this function:

◆ setToScale()

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToScale ( final float  x,
final float  y,
final float  z 
)

Set this matrix to scale.

Scale matrix (Any Order):
x 0 0 0
0 y 0 0
0 0 z 0
0 0 0 1
 
Parameters
xx-axis scale
yy-axis scale
zz-axis scale
Returns
this matrix for chaining

Definition at line 822 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ setToTranslation() [1/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToTranslation ( final float  x,
final float  y,
final float  z 
)

Set this matrix to translation.

Translation matrix (Column Order):
1 0 0 0
0 1 0 0
0 0 1 0
x y z 1
 
Parameters
xx-axis translate
yy-axis translate
zz-axis translate
Returns
this matrix for chaining

Definition at line 780 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ setToTranslation() [2/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.setToTranslation ( final Vec3f  t)

Set this matrix to translation.

Translation matrix (Column Order):
1 0 0 0
0 1 0 0
0 0 1 0
x y z 1
 
Parameters
ttranslate Vec3f
Returns
this matrix for chaining

Definition at line 804 of file Matrix4fb.java.

Here is the call graph for this function:

◆ toString() [1/2]

String com.jogamp.opengl.test.junit.math.Matrix4fb.toString ( )

Definition at line 1820 of file Matrix4fb.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [2/2]

StringBuilder com.jogamp.opengl.test.junit.math.Matrix4fb.toString ( final StringBuilder  sb,
final String  rowPrefix,
final String  f 
)
Parameters
sboptional passed StringBuilder instance to be used
rowPrefixoptional prefix for each row
fthe format string of one floating point, i.e. "%10.5f", see java.util.Formatter
Returns
matrix string representation

Definition at line 1813 of file Matrix4fb.java.

Here is the call graph for this function:

◆ translate() [1/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.translate ( final float  x,
final float  y,
final float  z,
final Matrix4fb  tmp 
)

Translate this matrix, i.e.

multiply by translation matrix.

Parameters
xx translation
yy translation
zz translation
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1372 of file Matrix4fb.java.

Here is the call graph for this function:

◆ translate() [2/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.translate ( final Vec3f  t,
final Matrix4fb  tmp 
)

Translate this matrix, i.e.

multiply by translation matrix.

Parameters
ttranslation Vec3f
tmptemporary Matrix4f used for multiplication
Returns
this matrix for chaining

Definition at line 1382 of file Matrix4fb.java.

Here is the call graph for this function:

◆ transpose() [1/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.transpose ( )

Transpose this matrix.

Returns
this matrix for chaining

Definition at line 322 of file Matrix4fb.java.

Here is the caller graph for this function:

◆ transpose() [2/2]

final Matrix4fb com.jogamp.opengl.test.junit.math.Matrix4fb.transpose ( final Matrix4fb  src)

Transpose the given src matrix into this matrix.

Parameters
srcsource 4x4 matrix
Returns
this matrix (result) for chaining

Definition at line 358 of file Matrix4fb.java.

Here is the call graph for this function:

◆ updateFrustumPlanes()

void com.jogamp.opengl.test.junit.math.Matrix4fb.updateFrustumPlanes ( final Frustum  frustum)

Calculate the frustum planes in world coordinates using the passed float[16] as premultiplied P*MV (column major order).

Frustum plane's normals will point to the inside of the viewing frustum, as required by this class.

Definition at line 1193 of file Matrix4fb.java.

Here is the call graph for this function:

The documentation for this class was generated from the following file: