Open CASCADE Technology 7.8.0
|
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 | |
gp_GTrsf2d () | |
returns identity transformation. | |
gp_GTrsf2d (const gp_Trsf2d &theT) | |
Converts the gp_Trsf2d transformation theT into a general transformation. | |
gp_GTrsf2d (const gp_Mat2d &theM, const gp_XY &theV) | |
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 Standard_Real 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 Standard_Integer theRow, const Standard_Integer theCol, const Standard_Real 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. | |
void | SetVectorialPart (const gp_Mat2d &theMatrix) |
Replaces the vectorial part of this transformation by theMatrix. | |
Standard_Boolean | IsNegative () const |
Returns true if the determinant of the vectorial part of this transformation is negative. | |
Standard_Boolean | 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 gp::Resolution(). Warning If this transformation is singular, it cannot be inverted. | |
gp_TrsfForm | 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. | |
const gp_XY & | TranslationPart () const |
Returns the translation part of the GTrsf2d. | |
const gp_Mat2d & | VectorialPart () const |
Computes the vectorial part of the GTrsf2d. The returned Matrix is a 2*2 matrix. | |
Standard_Real | Value (const Standard_Integer theRow, const Standard_Integer 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. | |
Standard_Real | operator() (const Standard_Integer theRow, const Standard_Integer 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 Standard_Integer theN) |
gp_GTrsf2d | Powered (const Standard_Integer 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(). | |
void | Transforms (gp_XY &theCoord) const |
gp_XY | Transformed (const gp_XY &theCoord) const |
void | Transforms (Standard_Real &theX, Standard_Real &theY) const |
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. | |
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:
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.
|
inline |
returns identity transformation.
Converts the gp_Trsf2d transformation theT into a general transformation.
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.
|
inline |
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.
void gp_GTrsf2d::Invert | ( | ) |
|
inline |
Computes the reverse transformation. Raised an exception if the matrix of the transformation is not inversible.
|
inline |
Returns true if the determinant of the vectorial part of this transformation is negative.
|
inline |
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.
|
inline |
Computes the transformation composed with theT and <me>. In a C++ implementation you can also write Tcomposed = <me> * theT. Example :
void gp_GTrsf2d::Multiply | ( | const gp_GTrsf2d & | theT | ) |
|
inline |
|
inline |
|
inline |
void gp_GTrsf2d::Power | ( | const Standard_Integer | theN | ) |
|
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.
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.
void gp_GTrsf2d::SetAffinity | ( | const gp_Ax2d & | theA, |
const Standard_Real | 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.
Replaces the translation part of this transformation by the coordinates of the number pair theCoord.
Assigns the vectorial and translation parts of theT to this transformation.
|
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.
Replaces the vectorial part of this transformation by theMatrix.
|
inline |
|
inline |
Applies this transformation to the coordinates:
Note:
Returns the translation part of the GTrsf2d.
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.
|
inline |
Returns the coefficients of the global matrix of transformation. Raised OutOfRange if theRow < 1 or theRow > 2 or theCol < 1 or theCol > 3.
Computes the vectorial part of the GTrsf2d. The returned Matrix is a 2*2 matrix.