jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
jau::math::Matrix4< Value_type, > Class Template Reference

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

#include <mat4f.hpp>

Inheritance diagram for jau::math::Matrix4< Value_type, >:
Collaboration diagram for jau::math::Matrix4< Value_type, >:

Public Types

typedef const value_typeconst_iterator
 
typedef const value_typeconst_pointer
 
typedef const value_typeconst_reference
 
typedef value_typeiterator
 
typedef value_typepointer
 
typedef Ray3F< value_type, std::is_floating_point_v< Value_type > > Ray3
 
typedef value_typereference
 
typedef Value_type value_type
 
typedef Vector3F< value_type, std::is_floating_point_v< Value_type > > Vec3
 
typedef Vector4F< value_type, std::is_floating_point_v< Value_type > > Vec4
 

Public Member Functions

constexpr Matrix4 () noexcept
 Creates a new identity matrix. More...
 
constexpr Matrix4 (const Matrix4 &o) noexcept
 Creates a new matrix copying the values of the given src matrix. More...
 
constexpr Matrix4 (const_iterator m) noexcept
 Creates a new matrix based on given value_type[4*4] column major order. More...
 
constexpr Matrix4 (std::initializer_list< value_type > m) noexcept
 Creates a new matrix based on given value_type initializer list in column major order. More...
 
constexpr iterator begin () noexcept
 
constexpr const_iterator cbegin () const noexcept
 
value_type determinant () const noexcept
 Returns the determinant of this matrix. More...
 
constexpr bool equals (const Matrix4 &o, const value_type epsilon=std::numeric_limits< value_type >::epsilon()) const noexcept
 
constexpr value_type get (const jau::nsize_t i) const noexcept
 Returns the ith component of the given column-major order matrix, 0 <= i < 16, w/o boundary check. More...
 
constexpr iterator get (iterator dst) const noexcept
 Get this matrix into the given value_type[16] array in column major order w/o boundary check. More...
 
constexpr std::vector< value_type > & get (std::vector< value_type > &dst, size_t dst_off) const noexcept
 Get this matrix into the given FloatBuffer in column major order. More...
 
constexpr Vec4 getColumn (const jau::nsize_t column) const noexcept
 Get the named column of the given column-major matrix to v_out w/o boundary check. More...
 
constexpr Vec3getColumn (const jau::nsize_t column, Vec3 &v_out) const noexcept
 Get the named column of the given column-major matrix to v_out w/o boundary check. More...
 
constexpr Vec4getColumn (const jau::nsize_t column, Vec4 &v_out) const noexcept
 Get the named column of the given column-major matrix to v_out w/o boundary check. More...
 
constexpr Vec4 getRow (const jau::nsize_t row) const noexcept
 Get the named column of the given column-major matrix to v_out w/o boundary check. More...
 
constexpr Vec3getRow (const jau::nsize_t row, Vec3 &v_out) const noexcept
 Get the named row of the given column-major matrix to v_out w/o boundary check. More...
 
constexpr Vec4getRow (const jau::nsize_t row, Vec4 &v_out) const noexcept
 Get the named row of the given column-major matrix to v_out w/ boundary check. More...
 
bool invert () noexcept
 Invert this matrix. More...
 
bool invert (const Matrix4 &src) noexcept
 Invert the src matrix values into this matrix. More...
 
constexpr Matrix4load (const Matrix4 &src) noexcept
 Load the values of the given matrix src to this matrix w/o boundary check. More...
 
constexpr Matrix4load (const_iterator src) noexcept
 Load the values of the given matrix src to this matrix w/o boundary check. More...
 
constexpr Matrix4loadIdentity () noexcept
 Set this matrix to identity. More...
 
constexpr Matrix4mul (const Matrix4 &a, const Matrix4 &b) noexcept
 Multiply matrix: [this] = [a] x [b]. More...
 
constexpr Matrix4mul (const Matrix4 &b) noexcept
 Multiply matrix: [this] = [this] x [b]. More...
 
constexpr Vec3mulVec3 (const Vec3 &v_in, Vec3 &v_out) const noexcept
 Affine 3f-vector transformation by 4x4 matrix. More...
 
constexpr Vec3mulVec3 (Vec3 &v_inout) const noexcept
 Affine 3f-vector transformation by 4x4 matrix. More...
 
constexpr Vec4mulVec4 (const Vec4 &v_in, Vec4 &v_out) const noexcept
 
constexpr Vec4mulVec4 (Vec4 &v_inout) const noexcept
 
 operator const_pointer () const noexcept
 
 operator pointer () noexcept
 
constexpr Vec3 operator* (const Vec3 &rhs) const noexcept
 Returns new Vec3, with affine 3f-vector transformation by this 4x4 matrix: this * v_in. More...
 
constexpr Vec4 operator* (const Vec4 &rhs) const noexcept
 Returns new Vec4, with this * v_in. More...
 
constexpr Matrix4operator*= (const Matrix4 &rhs) noexcept
 Multiply matrix: [this] = [this] x [b]. More...
 
constexpr Matrix4operator*= (const value_type s) noexcept
 Multiply matrix with scalar: [this] = [this] x [s]. More...
 
constexpr Matrix4operator= (const Matrix4 &o) noexcept
 Copy assignment using the the values of the given src matrix. More...
 
constexpr bool operator== (const Matrix4 &rhs) const noexcept
 
constexpr value_type operator[] (size_t i) const noexcept
 Returns read-only ith component of the given column-major order matrix, 0 <= i < 16 w/o boundary check. More...
 
constexpr reference operator[] (size_t i) noexcept
 Returns writable reference to the ith component of this column-major order matrix, 0 <= i < 16 w/o boundary check. More...
 
constexpr_cxx26 Matrix4rotate (const value_type ang_rad, const value_type x, const value_type y, const value_type z, Matrix4 &tmp) noexcept
 Rotate this matrix about give axis and angle in radians, i.e. More...
 
constexpr_cxx26 Matrix4rotate (const value_type ang_rad, const Vec3 &axis, Matrix4 &tmp) noexcept
 Rotate this matrix about give axis and angle in radians, i.e. More...
 
constexpr Matrix4scale (const value_type s, Matrix4 &tmp) noexcept
 Scale this matrix, i.e. More...
 
constexpr Matrix4scale (const value_type x, const value_type y, const value_type z, Matrix4 &tmp) noexcept
 Scale this matrix, i.e. More...
 
constexpr void set (const jau::nsize_t i, const value_type v) noexcept
 Sets the ith component of this column-major order matrix with value_type v, 0 <= i < 16 w/o boundary check. More...
 
Matrix4setToFrustum (const value_type left, const value_type right, const value_type bottom, const value_type top, const value_type zNear, const value_type zFar)
 Set this matrix to frustum. More...
 
constexpr Matrix4setToLookAt (const Vec3 &eye, const Vec3 &center, const Vec3 &up, Matrix4 &tmp) noexcept
 Set this matrix to the look-at matrix based on given parameters. More...
 
constexpr Matrix4setToOrtho (const value_type left, const value_type right, const value_type bottom, const value_type top, const value_type zNear, const value_type zFar) noexcept
 Set this matrix to orthogonal projection. More...
 
Matrix4setToPerspective (const FovHVHalves &fovhv, const value_type zNear, const value_type zFar)
 Set this matrix to perspective frustum projection. More...
 
Matrix4setToPerspective (const value_type fovy_rad, const value_type aspect, const value_type zNear, const value_type zFar)
 Set this matrix to perspective frustum projection. More...
 
constexpr bool setToPick (const value_type x, const value_type y, const value_type deltaX, const value_type deltaY, const Recti &viewport, Matrix4 &mat4Tmp) noexcept
 Set this matrix to the pick matrix based on given parameters. More...
 
constexpr_cxx26 Matrix4setToRotationAxis (const value_type ang_rad, const Vec3 &axis) noexcept
 Set this matrix to rotation from the given axis and angle in radians. More...
 
constexpr_cxx26 Matrix4setToRotationAxis (const value_type ang_rad, value_type x, value_type y, value_type z) noexcept
 Set this matrix to rotation from the given axis and angle in radians. More...
 
constexpr_cxx26 Matrix4setToRotationEuler (const value_type bankX, const value_type headingY, const value_type attitudeZ) noexcept
 Set this matrix to rotation from the given Euler rotation angles in radians. More...
 
constexpr_cxx26 Matrix4setToRotationEuler (const Vec3 &angradXYZ) noexcept
 Set this matrix to rotation from the given Euler rotation angles in radians. More...
 
constexpr Matrix4setToScale (const value_type x, const value_type y, const value_type z) noexcept
 Set this matrix to scale. More...
 
constexpr Matrix4setToScale (const Vec3 &s) noexcept
 Set this matrix to scale. More...
 
constexpr Matrix4setToTranslation (const value_type x, const value_type y, const value_type z) noexcept
 Set this matrix to translation. More...
 
constexpr Matrix4setToTranslation (const Vec3 &t) noexcept
 Set this matrix to translation. More...
 
std::string toString () const noexcept
 
std::string toString (const std::string &rowPrefix) const noexcept
 Returns a formatted string representation of this matrix. More...
 
std::string toString (const std::string &rowPrefix, const std::string &f) const noexcept
 Returns a formatted string representation of this matrix. More...
 
constexpr Matrix4translate (const value_type x, const value_type y, const value_type z, Matrix4 &tmp) noexcept
 Translate this matrix, i.e. More...
 
constexpr Matrix4translate (const Vec3 &t, Matrix4 &tmp) noexcept
 Translate this matrix, i.e. More...
 
Matrix4transpose () noexcept
 Transpose this matrix. More...
 
Matrix4transpose (const Matrix4 &src) noexcept
 Transpose the given src matrix into this matrix. More...
 

Static Public Member Functions

static bool mapObjToWin (const Vec3 &obj, const Matrix4 &mMv, const Matrix4 &mP, const Recti &viewport, Vec3 &winPos) noexcept
 Map object coordinates to window coordinates. More...
 
static bool mapObjToWin (const Vec3 &obj, const Matrix4 &mPMv, const Recti &viewport, Vec3 &winPos) noexcept
 Map object coordinates to window coordinates. More...
 
static bool mapWinToObj (const value_type winx, const value_type winy, const value_type winz, const Matrix4 &invPMv, const Recti &viewport, Vec3 &objPos) noexcept
 Map window coordinates to object coordinates. More...
 
static bool mapWinToObj (const value_type winx, const value_type winy, const value_type winz, const Matrix4 &mMv, const Matrix4 &mP, const Recti &viewport, Vec3 &objPos, Matrix4 &mat4Tmp) noexcept
 Map window coordinates to object coordinates. More...
 
static bool mapWinToObj (const value_type winx, const value_type winy, const value_type winz1, const value_type winz2, const Matrix4 &invPMv, const Recti &viewport, Vec3 &objPos1, Vec3 &objPos2) noexcept
 Map two window coordinates to two object coordinates, distinguished by their z component. More...
 
static bool mapWinToObj4 (const value_type winx, const value_type winy, const value_type winz, const value_type clipw, const Matrix4 &invPMv, const Recti &viewport, const value_type near, const value_type far, Vec4 &objPos) noexcept
 Map window coordinates to object coordinates. More...
 
static bool mapWinToObj4 (const value_type winx, const value_type winy, const value_type winz, const value_type clipw, const Matrix4 &mMv, const Matrix4 &mP, const Recti &viewport, const value_type near, const value_type far, Vec4 &objPos, Matrix4 &mat4Tmp) noexcept
 Map window coordinates to object coordinates. More...
 
static bool mapWinToRay (const value_type winx, const value_type winy, const value_type winz0, const value_type winz1, const Matrix4 &invPMv, const Recti &viewport, Ray3 &ray) noexcept
 Map two window coordinates w/ shared X/Y and distinctive Z to a Ray. More...
 
static bool mapWinToRay (const value_type winx, const value_type winy, const value_type winz0, const value_type winz1, const Matrix4 &mMv, const Matrix4 &mP, const Recti &viewport, Ray3 &ray, Matrix4 &mat4Tmp1) noexcept
 Map two window coordinates w/ shared X/Y and distinctive Z to a Ray. More...
 

Static Public Attributes

static constexpr const value_type half = one/two
 
static constexpr const value_type inv_deviation = value_type(84) * std::numeric_limits<value_type>::epsilon()
 Inversion Epsilon, used with equals method to determine if two inverted matrices are close enough to be considered equal. More...
 
static constexpr const value_type one = value_type(1)
 
static constexpr const value_type two = value_type(2)
 
static constexpr const value_type zero = value_type(0)
 

Detailed Description

template<typename Value_type, std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
class jau::math::Matrix4< Value_type, >

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

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

Unlike PMVmat4f, this class only represents one single matrix.

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)
      m03 = tx;                  m03 = tx;
      m13 = ty;                  m13 = ty;
      m23 = tz;                  m23 = tz;

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

Definition at line 112 of file mat4f.hpp.

Member Typedef Documentation

◆ value_type

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef Value_type jau::math::Matrix4< Value_type, >::value_type

Definition at line 114 of file mat4f.hpp.

◆ pointer

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef value_type* jau::math::Matrix4< Value_type, >::pointer

Definition at line 115 of file mat4f.hpp.

◆ const_pointer

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef const value_type* jau::math::Matrix4< Value_type, >::const_pointer

Definition at line 116 of file mat4f.hpp.

◆ reference

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef value_type& jau::math::Matrix4< Value_type, >::reference

Definition at line 117 of file mat4f.hpp.

◆ const_reference

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef const value_type& jau::math::Matrix4< Value_type, >::const_reference

Definition at line 118 of file mat4f.hpp.

◆ iterator

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef value_type* jau::math::Matrix4< Value_type, >::iterator

Definition at line 119 of file mat4f.hpp.

◆ const_iterator

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef const value_type* jau::math::Matrix4< Value_type, >::const_iterator

Definition at line 120 of file mat4f.hpp.

◆ Vec3

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef Vector3F<value_type, std::is_floating_point_v<Value_type> > jau::math::Matrix4< Value_type, >::Vec3

Definition at line 122 of file mat4f.hpp.

◆ Vec4

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef Vector4F<value_type, std::is_floating_point_v<Value_type> > jau::math::Matrix4< Value_type, >::Vec4

Definition at line 123 of file mat4f.hpp.

◆ Ray3

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef Ray3F<value_type, std::is_floating_point_v<Value_type> > jau::math::Matrix4< Value_type, >::Ray3

Definition at line 124 of file mat4f.hpp.

Constructor & Destructor Documentation

◆ Matrix4() [1/4]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Matrix4< Value_type, >::Matrix4 ( )
inlineconstexprnoexcept

Creates a new identity matrix.

Definition at line 154 of file mat4f.hpp.

◆ Matrix4() [2/4]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Matrix4< Value_type, >::Matrix4 ( const_iterator  m)
inlineconstexprnoexcept

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

Parameters
m4x4 matrix in column-major order

Definition at line 165 of file mat4f.hpp.

◆ Matrix4() [3/4]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Matrix4< Value_type, >::Matrix4 ( std::initializer_list< value_type m)
inlineconstexprnoexcept

Creates a new matrix based on given value_type initializer list in column major order.

Parameters
msource initializer list value_type data to be copied into this new instance, implied size must be >= 16

Definition at line 176 of file mat4f.hpp.

◆ Matrix4() [4/4]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Matrix4< Value_type, >::Matrix4 ( const Matrix4< Value_type, > &  o)
inlineconstexprnoexcept

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

Definition at line 185 of file mat4f.hpp.

Member Function Documentation

◆ operator=()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::operator= ( const Matrix4< Value_type, > &  o)
inlineconstexprnoexcept

Copy assignment using the the values of the given src matrix.

Definition at line 192 of file mat4f.hpp.

◆ equals()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr bool jau::math::Matrix4< Value_type, >::equals ( const Matrix4< Value_type, > &  o,
const value_type  epsilon = std::numeric_limits<value_type>::epsilon() 
) const
inlineconstexprnoexcept

Definition at line 194 of file mat4f.hpp.

Here is the caller graph for this function:

◆ operator==()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr bool jau::math::Matrix4< Value_type, >::operator== ( const Matrix4< Value_type, > &  rhs) const
inlineconstexprnoexcept

Definition at line 216 of file mat4f.hpp.

◆ operator[]() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr reference jau::math::Matrix4< Value_type, >::operator[] ( size_t  i)
inlineconstexprnoexcept

Returns writable reference to the ith component of this column-major order matrix, 0 <= i < 16 w/o boundary check.

Definition at line 225 of file mat4f.hpp.

◆ set()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr void jau::math::Matrix4< Value_type, >::set ( const jau::nsize_t  i,
const value_type  v 
)
inlineconstexprnoexcept

Sets the ith component of this column-major order matrix with value_type v, 0 <= i < 16 w/o boundary check.

Definition at line 231 of file mat4f.hpp.

◆ operator pointer()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
jau::math::Matrix4< Value_type, >::operator pointer ( )
inlineexplicitnoexcept

Definition at line 236 of file mat4f.hpp.

◆ begin()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr iterator jau::math::Matrix4< Value_type, >::begin ( )
inlineconstexprnoexcept

Definition at line 237 of file mat4f.hpp.

Here is the caller graph for this function:

◆ loadIdentity()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::loadIdentity ( )
inlineconstexprnoexcept

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 250 of file mat4f.hpp.

Here is the caller graph for this function:

◆ load() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::load ( const_iterator  src)
inlineconstexprnoexcept

Load the values of the given matrix src to this matrix w/o boundary check.

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

Definition at line 264 of file mat4f.hpp.

Here is the caller graph for this function:

◆ load() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::load ( const Matrix4< Value_type, > &  src)
inlineconstexprnoexcept

Load the values of the given matrix src to this matrix w/o boundary check.

Parameters
srcthe source values
Returns
this matrix for chaining

Definition at line 289 of file mat4f.hpp.

◆ operator[]() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr value_type jau::math::Matrix4< Value_type, >::operator[] ( size_t  i) const
inlineconstexprnoexcept

Returns read-only ith component of the given column-major order matrix, 0 <= i < 16 w/o boundary check.

Definition at line 300 of file mat4f.hpp.

◆ get() [1/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr value_type jau::math::Matrix4< Value_type, >::get ( const jau::nsize_t  i) const
inlineconstexprnoexcept

Returns the ith component of the given column-major order matrix, 0 <= i < 16, w/o boundary check.

Definition at line 306 of file mat4f.hpp.

Here is the caller graph for this function:

◆ operator const_pointer()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
jau::math::Matrix4< Value_type, >::operator const_pointer ( ) const
inlineexplicitnoexcept

Definition at line 311 of file mat4f.hpp.

◆ cbegin()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr const_iterator jau::math::Matrix4< Value_type, >::cbegin ( ) const
inlineconstexprnoexcept

Definition at line 312 of file mat4f.hpp.

Here is the caller graph for this function:

◆ getColumn() [1/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec4 & jau::math::Matrix4< Value_type, >::getColumn ( const jau::nsize_t  column,
Vec4 v_out 
) const
inlineconstexprnoexcept

Get the named column of the given column-major matrix to v_out w/o boundary check.

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

Definition at line 320 of file mat4f.hpp.

Here is the caller graph for this function:

◆ getColumn() [2/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec4 jau::math::Matrix4< Value_type, >::getColumn ( const jau::nsize_t  column) const
inlineconstexprnoexcept

Get the named column of the given column-major matrix to v_out w/o boundary check.

Parameters
columnnamed column to copy
Returns
result vector holding the requested column

Definition at line 333 of file mat4f.hpp.

◆ getColumn() [3/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec3 & jau::math::Matrix4< Value_type, >::getColumn ( const jau::nsize_t  column,
Vec3 v_out 
) const
inlineconstexprnoexcept

Get the named column of the given column-major matrix to v_out w/o boundary check.

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

Definition at line 347 of file mat4f.hpp.

◆ getRow() [1/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec4 & jau::math::Matrix4< Value_type, >::getRow ( const jau::nsize_t  row,
Vec4 v_out 
) const
inlineconstexprnoexcept

Get the named row of the given column-major matrix to v_out w/ boundary check.

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

Definition at line 359 of file mat4f.hpp.

◆ getRow() [2/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec4 jau::math::Matrix4< Value_type, >::getRow ( const jau::nsize_t  row) const
inlineconstexprnoexcept

Get the named column of the given column-major matrix to v_out w/o boundary check.

Parameters
rownamed row to copy
Returns
result vector holding the requested row

Definition at line 370 of file mat4f.hpp.

◆ getRow() [3/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec3 & jau::math::Matrix4< Value_type, >::getRow ( const jau::nsize_t  row,
Vec3 v_out 
) const
inlineconstexprnoexcept

Get the named row of the given column-major matrix to v_out w/o boundary check.

Parameters
rownamed row to copy
v_outthe row-vector assert( i < 16 )e
Returns
given result vector v_out for chaining

Definition at line 383 of file mat4f.hpp.

◆ get() [2/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr iterator jau::math::Matrix4< Value_type, >::get ( iterator  dst) const
inlineconstexprnoexcept

Get this matrix into the given value_type[16] array in column major order w/o boundary check.

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

Definition at line 396 of file mat4f.hpp.

◆ get() [3/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr std::vector< value_type > & jau::math::Matrix4< Value_type, >::get ( std::vector< value_type > &  dst,
size_t  dst_off 
) const
inlineconstexprnoexcept

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

Parameters
dst4x4 matrix std::vector in column-major order starting at dst_off
dst_offoffset for matrix dst
Returns
dst for chaining

Definition at line 424 of file mat4f.hpp.

◆ determinant()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
value_type jau::math::Matrix4< Value_type, >::determinant ( ) const
inlinenoexcept

Returns the determinant of this matrix.

Returns
the matrix determinant

Definition at line 438 of file mat4f.hpp.

Here is the caller graph for this function:

◆ transpose() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
Matrix4 & jau::math::Matrix4< Value_type, >::transpose ( )
inlinenoexcept

Transpose this matrix.

Returns
this matrix for chaining

Definition at line 452 of file mat4f.hpp.

◆ transpose() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
Matrix4 & jau::math::Matrix4< Value_type, >::transpose ( const Matrix4< Value_type, > &  src)
inlinenoexcept

Transpose the given src matrix into this matrix.

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

Definition at line 488 of file mat4f.hpp.

◆ invert() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
bool jau::math::Matrix4< Value_type, >::invert ( )
inlinenoexcept

Invert this matrix.

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

Definition at line 518 of file mat4f.hpp.

Here is the caller graph for this function:

◆ invert() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
bool jau::math::Matrix4< Value_type, >::invert ( const Matrix4< Value_type, > &  src)
inlinenoexcept

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 597 of file mat4f.hpp.

◆ operator*=() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::operator*= ( const value_type  s)
inlineconstexprnoexcept

Multiply matrix with scalar: [this] = [this] x [s].

Parameters
sa scalar
Returns
this matrix for chaining

Definition at line 703 of file mat4f.hpp.

◆ mul() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::mul ( const Matrix4< Value_type, > &  b)
inlineconstexprnoexcept

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

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

Definition at line 717 of file mat4f.hpp.

Here is the caller graph for this function:

◆ operator*=() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::operator*= ( const Matrix4< Value_type, > &  rhs)
inlineconstexprnoexcept

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

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

Definition at line 762 of file mat4f.hpp.

◆ mul() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::mul ( const Matrix4< Value_type, > &  a,
const Matrix4< Value_type, > &  b 
)
inlineconstexprnoexcept

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

Parameters
a4x4 matrix, can't be this matrix
b4x4 matrix, can't be this matrix
Returns
this matrix for chaining
See also
#mul(mat4f)

Definition at line 773 of file mat4f.hpp.

◆ mulVec4() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec4 & jau::math::Matrix4< Value_type, >::mulVec4 ( const Vec4 v_in,
Vec4 v_out 
) const
inlineconstexprnoexcept
Parameters
v_in4-component column-vector, can be v_out for in-place transformation
v_outthis * v_in
Returns
v_out for chaining

Definition at line 806 of file mat4f.hpp.

Here is the caller graph for this function:

◆ operator*() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec4 jau::math::Matrix4< Value_type, >::operator* ( const Vec4 rhs) const
inlineconstexprnoexcept

Returns new Vec4, with this * v_in.

Parameters
v_in4-component column-vector

Definition at line 820 of file mat4f.hpp.

◆ mulVec4() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec4 & jau::math::Matrix4< Value_type, >::mulVec4 ( Vec4 v_inout) const
inlineconstexprnoexcept
Parameters
v_inout4-component column-vector input and output, i.e. in-place transformation
Returns
v_inout for chaining

Definition at line 833 of file mat4f.hpp.

◆ mulVec3() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec3 & jau::math::Matrix4< Value_type, >::mulVec3 ( const Vec3 v_in,
Vec3 v_out 
) const
inlineconstexprnoexcept

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, can be v_out for in-place transformation
v_outm_in * v_in, 3-component column-vector vec3f
Returns
v_out for chaining

Definition at line 854 of file mat4f.hpp.

Here is the caller graph for this function:

◆ operator*() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec3 jau::math::Matrix4< Value_type, >::operator* ( const Vec3 rhs) const
inlineconstexprnoexcept

Returns new Vec3, with affine 3f-vector transformation by this 4x4 matrix: this * v_in.

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

Definition at line 871 of file mat4f.hpp.

◆ mulVec3() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec3 & jau::math::Matrix4< Value_type, >::mulVec3 ( Vec3 v_inout) const
inlineconstexprnoexcept

Affine 3f-vector transformation by 4x4 matrix.

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

Parameters
v_inout3-component column-vector vec3f input and output, i.e. in-place transformation
Returns
v_inout for chaining

Definition at line 889 of file mat4f.hpp.

◆ setToTranslation() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::setToTranslation ( const value_type  x,
const value_type  y,
const value_type  z 
)
inlineconstexprnoexcept

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 916 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToTranslation() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::setToTranslation ( const Vec3 t)
inlineconstexprnoexcept

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 940 of file mat4f.hpp.

◆ setToScale() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::setToScale ( const value_type  x,
const value_type  y,
const value_type  z 
)
inlineconstexprnoexcept

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 958 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToScale() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::setToScale ( const Vec3 s)
inlineconstexprnoexcept

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
sscale vec3f
Returns
this matrix for chaining

Definition at line 982 of file mat4f.hpp.

◆ setToRotationAxis() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr_cxx26 Matrix4 & jau::math::Matrix4< Value_type, >::setToRotationAxis ( const value_type  ang_rad,
value_type  x,
value_type  y,
value_type  z 
)
inlinenoexcept

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 1002 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToRotationAxis() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr_cxx26 Matrix4 & jau::math::Matrix4< Value_type, >::setToRotationAxis ( const value_type  ang_rad,
const Vec3 axis 
)
inlinenoexcept

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 1053 of file mat4f.hpp.

◆ setToRotationEuler() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr_cxx26 Matrix4 & jau::math::Matrix4< Value_type, >::setToRotationEuler ( const value_type  bankX,
const value_type  headingY,
const value_type  attitudeZ 
)
inlinenoexcept

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 Quaternion::toMatrix().

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

Definition at line 1080 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToRotationEuler() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr_cxx26 Matrix4 & jau::math::Matrix4< Value_type, >::setToRotationEuler ( const Vec3 angradXYZ)
inlinenoexcept

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
angradXYZeuler angle vector in radians holding x-bank, y-heading and z-attitude
Returns
this quaternion for chaining.

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

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

Definition at line 1133 of file mat4f.hpp.

◆ setToOrtho()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::setToOrtho ( const value_type  left,
const value_type  right,
const value_type  bottom,
const value_type  top,
const value_type  zNear,
const value_type  zFar 
)
inlineconstexprnoexcept

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 1154 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToFrustum()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
Matrix4 & jau::math::Matrix4< Value_type, >::setToFrustum ( const value_type  left,
const value_type  right,
const value_type  bottom,
const value_type  top,
const value_type  zNear,
const value_type  zFar 
)
inline

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 1202 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToPerspective() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
Matrix4 & jau::math::Matrix4< Value_type, >::setToPerspective ( const value_type  fovy_rad,
const value_type  aspect,
const value_type  zNear,
const value_type  zFar 
)
inline

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(value_type, value_type, value_type, value_type, value_type, value_type)

Definition at line 1251 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToPerspective() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
Matrix4 & jau::math::Matrix4< Value_type, >::setToPerspective ( const FovHVHalves fovhv,
const value_type  zNear,
const value_type  zFar 
)
inline

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(value_type, value_type, value_type, value_type, value_type, value_type)
Frustum::updateByFovDesc(mat4f, com.jogamp.math.geom.Frustum.FovDesc)

Definition at line 1270 of file mat4f.hpp.

◆ setToLookAt()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::setToLookAt ( const Vec3 eye,
const Vec3 center,
const Vec3 up,
Matrix4< Value_type, > &  tmp 
)
inlineconstexprnoexcept

Set this matrix to 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 mat4f used for multiplication
Returns
this matrix for chaining

Definition at line 1299 of file mat4f.hpp.

Here is the caller graph for this function:

◆ setToPick()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr bool jau::math::Matrix4< Value_type, >::setToPick ( const value_type  x,
const value_type  y,
const value_type  deltaX,
const value_type  deltaY,
const Recti viewport,
Matrix4< Value_type, > &  mat4Tmp 
)
inlineconstexprnoexcept

Set this matrix to the pick matrix based on given parameters.

Traditional gluPickMatrix implementation.

Consist out of two matrix multiplications:

  R = T x S,
  with T for viewport translation matrix and
       S for viewport scale matrix.

  Result R can be utilized for projection multiplication, i.e.
         P = P x R,
         with P being the projection matrix.

To effectively use the generated pick matrix for picking, call setToPick(..) and multiply a custom perspective matrix by this pick matrix. Then you may load the result onto the perspective matrix stack.

Parameters
xthe center x-component of a picking region in window coordinates
ythe center y-component of a picking region in window coordinates
deltaXthe width of the picking region in window coordinates.
deltaYthe height of the picking region in window coordinates.
viewportRect4i viewport
mat4Tmptemp storage
Returns
true if successful or false if either delta value is <= zero.

Definition at line 1363 of file mat4f.hpp.

◆ rotate() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr_cxx26 Matrix4 & jau::math::Matrix4< Value_type, >::rotate ( const value_type  ang_rad,
const value_type  x,
const value_type  y,
const value_type  z,
Matrix4< Value_type, > &  tmp 
)
inlinenoexcept

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 mat4f used for multiplication
Returns
this matrix for chaining

Definition at line 1391 of file mat4f.hpp.

◆ rotate() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr_cxx26 Matrix4 & jau::math::Matrix4< Value_type, >::rotate ( const value_type  ang_rad,
const Vec3 axis,
Matrix4< Value_type, > &  tmp 
)
inlinenoexcept

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 mat4f used for multiplication
Returns
this matrix for chaining

Definition at line 1403 of file mat4f.hpp.

◆ translate() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::translate ( const value_type  x,
const value_type  y,
const value_type  z,
Matrix4< Value_type, > &  tmp 
)
inlineconstexprnoexcept

Translate this matrix, i.e.

multiply by translation matrix.

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

Definition at line 1415 of file mat4f.hpp.

◆ translate() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::translate ( const Vec3 t,
Matrix4< Value_type, > &  tmp 
)
inlineconstexprnoexcept

Translate this matrix, i.e.

multiply by translation matrix.

Parameters
ttranslation vec3f
tmptemporary mat4f used for multiplication
Returns
this matrix for chaining

Definition at line 1425 of file mat4f.hpp.

◆ scale() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::scale ( const value_type  x,
const value_type  y,
const value_type  z,
Matrix4< Value_type, > &  tmp 
)
inlineconstexprnoexcept

Scale this matrix, i.e.

multiply by scale matrix.

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

Definition at line 1437 of file mat4f.hpp.

◆ scale() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Matrix4 & jau::math::Matrix4< Value_type, >::scale ( const value_type  s,
Matrix4< Value_type, > &  tmp 
)
inlineconstexprnoexcept

Scale this matrix, i.e.

multiply by scale matrix.

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

Definition at line 1447 of file mat4f.hpp.

◆ mapObjToWin() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapObjToWin ( const Vec3 obj,
const Matrix4< Value_type, > &  mMv,
const Matrix4< Value_type, > &  mP,
const Recti viewport,
Vec3 winPos 
)
inlinestaticnoexcept

Map object coordinates to window coordinates.

Traditional gluProject implementation.

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

Definition at line 1468 of file mat4f.hpp.

◆ mapObjToWin() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapObjToWin ( const Vec3 obj,
const Matrix4< Value_type, > &  mPMv,
const Recti viewport,
Vec3 winPos 
)
inlinestaticnoexcept

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
viewportRect4i viewport
winPos3 component window coordinate, the result
Returns
true if successful, otherwise false (z is 1)

Definition at line 1508 of file mat4f.hpp.

◆ mapWinToObj() [1/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapWinToObj ( const value_type  winx,
const value_type  winy,
const value_type  winz,
const Matrix4< Value_type, > &  mMv,
const Matrix4< Value_type, > &  mP,
const Recti viewport,
Vec3 objPos,
Matrix4< Value_type, > &  mat4Tmp 
)
inlinestaticnoexcept

Map window coordinates to object coordinates.

Traditional gluUnProject implementation.

Parameters
winx
winy
winz
mMv4x4 modelview matrix
mP4x4 projection matrix
viewportRect4i viewport
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 1547 of file mat4f.hpp.

◆ mapWinToObj() [2/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapWinToObj ( const value_type  winx,
const value_type  winy,
const value_type  winz,
const Matrix4< Value_type, > &  invPMv,
const Recti viewport,
Vec3 objPos 
)
inlinestaticnoexcept

Map window coordinates to object coordinates.

Traditional gluUnProject implementation.

Parameters
winx
winy
winz
invPMvinverse [projection] x [modelview] matrix, i.e. Inv(P x Mv), if null method returns false
viewportRect4i viewport
objPos3 component object coordinate, the result
Returns
true if successful, otherwise false (null invert matrix, or becomes infinity due to zero z)

Definition at line 1592 of file mat4f.hpp.

◆ mapWinToObj() [3/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapWinToObj ( const value_type  winx,
const value_type  winy,
const value_type  winz1,
const value_type  winz2,
const Matrix4< Value_type, > &  invPMv,
const Recti viewport,
Vec3 objPos1,
Vec3 objPos2 
)
inlinestaticnoexcept

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), if null method returns false
viewportRect4i viewport vector
objPos13 component object coordinate, the result
Returns
true if successful, otherwise false (null invert matrix, or becomes infinity due to zero z)

Definition at line 1632 of file mat4f.hpp.

◆ mapWinToObj4() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapWinToObj4 ( const value_type  winx,
const value_type  winy,
const value_type  winz,
const value_type  clipw,
const Matrix4< Value_type, > &  mMv,
const Matrix4< Value_type, > &  mP,
const Recti viewport,
const value_type  near,
const value_type  far,
Vec4 objPos,
Matrix4< Value_type, > &  mat4Tmp 
)
inlinestaticnoexcept

Map window coordinates to object coordinates.

Traditional gluUnProject4 implementation.

Parameters
winx
winy
winz
clipw
mMv4x4 modelview matrix
mP4x4 projection matrix
viewportRect4i 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 1689 of file mat4f.hpp.

◆ mapWinToObj4() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapWinToObj4 ( const value_type  winx,
const value_type  winy,
const value_type  winz,
const value_type  clipw,
const Matrix4< Value_type, > &  invPMv,
const Recti viewport,
const value_type  near,
const value_type  far,
Vec4 objPos 
)
inlinestaticnoexcept

Map window coordinates to object coordinates.

Traditional gluUnProject4 implementation.

Parameters
winx
winy
winz
clipw
invPMvinverse [projection] x [modelview] matrix, i.e. Inv(P x Mv), if null method returns false
viewportRect4i viewport vector
near
far
obj_pos4 component object coordinate, the result
Returns
true if successful, otherwise false (null invert matrix, or becomes infinity due to zero z)

Definition at line 1735 of file mat4f.hpp.

◆ mapWinToRay() [1/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapWinToRay ( const value_type  winx,
const value_type  winy,
const value_type  winz0,
const value_type  winz1,
const Matrix4< Value_type, > &  mMv,
const Matrix4< Value_type, > &  mP,
const Recti viewport,
Ray3 ray,
Matrix4< Value_type, > &  mat4Tmp1 
)
inlinestaticnoexcept

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

The resulting Ray maybe used for picking using a AABBox#getRayIntersection(vec3f, Ray, value_type, boolean).

Notes for picking winz0 and winz1:

Parameters
winx
winy
winz0
winz1
mMv4x4 modelview matrix
mP4x4 projection matrix
viewportRect4i viewport
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 mat4f.hpp.

◆ mapWinToRay() [2/2]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
static bool jau::math::Matrix4< Value_type, >::mapWinToRay ( const value_type  winx,
const value_type  winy,
const value_type  winz0,
const value_type  winz1,
const Matrix4< Value_type, > &  invPMv,
const Recti viewport,
Ray3 ray 
)
inlinestaticnoexcept

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

The resulting Ray maybe used for picking using a AABBox#getRayIntersection(vec3f, Ray, value_type, boolean).

Notes for picking winz0 and winz1:

Parameters
winx
winy
winz0
winz1
invPMvinverse [projection] x [modelview] matrix, i.e. Inv(P x Mv), if null method returns false
viewportRect4i viewport
raystorage for the resulting Ray
Returns
true if successful, otherwise false (null invert matrix, or becomes z is infinity)

Definition at line 1823 of file mat4f.hpp.

◆ toString() [1/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
std::string jau::math::Matrix4< Value_type, >::toString ( const std::string &  rowPrefix,
const std::string &  f 
) const
inlinenoexcept

Returns a formatted string representation of this matrix.

Parameters
rowPrefixprefix for each row
fformat string for each value_type element, e.g. "%10.5f"

Definition at line 1841 of file mat4f.hpp.

Here is the caller graph for this function:

◆ toString() [2/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
std::string jau::math::Matrix4< Value_type, >::toString ( const std::string &  rowPrefix) const
inlinenoexcept

Returns a formatted string representation of this matrix.

Parameters
rowPrefixprefix for each row

Definition at line 1852 of file mat4f.hpp.

Here is the caller graph for this function:

◆ toString() [3/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
std::string jau::math::Matrix4< Value_type, >::toString ( ) const
inlinenoexcept

Definition at line 1854 of file mat4f.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ zero

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr const value_type jau::math::Matrix4< Value_type, >::zero = value_type(0)
staticconstexpr

Definition at line 126 of file mat4f.hpp.

◆ one

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr const value_type jau::math::Matrix4< Value_type, >::one = value_type(1)
staticconstexpr

Definition at line 127 of file mat4f.hpp.

◆ two

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr const value_type jau::math::Matrix4< Value_type, >::two = value_type(2)
staticconstexpr

Definition at line 128 of file mat4f.hpp.

◆ half

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr const value_type jau::math::Matrix4< Value_type, >::half = one/two
staticconstexpr

Definition at line 129 of file mat4f.hpp.

◆ inv_deviation

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr const value_type jau::math::Matrix4< Value_type, >::inv_deviation = value_type(84) * std::numeric_limits<value_type>::epsilon()
staticconstexpr

Inversion Epsilon, used with equals method to determine if two inverted matrices are close enough to be considered equal.

Using {@value}, which is ~84 times std::numeric_limits<value_type>::epsilon().

Definition at line 137 of file mat4f.hpp.


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