OpenLexocad  27.1
Geom::Mat Class Reference

#include <Mat.h>

Public Member Functions

 Mat ()
 creates a matrix with null coefficients.
More...
 
 Mat (const double a11, const double a12, const double a13, const double a21, const double a22, const double a23, const double a31, const double a32, const double a33)
 
 Mat (const XYZ &Col1, const XYZ &Col2, const XYZ &Col3)
 
void setCol (const int Col, const XYZ &Value)
 
void setCols (const XYZ &Col1, const XYZ &Col2, const XYZ &Col3)
 
void setCross (const XYZ &Ref)
 
void setDiagonal (const double X1, const double X2, const double X3)
 
void setDot (const XYZ &Ref)
 
void setIdentity ()
 Modifies this matrix so that it represents the Identity matrix.
More...
 
bool isIdentity () const
 Returns true if this matrix represents the Identity matrix.
More...
 
void setRotation (const XYZ &Axis, const double Ang)
 
void setRow (const int Row, const XYZ &Value)
 
void setRows (const XYZ &Row1, const XYZ &Row2, const XYZ &Row3)
 
void setScale (const double S)
 
void setValue (const int Row, const int Col, const double Value)
 
XYZ column (const int Col) const
 
double determinant () const
 Computes the determinant of the matrix.
More...
 
XYZ diagonal () const
 Returns the main diagonal of the matrix.
More...
 
XYZ row (const int Row) const
 
const double & value (const int Row, const int Col) const
 
const double & operator() (const int Row, const int Col) const
 
double & changeValue (const int Row, const int Col)
 
double & operator() (const int Row, const int Col)
 
bool isSingular () const
 
void add (const Mat &Other)
 
void operator+= (const Mat &Other)
 
Mat added (const Mat &Other) const
 
Mat operator+ (const Mat &Other) const
 
void divide (const double Scalar)
 
void operator/= (const double Scalar)
 
Mat divided (const double Scalar) const
 Divides all the coefficients of the matrix by Scalar
More...
 
Mat operator/ (const double Scalar) const
 
void invert ()
 
Mat inverted () const
 
Mat multiplied (const Mat &Other) const
 Computes the product of two matrices <me> * <Other>
More...
 
Mat operator * (const Mat &Other) const
 
void multiply (const Mat &Other)
 Computes the product of two matrices <me> = <Other> * <me>.
More...
 
void operator *= (const Mat &Other)
 
void preMultiply (const Mat &Other)
 
Mat multiplied (const double Scalar) const
 
Mat operator * (const double Scalar) const
 
void multiply (const double Scalar)
 Multiplies all the coefficients of the matrix by Scalar
More...
 
void operator *= (const double Scalar)
 
void power (const int N)
 
Mat powered (const int N) const
 
void subtract (const Mat &Other)
 
void operator-= (const Mat &Other)
 
Mat subtracted (const Mat &Other) const
 
Mat operator- (const Mat &Other) const
 
bool operator== (const Mat &Other) const
 
bool operator!= (const Mat &Other) const
 
void transpose ()
 
Mat transposed () const
 Transposes the matrix. A(j, i) -> A (i, j)
More...
 
Geom::XYZ computeEulerAngles () const
 
void initFromQuaternion (double w, double x, double y, double z)
 
bool toQuaternion (double &w, double &x, double &y, double &z)
 

Friends

class XYZ
 
class CA_Transfrom
 
class gp_GTrsf
 
class Geom::GTrsf
 

Detailed Description

Describes a three column, three row matrix. This sort of
object is used in various vectorial or matrix computations.

Constructor & Destructor Documentation

◆ Mat() [1/3]

Geom::Mat::Mat ( )

creates a matrix with null coefficients.

◆ Mat() [2/3]

Geom::Mat::Mat ( const double  a11,
const double  a12,
const double  a13,
const double  a21,
const double  a22,
const double  a23,
const double  a31,
const double  a32,
const double  a33 
)

◆ Mat() [3/3]

Geom::Mat::Mat ( const XYZ Col1,
const XYZ Col2,
const XYZ Col3 
)

Creates a matrix.
Col1, Col2, Col3 are the 3 columns of the matrix.

Member Function Documentation

◆ add()

void Geom::Mat::add ( const Mat Other)

◆ added()

Mat Geom::Mat::added ( const Mat Other) const

Computes the sum of this matrix and
the matrix Other for each coefficient of the matrix :
<me>.Coef(i,j) + <Other>.Coef(i,j)

◆ changeValue()

double& Geom::Mat::changeValue ( const int  Row,
const int  Col 
)

Returns the coefficient of range (Row, Col)
Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3

◆ column()

XYZ Geom::Mat::column ( const int  Col) const

Returns the column of Col index.
Raises OutOfRange if Col < 1 or Col > 3

◆ computeEulerAngles()

Geom::XYZ Geom::Mat::computeEulerAngles ( ) const

◆ determinant()

double Geom::Mat::determinant ( ) const

Computes the determinant of the matrix.

◆ diagonal()

XYZ Geom::Mat::diagonal ( ) const

Returns the main diagonal of the matrix.

◆ divide()

void Geom::Mat::divide ( const double  Scalar)

◆ divided()

Mat Geom::Mat::divided ( const double  Scalar) const

Divides all the coefficients of the matrix by Scalar

◆ initFromQuaternion()

void Geom::Mat::initFromQuaternion ( double  w,
double  x,
double  y,
double  z 
)

◆ invert()

void Geom::Mat::invert ( )

◆ inverted()

Mat Geom::Mat::inverted ( ) const

Inverses the matrix and raises if the matrix is singular.

  • Invert assigns the result to this matrix, while
  • Inverted creates a new one.
    Warning
    The Gauss LU decomposition is used to invert the matrix.
    Consequently, the matrix is considered as singular if the
    largest pivot found is less than or equal to Geom::Precision::linear_Resolution().
    Exceptions
    Standard_ConstructionError if this matrix is singular,
    and therefore cannot be inverted.

◆ isIdentity()

bool Geom::Mat::isIdentity ( ) const

Returns true if this matrix represents the Identity matrix.

◆ isSingular()

bool Geom::Mat::isSingular ( ) const

The Gauss LU decomposition is used to invert the matrix
(see Math package) so the matrix is considered as singular if
the largest pivot found is lower or equal to Resolution from gp.

◆ multiplied() [1/2]

Mat Geom::Mat::multiplied ( const Mat Other) const

Computes the product of two matrices <me> * <Other>

◆ multiplied() [2/2]

Mat Geom::Mat::multiplied ( const double  Scalar) const

◆ multiply() [1/2]

void Geom::Mat::multiply ( const Mat Other)

Computes the product of two matrices <me> = <Other> * <me>.

◆ multiply() [2/2]

void Geom::Mat::multiply ( const double  Scalar)

Multiplies all the coefficients of the matrix by Scalar

◆ operator *() [1/2]

Mat Geom::Mat::operator * ( const Mat Other) const
inline

◆ operator *() [2/2]

Mat Geom::Mat::operator * ( const double  Scalar) const
inline

◆ operator *=() [1/2]

void Geom::Mat::operator *= ( const Mat Other)
inline

◆ operator *=() [2/2]

void Geom::Mat::operator *= ( const double  Scalar)
inline

◆ operator!=()

bool Geom::Mat::operator!= ( const Mat Other) const
inline

◆ operator()() [1/2]

const double& Geom::Mat::operator() ( const int  Row,
const int  Col 
) const
inline

◆ operator()() [2/2]

double& Geom::Mat::operator() ( const int  Row,
const int  Col 
)
inline

◆ operator+()

Mat Geom::Mat::operator+ ( const Mat Other) const
inline

◆ operator+=()

void Geom::Mat::operator+= ( const Mat Other)
inline

◆ operator-()

Mat Geom::Mat::operator- ( const Mat Other) const
inline

◆ operator-=()

void Geom::Mat::operator-= ( const Mat Other)
inline

◆ operator/()

Mat Geom::Mat::operator/ ( const double  Scalar) const
inline

◆ operator/=()

void Geom::Mat::operator/= ( const double  Scalar)
inline

◆ operator==()

bool Geom::Mat::operator== ( const Mat Other) const

◆ power()

void Geom::Mat::power ( const int  N)

◆ powered()

Mat Geom::Mat::powered ( const int  N) const

Computes <me> = <me> * <me> * .......* <me>, N time.
if N = 0 <me> = Identity
if N < 0 <me> = <me>.Invert() *...........* <me>.Invert().
If N < 0 an exception will be raised if the matrix is not
invertible

◆ preMultiply()

void Geom::Mat::preMultiply ( const Mat Other)

◆ row()

XYZ Geom::Mat::row ( const int  Row) const

returns the row of Row index.
Raises OutOfRange if Row < 1 or Row > 3

◆ setCol()

void Geom::Mat::setCol ( const int  Col,
const XYZ Value 
)

Assigns the three coordinates of Value to the column of index
Col of this matrix.
Raises OutOfRange if Col < 1 or Col > 3.

◆ setCols()

void Geom::Mat::setCols ( const XYZ Col1,
const XYZ Col2,
const XYZ Col3 
)

Assigns the number triples Col1, Col2, Col3 to the three
columns of this matrix.

◆ setCross()

void Geom::Mat::setCross ( const XYZ Ref)

Modifies the matrix M so that applying it to any number
triple (X, Y, Z) produces the same result as the cross
product of Ref and the number triple (X, Y, Z):
i.e.: M * {X,Y,Z}t = Ref.Cross({X, Y ,Z})
this matrix is anti symmetric. To apply this matrix to the
triplet {XYZ} is the same as to do the cross product between the
triplet Ref and the triplet {XYZ}.
Note: this matrix is anti-symmetric.

◆ setDiagonal()

void Geom::Mat::setDiagonal ( const double  X1,
const double  X2,
const double  X3 
)

Modifies the main diagonal of the matrix.
<me>.Value (1, 1) = X1
<me>.Value (2, 2) = X2
<me>.Value (3, 3) = X3
The other coefficients of the matrix are not modified.

◆ setDot()

void Geom::Mat::setDot ( const XYZ Ref)

Modifies this matrix so that applying it to any number
triple (X, Y, Z) produces the same result as the scalar
product of Ref and the number triple (X, Y, Z):
this * (X,Y,Z) = Ref.(X,Y,Z)
Note: this matrix is symmetric.

◆ setIdentity()

void Geom::Mat::setIdentity ( )

Modifies this matrix so that it represents the Identity matrix.

◆ setRotation()

void Geom::Mat::setRotation ( const XYZ Axis,
const double  Ang 
)

Modifies this matrix so that it represents a rotation. Ang is the angular value in
radians and the XYZ axis gives the direction of the
rotation.
Raises ConstructionError if XYZ.Modulus() <= Resolution()

◆ setRow()

void Geom::Mat::setRow ( const int  Row,
const XYZ Value 
)

Assigns the three coordinates of Value to the row of index
Row of this matrix. Raises OutOfRange if Row < 1 or Row > 3.

◆ setRows()

void Geom::Mat::setRows ( const XYZ Row1,
const XYZ Row2,
const XYZ Row3 
)

Assigns the number triples Row1, Row2, Row3 to the three
rows of this matrix.

◆ setScale()

void Geom::Mat::setScale ( const double  S)

Modifies the the matrix so that it represents
a scaling transformation, where S is the scale factor. :
| S 0.0 0.0 |
<me> = | 0.0 S 0.0 |
| 0.0 0.0 S |

◆ setValue()

void Geom::Mat::setValue ( const int  Row,
const int  Col,
const double  Value 
)

Assigns

to the coefficient of row Row, column Col of this matrix.
Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3

◆ subtract()

void Geom::Mat::subtract ( const Mat Other)

◆ subtracted()

Mat Geom::Mat::subtracted ( const Mat Other) const

cOmputes for each coefficient of the matrix :
<me>.Coef(i,j) - <Other>.Coef(i,j)

◆ toQuaternion()

bool Geom::Mat::toQuaternion ( double &  w,
double &  x,
double &  y,
double &  z 
)

◆ transpose()

void Geom::Mat::transpose ( )

◆ transposed()

Mat Geom::Mat::transposed ( ) const

Transposes the matrix. A(j, i) -> A (i, j)

◆ value()

const double& Geom::Mat::value ( const int  Row,
const int  Col 
) const

Returns the coefficient of range (Row, Col)
Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3

Friends And Related Function Documentation

◆ CA_Transfrom

friend class CA_Transfrom
friend

◆ Geom::GTrsf

friend class Geom::GTrsf
friend

◆ gp_GTrsf

friend class gp_GTrsf
friend

◆ XYZ

friend class XYZ
friend

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