OpenLexocad
28.0
|
#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 |
Describes a two column, two row matrix. This sort of
object is used in various vectorial or matrix computations.
Geom::Mat2d::Mat2d | ( | ) |
Creates a matrix with null coefficients.
void Geom::Mat2d::add | ( | const Mat2d & | Other | ) |
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:
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
XY Geom::Mat2d::column | ( | const int | Col | ) | const |
Returns the column of Col index.
Raises OutOfRange if Col < 1 or Col > 2
double Geom::Mat2d::determinant | ( | ) | const |
Computes the determinant of the matrix.
XY Geom::Mat2d::diagonal | ( | ) | const |
Returns the main diagonal of the matrix.
void Geom::Mat2d::divide | ( | const double | Scalar | ) |
Mat2d Geom::Mat2d::divided | ( | const double | Scalar | ) | const |
Divides all the coefficients of the matrix by a scalar.
void Geom::Mat2d::invert | ( | ) |
Mat2d Geom::Mat2d::inverted | ( | ) | const |
Inverses the matrix and raises exception if the matrix
is singular.
|
inlinestatic |
|
inlinestatic |
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.
Mat2d Geom::Mat2d::multiplied | ( | const double | Scalar | ) | const |
void Geom::Mat2d::multiply | ( | const double | Scalar | ) |
Multiplies all the coefficients of the matrix by a scalar.
void Geom::Mat2d::multiply | ( | const Mat2d & | Other | ) |
Computes the product of two matrices <me> * <Other>
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Geom::Mat2d::power | ( | const int | N | ) |
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
void Geom::Mat2d::preMultiply | ( | const Mat2d & | Other | ) |
Modifies this matrix by pre-multiplying it by the matrix Other
<me> = Other * <me>.
XY Geom::Mat2d::row | ( | const int | Row | ) | const |
Returns the row of index Row.
//! Raised if Row < 1 or Row > 2
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.
Assigns the number pairs Col1, Col2 to the two columns of this matrix
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.
void Geom::Mat2d::setIdentity | ( | ) |
Modifies this matrix, so that it represents the Identity matrix.
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.
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.
Assigns the number pairs Row1, Row2 to the two rows of this matrix.
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 |
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
void Geom::Mat2d::subtract | ( | const Mat2d & | Other | ) |
Computes for each coefficient of the matrix :
<me>.Coef(i,j) - <Other>.Coef(i,j)
void Geom::Mat2d::transpose | ( | ) |
Mat2d Geom::Mat2d::transposed | ( | ) | const |
Transposes the matrix. A(j, i) -> A (i, j)
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
|
friend |
|
friend |
|
friend |