OpenLexocad  27.1
Geom::Mat2d Class Reference

#include <Mat2d.h>

Public Member Functions

 Mat2d ()
 Creates a matrix with null coefficients.
More...
 
 Mat2d (const XY &Col1, const XY &Col2)
 Col1, Col2 are the 2 columns of the matrix.
More...
 
void add (const Mat2d &Other)
 
Mat2d added (const Mat2d &Other) const
 
double & changeValue (const int Row, const int Col)
 
XY column (const int Col) const
 
double determinant () const
 Computes the determinant of the matrix.
More...
 
XY diagonal () const
 Returns the main diagonal of the matrix.
More...
 
void divide (const double Scalar)
 
Mat2d divided (const double Scalar) const
 Divides all the coefficients of the matrix by a scalar.
More...
 
void invert ()
 
Mat2d inverted () const
 
bool isSingular () const
 
Mat2d multiplied (const Mat2d &Other) const
 
void multiply (const Mat2d &Other)
 Computes the product of two matrices <me> * <Other>
More...
 
Mat2d multiplied (const double Scalar) const
 
void multiply (const double Scalar)
 Multiplies all the coefficients of the matrix by a scalar.
More...
 
void operator+= (const Mat2d &Other)
 
Mat2d operator+ (const Mat2d &Other) const
 
void operator-= (const Mat2d &Other)
 
Mat2d operator- (const Mat2d &Other) const
 
void operator *= (const double Scalar)
 
Mat2d operator * (const double Scalar) const
 
Mat2d operator * (const Mat2d &Other) const
 
void operator/= (const double Scalar)
 
Mat2d operator/ (const double Scalar) const
 
const double & operator() (const int Row, const int Col) const
 
double & operator() (const int Row, const int Col)
 
void power (const int N)
 
Mat2d powered (const int N) const
 
void preMultiply (const Mat2d &Other)
 
XY row (const int Row) const
 Returns the row of index Row.
//! Raised if Row < 1 or Row > 2
More...
 
void setCol (const int Col, const XY &Value)
 
void setCols (const XY &Col1, const XY &Col2)
 Assigns the number pairs Col1, Col2 to the two columns of this matrix
More...
 
void setDiagonal (const double X1, const double X2)
 
void setIdentity ()
 Modifies this matrix, so that it represents the Identity matrix.
More...
 
void setRotation (const double Ang)
 
void setRow (const int Row, const XY &Value)
 
void setRows (const XY &Row1, const XY &Row2)
 Assigns the number pairs Row1, Row2 to the two rows of this matrix.
More...
 
void setScale (const double S)
 
void setValue (const int Row, const int Col, const double Value)
 
void subtract (const Mat2d &Other)
 
Mat2d subtracted (const Mat2d &Other) const
 
void transpose ()
 
Mat2d transposed () const
 Transposes the matrix. A(j, i) -> A (i, j)
More...
 
const double & value (const int Row, const int Col) const
 

Static Public Member Functions

static bool isEven (const int Value)
 
static bool isOdd (const int Value)
 

Friends

class GTrsf2d
 
class Trsf2d
 
class XY
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Mat2d() [1/2]

Geom::Mat2d::Mat2d ( )

Creates a matrix with null coefficients.

◆ Mat2d() [2/2]

Geom::Mat2d::Mat2d ( const XY Col1,
const XY Col2 
)

Col1, Col2 are the 2 columns of the matrix.

Member Function Documentation

◆ add()

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

◆ added()

Mat2d Geom::Mat2d::added ( const Mat2d 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)
Note:

  • operator += assigns the result to this matrix, while
  • operator + creates a new one.

◆ changeValue()

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

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

◆ column()

XY Geom::Mat2d::column ( const int  Col) const

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

◆ determinant()

double Geom::Mat2d::determinant ( ) const

Computes the determinant of the matrix.

◆ diagonal()

XY Geom::Mat2d::diagonal ( ) const

Returns the main diagonal of the matrix.

◆ divide()

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

◆ divided()

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

Divides all the coefficients of the matrix by a scalar.

◆ invert()

void Geom::Mat2d::invert ( )

◆ inverted()

Mat2d Geom::Mat2d::inverted ( ) const

Inverses the matrix and raises exception if the matrix
is singular.

◆ isEven()

static bool Geom::Mat2d::isEven ( const int  Value)
inlinestatic

◆ isOdd()

static bool Geom::Mat2d::isOdd ( const int  Value)
inlinestatic

◆ isSingular()

bool Geom::Mat2d::isSingular ( ) const

Returns true if this matrix is singular (and therefore, cannot be inverted).
The Gauss LU decomposition is used to invert the matrix
so the matrix is considered as singular if the largest
pivot found is lower or equal to Resolution from gp.

◆ multiplied() [1/2]

Mat2d Geom::Mat2d::multiplied ( const Mat2d Other) const

◆ multiplied() [2/2]

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

◆ multiply() [1/2]

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

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

◆ multiply() [2/2]

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

Multiplies all the coefficients of the matrix by a scalar.

◆ operator *() [1/2]

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

◆ operator *() [2/2]

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

◆ operator *=()

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

◆ operator()() [1/2]

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

◆ operator()() [2/2]

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

◆ operator+()

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

◆ operator+=()

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

◆ operator-()

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

◆ operator-=()

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

◆ operator/()

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

◆ operator/=()

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

◆ power()

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

◆ powered()

Mat2d Geom::Mat2d::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 can be raised if the matrix is not
invertible

◆ preMultiply()

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

Modifies this matrix by pre-multiplying it by the matrix Other
<me> = Other * <me>.

◆ row()

XY Geom::Mat2d::row ( const int  Row) const

Returns the row of index Row.
//! Raised if Row < 1 or Row > 2

◆ setCol()

void Geom::Mat2d::setCol ( const int  Col,
const XY Value 
)

Assigns the two coordinates of Value to the column of range
Col of this matrix
Raises OutOfRange if Col < 1 or Col > 2.

◆ setCols()

void Geom::Mat2d::setCols ( const XY Col1,
const XY Col2 
)

Assigns the number pairs Col1, Col2 to the two columns of this matrix

◆ setDiagonal()

void Geom::Mat2d::setDiagonal ( const double  X1,
const double  X2 
)

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

◆ setIdentity()

void Geom::Mat2d::setIdentity ( )

Modifies this matrix, so that it represents the Identity matrix.

◆ setRotation()

void Geom::Mat2d::setRotation ( const double  Ang)

Modifies this matrix, so that it represents a rotation. Ang is the angular
value in radian of the rotation.

◆ setRow()

void Geom::Mat2d::setRow ( const int  Row,
const XY Value 
)

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

◆ setRows()

void Geom::Mat2d::setRows ( const XY Row1,
const XY Row2 
)

Assigns the number pairs Row1, Row2 to the two rows of this matrix.

◆ setScale()

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

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

◆ setValue()

void Geom::Mat2d::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 > 2 or Col < 1 or Col > 2

◆ subtract()

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

◆ subtracted()

Mat2d Geom::Mat2d::subtracted ( const Mat2d Other) const

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

◆ transpose()

void Geom::Mat2d::transpose ( )

◆ transposed()

Mat2d Geom::Mat2d::transposed ( ) const

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

◆ value()

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

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

Friends And Related Function Documentation

◆ GTrsf2d

friend class GTrsf2d
friend

◆ Trsf2d

friend class Trsf2d
friend

◆ XY

friend class XY
friend

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