sculpto
Public Member Functions | Static Public Member Functions | List of all members
scl::math::matr3< T > Class Template Reference

#include <matr3.h>

Inheritance diagram for scl::math::matr3< T >:
scl::math::matr3_data< T >

Public Member Functions

 matr3 ()
 
 matr3 (T A00, T A01, T A02, T A10, T A11, T A12, T A20, T A21, T A22)
 
 matr3 (T A[3][3])
 
 matr3 (T A00)
 
 matr3 (const matr4< T > Matr4x4)
 
Det ()
 
T & operator[] (int Index)
 
operator[] (int Index) const
 
- Public Member Functions inherited from scl::math::matr3_data< T >
 matr3_data ()
 
 matr3_data (T A00, T A01, T A02, T A10, T A11, T A12, T A20, T A21, T A22)
 
 matr3_data (T A00)
 
 operator T* ()
 

Static Public Member Functions

static T Det (T A11, T A12, T A13, T A21, T A22, T A23, T A31, T A32, T A33)
 

Additional Inherited Members

- Public Attributes inherited from scl::math::matr3_data< T >
A [3][3]
 

Detailed Description

template<typename T>
class scl::math::matr3< T >

3x3 matrix class.

Definition at line 68 of file matr3.h.

Constructor & Destructor Documentation

◆ matr3() [1/5]

template<typename T >
scl::math::matr3< T >::matr3 ( )
inline
  • Default matrix constructor. Set identity matrix.
Parameters
None.

Definition at line 77 of file matr3.h.

77: matr4_data<T>() {}

◆ matr3() [2/5]

template<typename T >
scl::math::matr3< T >::matr3 ( A00,
A01,
A02,
A10,
A11,
A12,
A20,
A21,
A22 
)
inline
  • Matrix constructor bt 16 values.
Parameters
A00-A33- matrx valeus.

Definition at line 84 of file matr3.h.

86 :
87 matr3_data<T>(A00, A01, A02,
88 A10, A11, A12,
89 A20, A21, A22) {}

◆ matr3() [3/5]

template<typename T >
scl::math::matr3< T >::matr3 ( A[3][3])
inline
  • Matrix contructor by array of values.
Parameters
A- array of values to set in matrix

Definition at line 96 of file matr3.h.

96{ memcpy(this->A, A, 3 * 3 * sizeof(T)); }

◆ matr3() [4/5]

template<typename T >
scl::math::matr3< T >::matr3 ( A00)
inline
  • Matrix constructor by 1 value.
Parameters
A00- calue to set to all matrix cells.

Definition at line 103 of file matr3.h.

103: matr3_data<T>(A00) {}

◆ matr3() [5/5]

template<typename T >
scl::math::matr3< T >::matr3 ( const matr4< T >  Matr4x4)
inline

Definition at line 105 of file matr3.h.

105 :
106 matr3_data<T>(Matr4x4.A[0][0], Matr4x4.A[0][1], Matr4x4.A[0][2],
107 Matr4x4.A[1][0], Matr4x4.A[1][1], Matr4x4.A[1][2],
108 Matr4x4.A[2][0], Matr4x4.A[2][1], Matr4x4.A[2][2]) {}

Member Function Documentation

◆ Det() [1/2]

template<typename T >
T scl::math::matr3< T >::Det ( )
inline
  • Calculate determinant of 3x3 Matrix.
Parameters
A11-A33- matrix components.
Returns
matrix determinant.

Definition at line 116 of file matr3.h.

117 {
118 return (this->A[0][0] * this->A[1][1] * this->A[2][2] -
119 this->A[0][0] * this->A[1][2] * this->A[2][1] -
120 this->A[0][1] * this->A[1][0] * this->A[2][2] +
121 this->A[0][1] * this->A[1][2] * this->A[2][0] +
122 this->A[0][2] * this->A[1][0] * this->A[2][1] -
123 this->A[0][2] * this->A[1][1] * this->A[2][0]);
124 }

◆ Det() [2/2]

template<typename T >
static T scl::math::matr3< T >::Det ( A11,
A12,
A13,
A21,
A22,
A23,
A31,
A32,
A33 
)
inlinestatic
  • Calculate determinant of 3x3 Matrix.
Parameters
A11-A33- matrix components.
Returns
matrix determinant.

Definition at line 132 of file matr3.h.

135 {
136 return (A11 * A22 * A33 - A11 * A23 * A32 - A12 * A21 * A33 +
137 A12 * A23 * A31 + A13 * A21 * A32 - A13 * A22 * A31);
138 }

◆ operator[]() [1/2]

template<typename T >
T & scl::math::matr3< T >::operator[] ( int  Index)
inline
  • Getting matrix cell value operator overloading.
Parameters
Index- cell index.
Returns
vector cartesian coordinate.

Definition at line 146 of file matr3.h.

147 {
148 return this->A[math::Clamp(Index, 0, 8)];
149 }
T Clamp(T Num, T Min=0, T Max=1)
Definition: math_common.h:77

◆ operator[]() [2/2]

template<typename T >
T scl::math::matr3< T >::operator[] ( int  Index) const
inline
  • Getting coordinate operator overloading.
Parameters
Index- coordinate index.
Returns
vector cartesian coordinate.

Definition at line 157 of file matr3.h.

158 {
159 return this->A[math::Clamp(Index, 0, 8)];
160 }

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