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

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

#include <gp_GTrsf.hxx>

Public Member Functions

constexpr gp_GTrsf () noexcept
 Returns the Identity transformation.
 
 gp_GTrsf (const gp_Trsf &theT)
 Converts the gp_Trsf transformation theT into a general transformation, i.e. Returns a GTrsf with the same matrix of coefficients as the Trsf theT.
 
constexpr gp_GTrsf (const gp_Mat &theM, const gp_XYZ &theV) noexcept
 Creates a transformation based on the matrix theM and the vector theV where theM defines the vectorial part of the transformation, and V the translation part, or.
 
void SetAffinity (const gp_Ax1 &theA1, const double theRatio)
 Changes this transformation into an affinity of ratio theRatio with respect to the axis theA1. 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 theA1 or the plane A2, the vectors HP and HP' satisfy: HP' = theRatio * HP.
 
void SetAffinity (const gp_Ax2 &theA2, const double theRatio)
 Changes this transformation into an affinity of ratio theRatio with respect to the plane defined by the origin, the "X Direction" and the "Y Direction" of coordinate system theA2. 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 A1 or the plane theA2, 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 > 3 or theCol < 1 or theCol > 4.
 
constexpr void SetVectorialPart (const gp_Mat &theMatrix) noexcept
 Replaces the vectorial part of this transformation by theMatrix.
 
void SetTranslationPart (const gp_XYZ &theCoord)
 Replaces the translation part of this transformation by the coordinates of the number triple theCoord.
 
void SetTrsf (const gp_Trsf &theT)
 Assigns the vectorial and translation parts of theT to this transformation.
 
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, an axis or a plane), a scaling transformation, a compound transformation or some other type of transformation.
 
void SetForm ()
 verify and set the shape of the GTrsf Other or CompoundTrsf Ex :
 
constexpr const gp_XYZTranslationPart () const noexcept
 Returns the translation part of the GTrsf.
 
constexpr const gp_MatVectorialPart () const noexcept
 Computes the vectorial part of the GTrsf. The returned Matrix is a 3*3 matrix.
 
constexpr double Value (const int theRow, const int theCol) const
 Returns the coefficients of the global matrix of transformation. Raises OutOfRange if theRow < 1 or theRow > 3 or theCol < 1 or theCol > 4.
 
double operator() (const int theRow, const int theCol) const
 
void Invert ()
 
gp_GTrsf Inverted () const
 Computes the reverse transformation. Raises an exception if the matrix of the transformation is not inversible.
 
gp_GTrsf Multiplied (const gp_GTrsf &theT) const
 Computes the transformation composed from theT and <me>. In a C++ implementation you can also write Tcomposed = <me> * theT. Example :
 
gp_GTrsf operator* (const gp_GTrsf &theT) const
 
void Multiply (const gp_GTrsf &theT)
 Computes the transformation composed with <me> and theT. <me> = <me> * theT.
 
void operator*= (const gp_GTrsf &theT)
 
void PreMultiply (const gp_GTrsf &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_GTrsf Powered (const int theN) const
 Computes:
 
constexpr void Transforms (gp_XYZ &theCoord) const noexcept
 
constexpr void Transforms (double &theX, double &theY, double &theZ) const noexcept
 Transforms a triplet XYZ with a GTrsf.
 
gp_Trsf Trsf () const
 
template<class T >
void GetMat4 (NCollection_Mat4< T > &theMat) const
 Convert transformation to 4x4 matrix.
 
template<class T >
void SetMat4 (const NCollection_Mat4< T > &theMat)
 Convert transformation from 4x4 matrix.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
 

Detailed Description

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

With a gp_GTrsf you can transform only a triplet of coordinates gp_XYZ. It is not possible to transform other geometric objects because these transformations can change the nature of non-elementary geometric objects. The transformation gp_GTrsf can be represented as follow:

V1 V2 V3 T XYZ XYZ
| a11 a12 a13 a14 | | x | | x'|
| a21 a22 a23 a24 | | y | | y'|
| a31 a32 a33 a34 | | z | = | z'|
| 0 0 0 1 | | 1 | | 1 |
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142

where {V1, V2, V3} define the vectorial part of the transformation and T defines the translation part of the transformation. Warning A gp_GTrsf transformation is only applicable to coordinates. Be careful if you apply such a transformation to all 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_Trsf transformation instead, as objects of this class respect the nature of geometric objects.

Constructor & Destructor Documentation

◆ gp_GTrsf() [1/3]

constexpr gp_GTrsf::gp_GTrsf ( )
inlineconstexprnoexcept

Returns the Identity transformation.

◆ gp_GTrsf() [2/3]

gp_GTrsf::gp_GTrsf ( const gp_Trsf & theT)
inline

Converts the gp_Trsf transformation theT into a general transformation, i.e. Returns a GTrsf with the same matrix of coefficients as the Trsf theT.

◆ gp_GTrsf() [3/3]

constexpr gp_GTrsf::gp_GTrsf ( const gp_Mat & theM,
const gp_XYZ & theV )
inlineconstexprnoexcept

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

Member Function Documentation

◆ DumpJson()

void gp_GTrsf::DumpJson ( Standard_OStream & theOStream,
int theDepth = -1 ) const

Dumps the content of me into the stream.

◆ Form()

constexpr gp_TrsfForm gp_GTrsf::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, an axis or a plane), a scaling transformation, a compound transformation or some other type of transformation.

◆ GetMat4()

template<class T >
void gp_GTrsf::GetMat4 ( NCollection_Mat4< T > & theMat) const
inline

Convert transformation to 4x4 matrix.

◆ Invert()

void gp_GTrsf::Invert ( )

◆ Inverted()

gp_GTrsf gp_GTrsf::Inverted ( ) const
inline

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

◆ IsNegative()

constexpr bool gp_GTrsf::IsNegative ( ) const
inlineconstexprnoexcept

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

◆ IsSingular()

constexpr bool gp_GTrsf::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_GTrsf gp_GTrsf::Multiplied ( const gp_GTrsf & theT) const
inline

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

gp_GTrsf T1, T2, Tcomp; ...............
//composition :
Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
// transformation of a point
gp_XYZ P(10.,3.,4.);
gp_XYZ P1(P);
Tcomp.Transforms(P1); //using Tcomp
gp_XYZ P2(P);
T1.Transforms(P2); //using T1 then T2
T2.Transforms(P2); // P1 = P2 !!!
Defines a non-persistent transformation in 3D space. This transformation is a general transformation....
Definition gp_GTrsf.hxx:58
gp_GTrsf Multiplied(const gp_GTrsf &theT) const
Computes the transformation composed from theT and <me>. In a C++ implementation you can also write T...
Definition gp_GTrsf.hxx:209
constexpr void Transforms(gp_XYZ &theCoord) const noexcept
Definition gp_GTrsf.hxx:390
This class describes a cartesian coordinate entity in 3D space {X,Y,Z}. This entity is used for algeb...
Definition gp_XYZ.hxx:34

◆ Multiply()

void gp_GTrsf::Multiply ( const gp_GTrsf & theT)

Computes the transformation composed with <me> and theT. <me> = <me> * theT.

◆ operator()()

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

◆ operator*()

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

◆ operator*=()

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

◆ Power()

void gp_GTrsf::Power ( const int theN)

◆ Powered()

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

Computes:

  • the product of this transformation multiplied by itself theN times, if theN is positive, or
  • the product of the inverse of this transformation multiplied by itself |theN| times, if theN is negative. If theN equals zero, the result is equal to the Identity transformation. I.e.: <me> * <me> * .......* <me>, theN time. if theN =0 <me> = Identity if theN < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().

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

◆ PreMultiply()

void gp_GTrsf::PreMultiply ( const gp_GTrsf & theT)

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

◆ SetAffinity() [1/2]

void gp_GTrsf::SetAffinity ( const gp_Ax1 & theA1,
const double theRatio )
inline

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

◆ SetAffinity() [2/2]

void gp_GTrsf::SetAffinity ( const gp_Ax2 & theA2,
const double theRatio )
inline

Changes this transformation into an affinity of ratio theRatio with respect to the plane defined by the origin, the "X Direction" and the "Y Direction" of coordinate system theA2. 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 A1 or the plane theA2, the vectors HP and HP' satisfy: HP' = theRatio * HP.

◆ SetForm()

void gp_GTrsf::SetForm ( )

verify and set the shape of the GTrsf Other or CompoundTrsf Ex :

myGTrsf.SetValue(row1,col1,val1);
myGTrsf.SetValue(row2,col2,val2);
...
myGTrsf.SetForm();

◆ SetMat4()

template<class T >
void gp_GTrsf::SetMat4 ( const NCollection_Mat4< T > & theMat)
inline

Convert transformation from 4x4 matrix.

◆ SetTranslationPart()

void gp_GTrsf::SetTranslationPart ( const gp_XYZ & theCoord)

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

◆ SetTrsf()

void gp_GTrsf::SetTrsf ( const gp_Trsf & theT)
inline

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

◆ SetValue()

void gp_GTrsf::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 > 3 or theCol < 1 or theCol > 4.

◆ SetVectorialPart()

constexpr void gp_GTrsf::SetVectorialPart ( const gp_Mat & theMatrix)
inlineconstexprnoexcept

Replaces the vectorial part of this transformation by theMatrix.

◆ Transforms() [1/2]

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

Transforms a triplet XYZ with a GTrsf.

◆ Transforms() [2/2]

constexpr void gp_GTrsf::Transforms ( gp_XYZ & theCoord) const
inlineconstexprnoexcept

◆ TranslationPart()

constexpr const gp_XYZ & gp_GTrsf::TranslationPart ( ) const
inlineconstexprnoexcept

Returns the translation part of the GTrsf.

◆ Trsf()

gp_Trsf gp_GTrsf::Trsf ( ) const
inline

◆ Value()

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

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

◆ VectorialPart()

constexpr const gp_Mat & gp_GTrsf::VectorialPart ( ) const
inlineconstexprnoexcept

Computes the vectorial part of the GTrsf. The returned Matrix is a 3*3 matrix.


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