OpenLexocad  27.1
Geom::GTrsf2d Class Reference

#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 XYtranslationPart () 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 Mat2dvectorialPart () 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)
 

Detailed Description

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 |

Constructor & Destructor Documentation

◆ GTrsf2d() [1/3]

Geom::GTrsf2d::GTrsf2d ( )

returns identity transformation.

◆ GTrsf2d() [2/3]

Geom::GTrsf2d::GTrsf2d ( const Trsf2d T)

Converts the Trsf2d transformation T into a
general transformation.

◆ GTrsf2d() [3/3]

Geom::GTrsf2d::GTrsf2d ( const Mat2d M,
const XY V 
)

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.

Member Function Documentation

◆ _CSFDB_GetGTrsf2dloc()

const XY& Geom::GTrsf2d::_CSFDB_GetGTrsf2dloc ( ) const
inline

◆ _CSFDB_GetGTrsf2dmatrix()

const Mat2d& Geom::GTrsf2d::_CSFDB_GetGTrsf2dmatrix ( ) const
inline

◆ _CSFDB_GetGTrsf2dscale()

double Geom::GTrsf2d::_CSFDB_GetGTrsf2dscale ( ) const
inline

◆ _CSFDB_GetGTrsf2dshape()

Trsf2d::FormEnum Geom::GTrsf2d::_CSFDB_GetGTrsf2dshape ( ) const
inline

◆ _CSFDB_SetGTrsf2dscale()

void Geom::GTrsf2d::_CSFDB_SetGTrsf2dscale ( const double  p)
inline

◆ _CSFDB_SetGTrsf2dshape()

void Geom::GTrsf2d::_CSFDB_SetGTrsf2dshape ( const Trsf2d::FormEnum  p)
inline

◆ form()

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.

◆ invert()

void Geom::GTrsf2d::invert ( )

◆ inverted()

GTrsf2d Geom::GTrsf2d::inverted ( ) const

Computes the reverse transformation.
Raised an exception if the matrix of the transformation
is not inversible.

◆ isNegative()

bool Geom::GTrsf2d::isNegative ( ) const

Returns true if the determinant of the vectorial part of
this transformation is negative.

◆ isSingular()

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.

◆ multiplied()

GTrsf2d Geom::GTrsf2d::multiplied ( const GTrsf2d T) const

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 !!!

◆ multiply()

void Geom::GTrsf2d::multiply ( const GTrsf2d T)

◆ operator *()

GTrsf2d Geom::GTrsf2d::operator * ( const GTrsf2d T) const
inline

◆ operator *=()

void Geom::GTrsf2d::operator *= ( const GTrsf2d T)
inline

◆ operator()()

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

◆ power()

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

◆ powered()

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

◆ preMultiply()

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

◆ setAffinity()

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.

◆ setTranslationPart()

void Geom::GTrsf2d::setTranslationPart ( const XY Coord)

Replaces the translation part of this
transformation by the coordinates of the number pair Coord.

◆ setTrsf2d()

void Geom::GTrsf2d::setTrsf2d ( const Trsf2d T)

Assigns the vectorial and translation parts of T to this transformation.

◆ setValue()

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

◆ setVectorialPart()

void Geom::GTrsf2d::setVectorialPart ( const Mat2d Matrix)

Replaces the vectorial part of this transformation by Matrix.

◆ transformed()

XY Geom::GTrsf2d::transformed ( const XY Coord) const

◆ transforms() [1/2]

void Geom::GTrsf2d::transforms ( XY Coord) const

◆ transforms() [2/2]

void Geom::GTrsf2d::transforms ( double &  X,
double &  Y 
) const

Applies this transformation to the coordinates:

  • of the number pair Coord, or
  • X and Y.

    Note:
  • transforms modifies X, Y, or the coordinate pair Coord, while
  • transformed creates a new coordinate pair.

◆ translationPart()

const XY& Geom::GTrsf2d::translationPart ( ) const

Returns the translation part of the GTrsf2d.

◆ trsf2d()

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.

◆ value()

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

◆ vectorialPart()

const Mat2d& Geom::GTrsf2d::vectorialPart ( ) const

Computes the vectorial part of the GTrsf2d. The returned
Matrix is a 2*2 matrix.


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