4 x 4 matrix  
 More...
#include <JMatrix4D.hh>
 | 
|   | JMatrix4D () | 
|   | Default constructor.  
  | 
|   | 
|   | JMatrix4D (const double __a00, const double __a01, const double __a02, const double __a03, const double __a10, const double __a11, const double __a12, const double __a13, const double __a20, const double __a21, const double __a22, const double __a23, const double __a30, const double __a31, const double __a32, const double __a33) | 
|   | Contructor.  
  | 
|   | 
| JMatrix4D &  | setIdentity () | 
|   | Set to identity matrix.  
  | 
|   | 
| void  | set (const JMatrix4D &A) | 
|   | Set matrix.  
  | 
|   | 
| JMatrix4D &  | reset () | 
|   | Set matrix to the null matrix.  
  | 
|   | 
| JMatrix4D &  | transpose () | 
|   | Transpose.  
  | 
|   | 
| JMatrix4D &  | negate () | 
|   | Negate matrix.  
  | 
|   | 
| JMatrix4D &  | add (const JMatrix4D &A) | 
|   | Matrix addition.  
  | 
|   | 
| JMatrix4D &  | sub (const JMatrix4D &A) | 
|   | Matrix subtraction.  
  | 
|   | 
| JMatrix4D &  | mul (const double factor) | 
|   | Scale matrix.  
  | 
|   | 
| JMatrix4D &  | div (const double factor) | 
|   | Scale matrix.  
  | 
|   | 
| const JMatrix4D &  | mul (const JMatrix4D &A, const JMatrix4D &B) | 
|   | Matrix multiplication.  
  | 
|   | 
| bool  | equals (const JMatrix4D &A, const double eps=std::numeric_limits< double >::min()) const | 
|   | Equality.  
  | 
|   | 
| bool  | isIdentity (const double eps=std::numeric_limits< double >::min()) const | 
|   | Test identity.  
  | 
|   | 
| double  | getDeterminant () const | 
|   | Get determinant of matrix.  
  | 
|   | 
| void  | transform (double &__x0, double &__x1, double &__x2, double &__x3) const | 
|   | Transform.  
  | 
|   | 
| JMatrix4D &  | mul (const JSecond_t &object) | 
|   | Multiply with object.  
  | 
|   | 
4 x 4 matrix 
Definition at line 33 of file JMatrix4D.hh.
 
◆ JMatrix4D() [1/2]
  
  
      
        
          | JMATH::JMatrix4D::JMatrix4D  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ JMatrix4D() [2/2]
  
  
      
        
          | JMATH::JMatrix4D::JMatrix4D  | 
          ( | 
          const double |           __a00,  | 
         
        
           | 
           | 
          const double |           __a01,  | 
         
        
           | 
           | 
          const double |           __a02,  | 
         
        
           | 
           | 
          const double |           __a03,  | 
         
        
           | 
           | 
          const double |           __a10,  | 
         
        
           | 
           | 
          const double |           __a11,  | 
         
        
           | 
           | 
          const double |           __a12,  | 
         
        
           | 
           | 
          const double |           __a13,  | 
         
        
           | 
           | 
          const double |           __a20,  | 
         
        
           | 
           | 
          const double |           __a21,  | 
         
        
           | 
           | 
          const double |           __a22,  | 
         
        
           | 
           | 
          const double |           __a23,  | 
         
        
           | 
           | 
          const double |           __a30,  | 
         
        
           | 
           | 
          const double |           __a31,  | 
         
        
           | 
           | 
          const double |           __a32,  | 
         
        
           | 
           | 
          const double |           __a33 ) | 
         
       
   | 
  
inline   | 
  
 
Contructor. 
- Parameters
 - 
  
    | __a00 | (0,0)  | 
    | __a01 | (0,1)  | 
    | __a02 | (0,2)  | 
    | __a03 | (0,3)  | 
    | __a10 | (1,0)  | 
    | __a11 | (1,1)  | 
    | __a12 | (1,2)  | 
    | __a13 | (1,3)  | 
    | __a20 | (2,0)  | 
    | __a21 | (2,1)  | 
    | __a22 | (2,2)  | 
    | __a23 | (2,3)  | 
    | __a30 | (3,0)  | 
    | __a31 | (3,1)  | 
    | __a32 | (3,2)  | 
    | __a33 | (3,3)  | 
  
   
Definition at line 73 of file JMatrix4D.hh.
 
 
◆ getInstance()
  
  
      
        
          | static const JMatrix4D & JMATH::JMatrix4D::getInstance  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Get reference to unique instance of this class object. 
- Returns
 - zero matrix 
 
Definition at line 89 of file JMatrix4D.hh.
   90    {
   92 
   93      return matrix;
   94    }
JMatrix4D()
Default constructor.
 
 
 
 
◆ setIdentity()
  
  
      
        
          | JMatrix4D & JMATH::JMatrix4D::setIdentity  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Set to identity matrix. 
- Returns
 - this matrix 
 
Definition at line 102 of file JMatrix4D.hh.
  103    {
  108 
  109      return *this;
  110    }
 
 
 
◆ getIdentity()
  
  
      
        
          | static const JMatrix4D & JMATH::JMatrix4D::getIdentity  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Get reference to unique instance of this class object. 
- Returns
 - identity matrix 
 
Definition at line 118 of file JMatrix4D.hh.
  119    {
  121 
  122      return matrix;
  123    }
JMatrix4D & setIdentity()
Set to identity matrix.
 
 
 
 
◆ set()
  
  
      
        
          | void JMATH::JMatrix4D::set  | 
          ( | 
          const JMatrix4D & |           A | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ reset()
Set matrix to the null matrix. 
- Returns
 - this matrix 
 
Definition at line 142 of file JMatrix4D.hh.
  143    {
  145 
  146      return *this;
  147    }
 
 
 
◆ transpose()
Transpose. 
- Returns
 - this matrix 
 
Definition at line 155 of file JMatrix4D.hh.
  156    {
  157      using std::swap;
  158 
  165 
  166      return *this;
  167    }
 
 
 
◆ negate()
Negate matrix. 
- Returns
 - -this matrix 
 
Definition at line 175 of file JMatrix4D.hh.
  176    {
  181 
  182      return *this;
  183    }
 
 
 
◆ add()
Matrix addition. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix + A 
 
Definition at line 192 of file JMatrix4D.hh.
  193    {
  198  
  199      return *this;
  200    }
 
 
 
◆ sub()
Matrix subtraction. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix - A 
 
Definition at line 209 of file JMatrix4D.hh.
  210    {
  215  
  216      return *this;
  217    }
 
 
 
◆ mul() [1/3]
  
  
      
        
          | JMatrix4D & JMATH::JMatrix4D::mul  | 
          ( | 
          const double |           factor | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Scale matrix. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix * factor 
 
Definition at line 226 of file JMatrix4D.hh.
  227    {
  228      a00 *= factor; 
a01 *= factor; 
a02 *= factor; 
a03 *= factor;
 
  229      a10 *= factor; 
a11 *= factor; 
a12 *= factor; 
a13 *= factor;
 
  230      a20 *= factor; 
a21 *= factor; 
a22 *= factor; 
a23 *= factor;
 
  231      a30 *= factor; 
a31 *= factor; 
a32 *= factor; 
a33 *= factor;
 
  232 
  233      return *this;
  234    }
 
 
 
◆ div()
  
  
      
        
          | JMatrix4D & JMATH::JMatrix4D::div  | 
          ( | 
          const double |           factor | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Scale matrix. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix / factor 
 
Definition at line 243 of file JMatrix4D.hh.
  244    {
  245      a00 /= factor; 
a01 /= factor; 
a02 /= factor; 
a03 /= factor;
 
  246      a10 /= factor; 
a11 /= factor; 
a12 /= factor; 
a13 /= factor;
 
  247      a20 /= factor; 
a21 /= factor; 
a22 /= factor; 
a23 /= factor;
 
  248      a30 /= factor; 
a31 /= factor; 
a32 /= factor; 
a33 /= factor;
 
  249 
  250      return *this;
  251    }
 
 
 
◆ mul() [2/3]
Matrix multiplication. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix 
 
Definition at line 261 of file JMatrix4D.hh.
  263    {
  264      a00 = A.a00 * B.a00  +  A.a01 * B.a10  +  A.a02 * B.a20  +  A.a03 * B.a30;
 
  265      a01 = A.a00 * B.a01  +  A.a01 * B.a11  +  A.a02 * B.a21  +  A.a03 * B.a31;
 
  266      a02 = A.a00 * B.a02  +  A.a01 * B.a12  +  A.a02 * B.a22  +  A.a03 * B.a32;
 
  267      a03 = A.a00 * B.a03  +  A.a01 * B.a13  +  A.a02 * B.a23  +  A.a03 * B.a33;
 
  268      
  269      a10 = A.a10 * B.a00  +  A.a11 * B.a10  +  A.a12 * B.a20  +  A.a13 * B.a30;
 
  270      a11 = A.a10 * B.a01  +  A.a11 * B.a11  +  A.a12 * B.a21  +  A.a13 * B.a31;
 
  271      a12 = A.a10 * B.a02  +  A.a11 * B.a12  +  A.a12 * B.a22  +  A.a13 * B.a32;
 
  272      a13 = A.a10 * B.a03  +  A.a11 * B.a13  +  A.a12 * B.a23  +  A.a13 * B.a33;
 
  273      
  274      a20 = A.a20 * B.a00  +  A.a21 * B.a10  +  A.a22 * B.a20  +  A.a23 * B.a30;
 
  275      a21 = A.a20 * B.a01  +  A.a21 * B.a11  +  A.a22 * B.a21  +  A.a23 * B.a31;
 
  276      a22 = A.a20 * B.a02  +  A.a21 * B.a12  +  A.a22 * B.a22  +  A.a23 * B.a32;
 
  277      a23 = A.a20 * B.a03  +  A.a21 * B.a13  +  A.a22 * B.a23  +  A.a23 * B.a33;
 
  278      
  279      a30 = A.a30 * B.a00  +  A.a31 * B.a10  +  A.a32 * B.a20  +  A.a33 * B.a30;
 
  280      a31 = A.a30 * B.a01  +  A.a31 * B.a11  +  A.a32 * B.a21  +  A.a33 * B.a31;
 
  281      a32 = A.a30 * B.a02  +  A.a31 * B.a12  +  A.a32 * B.a22  +  A.a33 * B.a32;
 
  282      a33 = A.a30 * B.a03  +  A.a31 * B.a13  +  A.a32 * B.a23  +  A.a33 * B.a33;
 
  283      
  284      return *this;
  285    }
 
 
 
◆ equals()
  
  
      
        
          | bool JMATH::JMatrix4D::equals  | 
          ( | 
          const JMatrix4D & |           A,  | 
         
        
           | 
           | 
          const double |           eps = std::numeric_limits<double>::min() ) const | 
         
       
   | 
  
inline   | 
  
 
Equality. 
- Parameters
 - 
  
    | A | matrix  | 
    | eps | numerical precision  | 
  
   
- Returns
 - true if matrices identical; else false 
 
Definition at line 295 of file JMatrix4D.hh.
  297    {
  298      return (fabs(
a00 - A.a00) <= eps  &&
 
  299              fabs(
a01 - A.a01) <= eps  &&
 
  300              fabs(
a02 - A.a02) <= eps  &&
 
  301              fabs(
a03 - A.a03) <= eps  &&
 
  302              fabs(
a10 - A.a10) <= eps  &&
 
  303              fabs(
a11 - A.a11) <= eps  &&
 
  304              fabs(
a12 - A.a12) <= eps  &&
 
  305              fabs(
a13 - A.a13) <= eps  &&
 
  306              fabs(
a20 - A.a20) <= eps  &&
 
  307              fabs(
a21 - A.a21) <= eps  &&
 
  308              fabs(
a22 - A.a22) <= eps  &&
 
  309              fabs(
a23 - A.a23) <= eps  &&
 
  310              fabs(
a30 - A.a30) <= eps  &&
 
  311              fabs(
a31 - A.a31) <= eps  &&
 
  312              fabs(
a32 - A.a32) <= eps  &&
 
  313              fabs(
a33 - A.a33) <= eps);
 
  314    }
 
 
 
◆ isIdentity()
  
  
      
        
          | bool JMATH::JMatrix4D::isIdentity  | 
          ( | 
          const double |           eps = std::numeric_limits<double>::min() | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Test identity. 
- Parameters
 - 
  
  
 
- Returns
 - true if identity matrix; else false 
 
Definition at line 323 of file JMatrix4D.hh.
  324    {
  326    }
static const JMatrix4D & getIdentity()
Get reference to unique instance of this class object.
 
bool equals(const JMatrix4D &A, const double eps=std::numeric_limits< double >::min()) const
Equality.
 
 
 
 
◆ getDeterminant()
  
  
      
        
          | double JMATH::JMatrix4D::getDeterminant  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get determinant of matrix. 
- Returns
 - determinant of matrix 
 
Definition at line 334 of file JMatrix4D.hh.
  335    {
  336      double det = 0.0;
  337 
  341 
  345 
  349 
  353 
  354      return det;
  355    }
 
 
 
◆ transform()
  
  
      
        
          | void JMATH::JMatrix4D::transform  | 
          ( | 
          double & |           __x0,  | 
         
        
           | 
           | 
          double & |           __x1,  | 
         
        
           | 
           | 
          double & |           __x2,  | 
         
        
           | 
           | 
          double & |           __x3 ) const | 
         
       
   | 
  
inline   | 
  
 
Transform. 
- Parameters
 - 
  
    | __x0 | x0 value  | 
    | __x1 | x1 value  | 
    | __x2 | x2 value  | 
    | __x3 | x3 value  | 
  
   
Definition at line 366 of file JMatrix4D.hh.
  367    {
  368      const double x0 = 
a00 * __x0  +  
a01 * __x1  +  
a02 * __x2  +  
a03 * __x3;
 
  369      const double x1 = 
a10 * __x0  +  
a11 * __x1  +  
a12 * __x2  +  
a13 * __x3;
 
  370      const double x2 = 
a20 * __x0  +  
a21 * __x1  +  
a22 * __x2  +  
a23 * __x3;
 
  371      const double x3 = 
a30 * __x0  +  
a31 * __x1  +  
a32 * __x2  +  
a33 * __x3;
 
  372 
  373      __x0 = x0;
  374      __x1 = x1;
  375      __x2 = x2;
  376      __x3 = x3;
  377    }
 
 
 
◆ mul() [3/3]
Multiply with object. 
- Parameters
 - 
  
  
 
- Returns
 - result object 
 
Definition at line 354 of file JMath.hh.
  355    {
  356      return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
  357    }
 
 
 
◆ operator>>
Read matrix from input. 
- Parameters
 - 
  
  
 
- Returns
 - reader 
 
Definition at line 387 of file JMatrix4D.hh.
  388    {
  389      in >> matrix.a00;  in >> matrix.a01;  in >> matrix.a02;  in >> matrix.a03;
  390      in >> matrix.a10;  in >> matrix.a11;  in >> matrix.a12;  in >> matrix.a13;
  391      in >> matrix.a20;  in >> matrix.a21;  in >> matrix.a22;  in >> matrix.a23;
  392      in >> matrix.a30;  in >> matrix.a31;  in >> matrix.a32;  in >> matrix.a33;
  393 
  394      return in;
  395    }
 
 
 
◆ operator<< [1/2]
Write matrix to output. 
- Parameters
 - 
  
  
 
- Returns
 - writer 
 
Definition at line 405 of file JMatrix4D.hh.
  406    {
  407      out << matrix.a00;  out << matrix.a01;  out << matrix.a02;  out << matrix.a03;
  408      out << matrix.a10;  out << matrix.a11;  out << matrix.a12;  out << matrix.a13;
  409      out << matrix.a20;  out << matrix.a21;  out << matrix.a22;  out << matrix.a23;
  410      out << matrix.a30;  out << matrix.a31;  out << matrix.a32;  out << matrix.a33;
  411 
  412      return out;
  413    }
 
 
 
◆ operator<< [2/2]
  
  
      
        
          | std::ostream & operator<<  | 
          ( | 
          std::ostream & |           out,  | 
         
        
           | 
           | 
          const JMatrix4D & |           A ) | 
         
       
   | 
  
friend   | 
  
 
Print ASCII formatted output. 
- Parameters
 - 
  
  
 
- Returns
 - output stream 
 
Definition at line 423 of file JMatrix4D.hh.
  424    {
  426 
  428 
  429      out << format << A.a00 << ' ' << format << A.a01 << ' ' << format << A.a02 << ' ' << format << A.a03 << endl;
  430      out << format << A.a10 << ' ' << format << A.a11 << ' ' << format << A.a12 << ' ' << format << A.a13 << endl;
  431      out << format << A.a20 << ' ' << format << A.a21 << ' ' << format << A.a22 << ' ' << format << A.a23 << endl;
  432      out << format << A.a30 << ' ' << format << A.a31 << ' ' << format << A.a32 << ' ' << format << A.a33 << endl;
  433 
  434      return out;
  435    }
JFormat_t & getFormat()
Get format for given type.
 
 
 
 
◆ a00
      
        
          | double JMATH::JMatrix4D::a00 | 
        
      
 
 
◆ a01
      
        
          | double JMATH::JMatrix4D::a01 | 
        
      
 
 
◆ a02
      
        
          | double JMATH::JMatrix4D::a02 | 
        
      
 
 
◆ a03
      
        
          | double JMATH::JMatrix4D::a03 | 
        
      
 
 
◆ a10
      
        
          | double JMATH::JMatrix4D::a10 | 
        
      
 
 
◆ a11
      
        
          | double JMATH::JMatrix4D::a11 | 
        
      
 
 
◆ a12
      
        
          | double JMATH::JMatrix4D::a12 | 
        
      
 
 
◆ a13
      
        
          | double JMATH::JMatrix4D::a13 | 
        
      
 
 
◆ a20
      
        
          | double JMATH::JMatrix4D::a20 | 
        
      
 
 
◆ a21
      
        
          | double JMATH::JMatrix4D::a21 | 
        
      
 
 
◆ a22
      
        
          | double JMATH::JMatrix4D::a22 | 
        
      
 
 
◆ a23
      
        
          | double JMATH::JMatrix4D::a23 | 
        
      
 
 
◆ a30
      
        
          | double JMATH::JMatrix4D::a30 | 
        
      
 
 
◆ a31
      
        
          | double JMATH::JMatrix4D::a31 | 
        
      
 
 
◆ a32
      
        
          | double JMATH::JMatrix4D::a32 | 
        
      
 
 
◆ a33
      
        
          | double JMATH::JMatrix4D::a33 | 
        
      
 
 
The documentation for this class was generated from the following file: