OpenLexocad  27.1
Geom::Trsf2d Class Reference

#include <Trsf2d.h>

Public Types

enum  FormEnum {
  Identity, Rotation, Translation, PntMirror,
  Ax1Mirror, Ax2Mirror, Scale, CompoundTrsf,
  Other
}
 

Public Member Functions

 Trsf2d ()
 Returns identity transformation.
More...
 
 Trsf2d (const Trsf2d &T)
 
Trsf2d::FormEnum form () const
 
const Mat2dhVectorialPart () const
 
void invert ()
 
Trsf2d inverted () const
 
bool isNegative () const
 
Trsf2d multiplied (const Trsf2d &T) const
 
void multiply (const Trsf2d &T)
 
Trsf2d operator * (const Trsf2d &T) const
 
void operator *= (const Trsf2d &T)
 
void power (const int N)
 
Trsf2d powered (const int N)
 
void preMultiply (const Trsf2d &T)
 
double rotationPart () const
 
double scaleFactor () const
 Returns the scale factor.
More...
 
void setMirror (const Pnt2d &P)
 
void setMirror (const Ax2d &A)
 
void setRotation (const Pnt2d &P, const double Ang)
 
void setScale (const Pnt2d &P, const double S)
 
void setScaleFactor (const double S)
 Modifies the scale factor.
More...
 
void setTransformation (const Ax2d &FromSystem1, const Ax2d &ToSystem2)
 
void setTransformation (const Ax2d &ToSystem)
 
void setTranslation (const Vec2d &V)
 
void setTranslation (const Pnt2d &P1, const Pnt2d &P2)
 
void setTranslationPart (const Vec2d &V)
 Replaces the translation vector with V.
More...
 
void transforms (double &X, double &Y) const
 
void transforms (XY &Coord) const
 Transforms a doublet XY with a Trsf2d
More...
 
const XYtranslationPart () const
 Returns the translation part of the transformation's matrix
More...
 
double value (const int Row, const int Col) const
 
Mat2d vectorialPart () const
 

Friends

class GTrsf2d
 

Detailed Description

Defines a non-persistent transformation in 2D space.
The following transformations are implemented :
. Translation, Rotation, Scale
. Symmetry with respect to a point and a line.
Complex transformations can be obtained by combining the
previous elementary transformations using the method Multiply.
The transformations can be represented as follow :

V1 V2 T XY XY
| a11 a12 a13 | | x | | x'|
| a21 a22 a23 | | y | | y'|
| 0 0 1 | | 1 | | 1 |

Member Enumeration Documentation

◆ FormEnum

Enumerator
Identity 
Rotation 
Translation 
PntMirror 
Ax1Mirror 
Ax2Mirror 
Scale 
CompoundTrsf 
Other 

Constructor & Destructor Documentation

◆ Trsf2d() [1/2]

Geom::Trsf2d::Trsf2d ( )

Returns identity transformation.

◆ Trsf2d() [2/2]

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

Creates a 2d transformation in the XY plane from a
3d transformation .

Member Function Documentation

◆ form()

Trsf2d::FormEnum Geom::Trsf2d::form ( ) const

Returns the nature of the transformation. It can be an
identity transformation, a rotation, a translation, a mirror
(relative to a point or an axis), a scaling transformation,
or a compound transformation.

◆ hVectorialPart()

const Mat2d& Geom::Trsf2d::hVectorialPart ( ) const

Returns the homogeneous vectorial part of the transformation.
It is a 2*2 matrix which doesn't include the scale factor.
The coefficients of this matrix must be multiplied by the
scale factor to obtain the coefficients of the transformation.

◆ invert()

void Geom::Trsf2d::invert ( )

◆ inverted()

Trsf2d Geom::Trsf2d::inverted ( ) const

Computes the reverse transformation.
Raises an exception if the matrix of the transformation
is not inversible, it means that the scale factor is lower
or equal to Resolution from package gp.

◆ isNegative()

bool Geom::Trsf2d::isNegative ( ) const

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

◆ multiplied()

Trsf2d Geom::Trsf2d::multiplied ( const Trsf2d T) const

◆ multiply()

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

Computes the transformation composed from <T> and <me>.
In a C++ implementation you can also write Tcomposed = <me> * T.
Example :
Trsf2d T1, T2, Tcomp; ...............
//composition :
Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
// transformation of a point
Pnt2d P1(10.,3.,4.);
Pnt2d P2 = P1.Transformed(Tcomp); //using Tcomp
Pnt2d P3 = P1.Transformed(T1); //using T1 then T2
P3.Transform(T2); // P3 = P2 !!!

◆ operator *()

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

◆ operator *=()

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

◆ power()

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

◆ powered()

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

Computes the following composition of transformations
<me> * <me> * .......* <me>, N time.
if N = 0 <me> = Identity
if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().

◆ preMultiply()

void Geom::Trsf2d::preMultiply ( const Trsf2d T)

Computes the transformation composed from <me> and T.
<me> = T * <me>

◆ rotationPart()

double Geom::Trsf2d::rotationPart ( ) const

Returns the angle corresponding to the rotational component
of the transformation matrix (operation opposite to SetRotation()).

◆ scaleFactor()

double Geom::Trsf2d::scaleFactor ( ) const

Returns the scale factor.

◆ setMirror() [1/2]

void Geom::Trsf2d::setMirror ( const Pnt2d P)

Changes the transformation into a symmetrical transformation.
P is the center of the symmetry.

◆ setMirror() [2/2]

void Geom::Trsf2d::setMirror ( const Ax2d A)

Changes the transformation into a symmetrical transformation.
A is the center of the axial symmetry.

◆ setRotation()

void Geom::Trsf2d::setRotation ( const Pnt2d P,
const double  Ang 
)

Changes the transformation into a rotation.
P is the rotation's center and Ang is the angular value of the
rotation in radian.

◆ setScale()

void Geom::Trsf2d::setScale ( const Pnt2d P,
const double  S 
)

Changes the transformation into a scale.
P is the center of the scale and S is the scaling value.

◆ setScaleFactor()

void Geom::Trsf2d::setScaleFactor ( const double  S)

Modifies the scale factor.

◆ setTransformation() [1/2]

void Geom::Trsf2d::setTransformation ( const Ax2d FromSystem1,
const Ax2d ToSystem2 
)

Changes a transformation allowing passage from the coordinate
system "FromSystem1" to the coordinate system "ToSystem2".

◆ setTransformation() [2/2]

void Geom::Trsf2d::setTransformation ( const Ax2d ToSystem)

Changes the transformation allowing passage from the basic
coordinate system
{P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.)}
to the local coordinate system defined with the Ax2d ToSystem.

◆ setTranslation() [1/2]

void Geom::Trsf2d::setTranslation ( const Vec2d V)

Changes the transformation into a translation.
V is the vector of the translation.

◆ setTranslation() [2/2]

void Geom::Trsf2d::setTranslation ( const Pnt2d P1,
const Pnt2d P2 
)

Makes the transformation into a translation from
the point P1 to the point P2.

◆ setTranslationPart()

void Geom::Trsf2d::setTranslationPart ( const Vec2d V)

Replaces the translation vector with V.

◆ transforms() [1/2]

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

◆ transforms() [2/2]

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

Transforms a doublet XY with a Trsf2d

◆ translationPart()

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

Returns the translation part of the transformation's matrix

◆ value()

double Geom::Trsf2d::value ( const int  Row,
const int  Col 
) const

Returns the coefficients of the transformation's matrix.
It is a 2 rows * 3 columns matrix.
Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3

◆ vectorialPart()

Mat2d Geom::Trsf2d::vectorialPart ( ) const

Returns the vectorial part of the transformation. It is a
2*2 matrix which includes the scale factor.

Friends And Related Function Documentation

◆ GTrsf2d

friend class GTrsf2d
friend

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