OpenLexocad
27.0
|
#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 Mat2d & | hVectorialPart () 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 XY & | translationPart () 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 |
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 |
Geom::Trsf2d::Trsf2d | ( | ) |
Returns identity transformation.
Geom::Trsf2d::Trsf2d | ( | const Trsf2d & | T | ) |
Creates a 2d transformation in the XY plane from a
3d transformation .
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.
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.
void Geom::Trsf2d::invert | ( | ) |
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.
bool Geom::Trsf2d::isNegative | ( | ) | const |
Returns true if the determinant of the vectorial part of
this transformation is negative..
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 !!!
|
inline |
void Geom::Trsf2d::power | ( | const int | N | ) |
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().
void Geom::Trsf2d::preMultiply | ( | const Trsf2d & | T | ) |
Computes the transformation composed from <me> and T.
<me> = T * <me>
double Geom::Trsf2d::rotationPart | ( | ) | const |
Returns the angle corresponding to the rotational component
of the transformation matrix (operation opposite to SetRotation()).
double Geom::Trsf2d::scaleFactor | ( | ) | const |
Returns the scale factor.
void Geom::Trsf2d::setMirror | ( | const Pnt2d & | P | ) |
Changes the transformation into a symmetrical transformation.
P is the center of the symmetry.
void Geom::Trsf2d::setMirror | ( | const Ax2d & | A | ) |
Changes the transformation into a symmetrical transformation.
A is the center of the axial symmetry.
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.
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.
void Geom::Trsf2d::setScaleFactor | ( | const double | S | ) |
Modifies the scale factor.
Changes a transformation allowing passage from the coordinate
system "FromSystem1" to the coordinate system "ToSystem2".
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.
void Geom::Trsf2d::setTranslation | ( | const Vec2d & | V | ) |
Changes the transformation into a translation.
V is the vector of the translation.
Makes the transformation into a translation from
the point P1 to the point P2.
void Geom::Trsf2d::setTranslationPart | ( | const Vec2d & | V | ) |
Replaces the translation vector with V.
void Geom::Trsf2d::transforms | ( | double & | X, |
double & | Y | ||
) | const |
const XY& Geom::Trsf2d::translationPart | ( | ) | const |
Returns the translation part of the transformation's matrix
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
Mat2d Geom::Trsf2d::vectorialPart | ( | ) | const |
Returns the vectorial part of the transformation. It is a
2*2 matrix which includes the scale factor.
|
friend |