OpenLexocad
27.0
|
#include <GTrsf2d.h>
Public Member Functions | |
GTrsf2d () | |
returns identity transformation. More... | |
GTrsf2d (const Trsf2d &T) | |
GTrsf2d (const Mat2d &M, const XY &V) | |
Trsf2d::FormEnum | form () const |
void | invert () |
GTrsf2d | inverted () const |
bool | isNegative () const |
bool | isSingular () const |
GTrsf2d | multiplied (const GTrsf2d &T) const |
void | multiply (const GTrsf2d &T) |
void | operator *= (const GTrsf2d &T) |
GTrsf2d | operator * (const GTrsf2d &T) const |
double | operator() (const int Row, const int Col) const |
void | power (const int N) |
GTrsf2d | powered (const int N) const |
void | preMultiply (const GTrsf2d &T) |
void | setAffinity (const Ax2d &A, const double Ratio) |
void | setTranslationPart (const XY &Coord) |
void | setTrsf2d (const Trsf2d &T) |
Assigns the vectorial and translation parts of T to this transformation. More... | |
void | setValue (const int Row, const int Col, const double Value) |
void | setVectorialPart (const Mat2d &Matrix) |
Replaces the vectorial part of this transformation by Matrix. More... | |
const XY & | translationPart () const |
Returns the translation part of the GTrsf2d. More... | |
XY | transformed (const XY &Coord) const |
void | transforms (XY &Coord) const |
void | transforms (double &X, double &Y) const |
Trsf2d | trsf2d () const |
double | value (const int Row, const int Col) const |
const Mat2d & | vectorialPart () const |
const Mat2d & | _CSFDB_GetGTrsf2dmatrix () const |
const XY & | _CSFDB_GetGTrsf2dloc () const |
Trsf2d::FormEnum | _CSFDB_GetGTrsf2dshape () const |
void | _CSFDB_SetGTrsf2dshape (const Trsf2d::FormEnum p) |
double | _CSFDB_GetGTrsf2dscale () const |
void | _CSFDB_SetGTrsf2dscale (const double p) |
Defines a non persistent transformation in 2D space.
This transformation is a general transformation.
It can be a Trsf2d from package gp, an affinity, or you can
define your own transformation giving the corresponding
matrix of transformation.
With a GTrsf2d you can transform only a doublet of coordinates
XY. It is not possible to transform other geometric objects
because these transformations can change the nature of non-
elementary geometric objects.
A GTrsf2d is represented with a 2 rows * 3 columns matrix :
V1 V2 T XY XY
| a11 a12 a14 | | x | | x'|
| a21 a22 a24 | | y | | y'|
| 0 0 1 | | 1 | | 1 |
Geom::GTrsf2d::GTrsf2d | ( | ) |
returns identity transformation.
Geom::GTrsf2d::GTrsf2d | ( | const Trsf2d & | T | ) |
Converts the Trsf2d transformation T into a
general transformation.
Creates a transformation based on the matrix M and the
vector V where M defines the vectorial part of the
transformation, and V the translation part.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Trsf2d::FormEnum Geom::GTrsf2d::form | ( | ) | const |
Returns the nature of the transformation. It can be
an identity transformation, a rotation, a translation, a mirror
transformation (relative to a point or axis), a scaling
transformation, a compound transformation or some
other type of transformation.
void Geom::GTrsf2d::invert | ( | ) |
GTrsf2d Geom::GTrsf2d::inverted | ( | ) | const |
Computes the reverse transformation.
Raised an exception if the matrix of the transformation
is not inversible.
bool Geom::GTrsf2d::isNegative | ( | ) | const |
Returns true if the determinant of the vectorial part of
this transformation is negative.
bool Geom::GTrsf2d::isSingular | ( | ) | const |
Returns true if this transformation is singular (and
therefore, cannot be inverted).
Note: The Gauss LU decomposition is used to invert the
transformation matrix. Consequently, the transformation
is considered as singular if the largest pivot found is less
than or equal to Geom::Precision::linear_Resolution().
Warning
If this transformation is singular, it cannot be inverted.
Computes the transformation composed with T and <me>.
In a C++ implementation you can also write Tcomposed = <me> * T.
Example :
GTrsf2d T1, T2, Tcomp; ...............
//composition :
Tcomp = T2.multiplied(T1); // or (Tcomp = T2 * T1)
// transformation of a point
XY P(10.,3.);
XY P1(P);
Tcomp.transforms(P1); //using Tcomp
XY P2(P);
T1.transforms(P2); //using T1 then T2
T2.transforms(P2); // P1 = P2 !!!
void Geom::GTrsf2d::multiply | ( | const GTrsf2d & | T | ) |
|
inline |
|
inline |
void Geom::GTrsf2d::power | ( | const int | N | ) |
GTrsf2d Geom::GTrsf2d::powered | ( | const int | N | ) | const |
void Geom::GTrsf2d::preMultiply | ( | const GTrsf2d & | T | ) |
Computes the product of the transformation T and this
transformation, and assigns the result to this transformation:
this = T * this
void Geom::GTrsf2d::setAffinity | ( | const Ax2d & | A, |
const double | Ratio | ||
) |
Changes this transformation into an affinity of ratio Ratio
with respect to the axis A.
Note: An affinity is a point-by-point transformation that
transforms any point P into a point P' such that if H is
the orthogonal projection of P on the axis A, the vectors
HP and HP' satisfy: HP' = Ratio * HP.
void Geom::GTrsf2d::setTranslationPart | ( | const XY & | Coord | ) |
Replaces the translation part of this
transformation by the coordinates of the number pair Coord.
void Geom::GTrsf2d::setTrsf2d | ( | const Trsf2d & | T | ) |
Assigns the vectorial and translation parts of T to this transformation.
void Geom::GTrsf2d::setValue | ( | const int | Row, |
const int | Col, | ||
const double | Value | ||
) |
Replaces the coefficient (Row, Col) of the matrix representing
this transformation by Value,
Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
void Geom::GTrsf2d::setVectorialPart | ( | const Mat2d & | Matrix | ) |
Replaces the vectorial part of this transformation by Matrix.
void Geom::GTrsf2d::transforms | ( | XY & | Coord | ) | const |
void Geom::GTrsf2d::transforms | ( | double & | X, |
double & | Y | ||
) | const |
Applies this transformation to the coordinates:
Trsf2d Geom::GTrsf2d::trsf2d | ( | ) | const |
Converts this transformation into a Trsf2d transformation.
Exceptions
Standard_ConstructionError if this transformation
cannot be converted, i.e. if its form is Trsf2d::Other.
double Geom::GTrsf2d::value | ( | const int | Row, |
const int | Col | ||
) | const |
Returns the coefficients of the global matrix of transformation.
Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
const Mat2d& Geom::GTrsf2d::vectorialPart | ( | ) | const |
Computes the vectorial part of the GTrsf2d. The returned
Matrix is a 2*2 matrix.