Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
gp_GTrsf2d Class Reference

Defines a non persistent transformation in 2D space. This transformation is a general transformation. It can be a gp_Trsf2d, an affinity, or you can define your own transformation giving the corresponding matrix of transformation. More...

#include <gp_GTrsf2d.hxx>

Public Member Functions

constexpr gp_GTrsf2d () noexcept
 returns identity transformation.
 
 gp_GTrsf2d (const gp_Trsf2d &theT)
 Converts the gp_Trsf2d transformation theT into a general transformation.
 
constexpr gp_GTrsf2d (const gp_Mat2d &theM, const gp_XY &theV) noexcept
 Creates a transformation based on the matrix theM and the vector theV where theM defines the vectorial part of the transformation, and theV the translation part.
 
void SetAffinity (const gp_Ax2d &theA, const double theRatio)
 Changes this transformation into an affinity of ratio theRatio with respect to the axis theA. 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 theA, the vectors HP and HP' satisfy: HP' = theRatio * HP.
 
void SetValue (const int theRow, const int theCol, const double theValue)
 Replaces the coefficient (theRow, theCol) of the matrix representing this transformation by theValue, Raises OutOfRange if theRow < 1 or theRow > 2 or theCol < 1 or theCol > 3.
 
void SetTranslationPart (const gp_XY &theCoord)
 Replaces the translation part of this transformation by the coordinates of the number pair theCoord.
 
void SetTrsf2d (const gp_Trsf2d &theT)
 Assigns the vectorial and translation parts of theT to this transformation.
 
constexpr void SetVectorialPart (const gp_Mat2d &theMatrix) noexcept
 Replaces the vectorial part of this transformation by theMatrix.
 
constexpr bool IsNegative () const noexcept
 Returns true if the determinant of the vectorial part of this transformation is negative.
 
constexpr bool IsSingular () const noexcept
 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 gp::Resolution(). Warning If this transformation is singular, it cannot be inverted.
 
constexpr gp_TrsfForm Form () const noexcept
 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.
 
constexpr const gp_XYTranslationPart () const noexcept
 Returns the translation part of the GTrsf2d.
 
constexpr const gp_Mat2dVectorialPart () const noexcept
 Computes the vectorial part of the GTrsf2d. The returned Matrix is a 2*2 matrix.
 
constexpr double Value (const int theRow, const int theCol) const
 Returns the coefficients of the global matrix of transformation. Raised OutOfRange if theRow < 1 or theRow > 2 or theCol < 1 or theCol > 3.
 
double operator() (const int theRow, const int theCol) const
 
void Invert ()
 
gp_GTrsf2d Inverted () const
 Computes the reverse transformation. Raised an exception if the matrix of the transformation is not inversible.
 
gp_GTrsf2d Multiplied (const gp_GTrsf2d &theT) const
 Computes the transformation composed with theT and <me>. In a C++ implementation you can also write Tcomposed = <me> * theT. Example :
 
gp_GTrsf2d operator* (const gp_GTrsf2d &theT) const
 
void Multiply (const gp_GTrsf2d &theT)
 
void operator*= (const gp_GTrsf2d &theT)
 
void PreMultiply (const gp_GTrsf2d &theT)
 Computes the product of the transformation theT and this transformation, and assigns the result to this transformation: this = theT * this.
 
void Power (const int theN)
 
gp_GTrsf2d Powered (const int theN) const
 Computes the following composition of transformations <me> * <me> * .......* <me>, theN time. if theN = 0 <me> = Identity if theN < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
 
constexpr void Transforms (gp_XY &theCoord) const noexcept
 
constexpr gp_XY Transformed (const gp_XY &theCoord) const noexcept
 
constexpr void Transforms (double &theX, double &theY) const noexcept
 Applies this transformation to the coordinates:
 
gp_Trsf2d Trsf2d () const
 Converts this transformation into a gp_Trsf2d transformation. Exceptions Standard_ConstructionError if this transformation cannot be converted, i.e. if its form is gp_Other.
 

Detailed Description

Defines a non persistent transformation in 2D space. This transformation is a general transformation. It can be a gp_Trsf2d, an affinity, or you can define your own transformation giving the corresponding matrix of transformation.

With a gp_GTrsf2d you can transform only a doublet of coordinates gp_XY. It is not possible to transform other geometric objects because these transformations can change the nature of non-elementary geometric objects. A gp_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 |
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142

where {V1, V2} defines the vectorial part of the transformation and T defines the translation part of the transformation. Warning A gp_GTrsf2d transformation is only applicable on coordinates. Be careful if you apply such a transformation to all the points of a geometric object, as this can change the nature of the object and thus render it incoherent! Typically, a circle is transformed into an ellipse by an affinity transformation. To avoid modifying the nature of an object, use a gp_Trsf2d transformation instead, as objects of this class respect the nature of geometric objects.

Constructor & Destructor Documentation

◆ gp_GTrsf2d() [1/3]

constexpr gp_GTrsf2d::gp_GTrsf2d ( )
inlineconstexprnoexcept

returns identity transformation.

◆ gp_GTrsf2d() [2/3]

gp_GTrsf2d::gp_GTrsf2d ( const gp_Trsf2d & theT)
inline

Converts the gp_Trsf2d transformation theT into a general transformation.

◆ gp_GTrsf2d() [3/3]

constexpr gp_GTrsf2d::gp_GTrsf2d ( const gp_Mat2d & theM,
const gp_XY & theV )
inlineconstexprnoexcept

Creates a transformation based on the matrix theM and the vector theV where theM defines the vectorial part of the transformation, and theV the translation part.

Member Function Documentation

◆ Form()

constexpr gp_TrsfForm gp_GTrsf2d::Form ( ) const
inlineconstexprnoexcept

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 gp_GTrsf2d::Invert ( )

◆ Inverted()

gp_GTrsf2d gp_GTrsf2d::Inverted ( ) const
inline

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

◆ IsNegative()

constexpr bool gp_GTrsf2d::IsNegative ( ) const
inlineconstexprnoexcept

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

◆ IsSingular()

constexpr bool gp_GTrsf2d::IsSingular ( ) const
inlineconstexprnoexcept

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 gp::Resolution(). Warning If this transformation is singular, it cannot be inverted.

◆ Multiplied()

gp_GTrsf2d gp_GTrsf2d::Multiplied ( const gp_GTrsf2d & theT) const
inline

Computes the transformation composed with theT and <me>. In a C++ implementation you can also write Tcomposed = <me> * theT. Example :

gp_GTrsf2d T1, T2, Tcomp; ...............
//composition :
Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
// transformation of a point
gp_XY P(10.,3.);
gp_XY P1(P);
Tcomp.Transforms(P1); //using Tcomp
gp_XY P2(P);
T1.Transforms(P2); //using T1 then T2
T2.Transforms(P2); // P1 = P2 !!!
Defines a non persistent transformation in 2D space. This transformation is a general transformation....
Definition gp_GTrsf2d.hxx:49
gp_GTrsf2d Multiplied(const gp_GTrsf2d &theT) const
Computes the transformation composed with theT and <me>. In a C++ implementation you can also write T...
Definition gp_GTrsf2d.hxx:166
constexpr void Transforms(gp_XY &theCoord) const noexcept
Definition gp_GTrsf2d.hxx:287
This class describes a cartesian coordinate entity in 2D space {X,Y}. This class is non persistent....
Definition gp_XY.hxx:30

◆ Multiply()

void gp_GTrsf2d::Multiply ( const gp_GTrsf2d & theT)

◆ operator()()

double gp_GTrsf2d::operator() ( const int theRow,
const int theCol ) const
inline

◆ operator*()

gp_GTrsf2d gp_GTrsf2d::operator* ( const gp_GTrsf2d & theT) const
inline

◆ operator*=()

void gp_GTrsf2d::operator*= ( const gp_GTrsf2d & theT)
inline

◆ Power()

void gp_GTrsf2d::Power ( const int theN)

◆ Powered()

gp_GTrsf2d gp_GTrsf2d::Powered ( const int theN) const
inline

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

Raises an exception if theN < 0 and if the matrix of the transformation is not inversible.

◆ PreMultiply()

void gp_GTrsf2d::PreMultiply ( const gp_GTrsf2d & theT)

Computes the product of the transformation theT and this transformation, and assigns the result to this transformation: this = theT * this.

◆ SetAffinity()

void gp_GTrsf2d::SetAffinity ( const gp_Ax2d & theA,
const double theRatio )

Changes this transformation into an affinity of ratio theRatio with respect to the axis theA. 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 theA, the vectors HP and HP' satisfy: HP' = theRatio * HP.

◆ SetTranslationPart()

void gp_GTrsf2d::SetTranslationPart ( const gp_XY & theCoord)

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

◆ SetTrsf2d()

void gp_GTrsf2d::SetTrsf2d ( const gp_Trsf2d & theT)
inline

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

◆ SetValue()

void gp_GTrsf2d::SetValue ( const int theRow,
const int theCol,
const double theValue )
inline

Replaces the coefficient (theRow, theCol) of the matrix representing this transformation by theValue, Raises OutOfRange if theRow < 1 or theRow > 2 or theCol < 1 or theCol > 3.

◆ SetVectorialPart()

constexpr void gp_GTrsf2d::SetVectorialPart ( const gp_Mat2d & theMatrix)
inlineconstexprnoexcept

Replaces the vectorial part of this transformation by theMatrix.

◆ Transformed()

constexpr gp_XY gp_GTrsf2d::Transformed ( const gp_XY & theCoord) const
inlineconstexprnoexcept

◆ Transforms() [1/2]

constexpr void gp_GTrsf2d::Transforms ( double & theX,
double & theY ) const
inlineconstexprnoexcept

Applies this transformation to the coordinates:

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

Note:

  • Transforms modifies theX, theY, or the coordinate pair Coord, while
  • Transformed creates a new coordinate pair.

◆ Transforms() [2/2]

constexpr void gp_GTrsf2d::Transforms ( gp_XY & theCoord) const
inlineconstexprnoexcept

◆ TranslationPart()

constexpr const gp_XY & gp_GTrsf2d::TranslationPart ( ) const
inlineconstexprnoexcept

Returns the translation part of the GTrsf2d.

◆ Trsf2d()

gp_Trsf2d gp_GTrsf2d::Trsf2d ( ) const

Converts this transformation into a gp_Trsf2d transformation. Exceptions Standard_ConstructionError if this transformation cannot be converted, i.e. if its form is gp_Other.

◆ Value()

constexpr double gp_GTrsf2d::Value ( const int theRow,
const int theCol ) const
inlineconstexpr

Returns the coefficients of the global matrix of transformation. Raised OutOfRange if theRow < 1 or theRow > 2 or theCol < 1 or theCol > 3.

◆ VectorialPart()

constexpr const gp_Mat2d & gp_GTrsf2d::VectorialPart ( ) const
inlineconstexprnoexcept

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: