Open CASCADE Technology  7.4.0
Public Member Functions | Protected Member Functions

gp_Trsf2d Class Reference

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 : More...

#include <gp_Trsf2d.hxx>

Public Member Functions

 gp_Trsf2d ()
 Returns identity transformation. More...
 
 gp_Trsf2d (const gp_Trsf &T)
 Creates a 2d transformation in the XY plane from a 3d transformation . More...
 
void SetMirror (const gp_Pnt2d &P)
 Changes the transformation into a symmetrical transformation. P is the center of the symmetry. More...
 
void SetMirror (const gp_Ax2d &A)
 Changes the transformation into a symmetrical transformation. A is the center of the axial symmetry. More...
 
void SetRotation (const gp_Pnt2d &P, const Standard_Real Ang)
 Changes the transformation into a rotation. P is the rotation's center and Ang is the angular value of the rotation in radian. More...
 
void SetScale (const gp_Pnt2d &P, const Standard_Real S)
 Changes the transformation into a scale. P is the center of the scale and S is the scaling value. More...
 
void SetTransformation (const gp_Ax2d &FromSystem1, const gp_Ax2d &ToSystem2)
 Changes a transformation allowing passage from the coordinate system "FromSystem1" to the coordinate system "ToSystem2". More...
 
void SetTransformation (const gp_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. More...
 
void SetTranslation (const gp_Vec2d &V)
 Changes the transformation into a translation. V is the vector of the translation. More...
 
void SetTranslation (const gp_Pnt2d &P1, const gp_Pnt2d &P2)
 Makes the transformation into a translation from the point P1 to the point P2. More...
 
void SetTranslationPart (const gp_Vec2d &V)
 Replaces the translation vector with V. More...
 
void SetScaleFactor (const Standard_Real S)
 Modifies the scale factor. More...
 
Standard_Boolean IsNegative () const
 Returns true if the determinant of the vectorial part of this transformation is negative.. More...
 
gp_TrsfForm 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. More...
 
Standard_Real ScaleFactor () const
 Returns the scale factor. More...
 
const gp_XYTranslationPart () const
 Returns the translation part of the transformation's matrix. More...
 
gp_Mat2d VectorialPart () const
 Returns the vectorial part of the transformation. It is a 2*2 matrix which includes the scale factor. More...
 
const gp_Mat2dHVectorialPart () 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. More...
 
Standard_Real RotationPart () const
 Returns the angle corresponding to the rotational component of the transformation matrix (operation opposite to SetRotation()). More...
 
Standard_Real Value (const Standard_Integer Row, const Standard_Integer 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. More...
 
void Invert ()
 
gp_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. More...
 
gp_Trsf2d Multiplied (const gp_Trsf2d &T) const
 
gp_Trsf2d operator* (const gp_Trsf2d &T) const
 
void Multiply (const gp_Trsf2d &T)
 Computes the transformation composed from <me> and T. <me> = <me> * T. More...
 
void operator*= (const gp_Trsf2d &T)
 
void PreMultiply (const gp_Trsf2d &T)
 Computes the transformation composed from <me> and T. <me> = T * <me> More...
 
void Power (const Standard_Integer N)
 
gp_Trsf2d Powered (const Standard_Integer 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(). More...
 
void Transforms (Standard_Real &X, Standard_Real &Y) const
 
void Transforms (gp_XY &Coord) const
 Transforms a doublet XY with a Trsf2d. More...
 
void SetValues (const Standard_Real a11, const Standard_Real a12, const Standard_Real a13, const Standard_Real a21, const Standard_Real a22, const Standard_Real a23)
 Sets the coefficients of the transformation. The transformation of the point x,y is the point x',y' with : More...
 

Protected Member Functions

void Orthogonalize ()
 Makes orthogonalization of "matrix". More...
 

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 |

where {V1, V2} defines the vectorial part of the transformation and T defines the translation part of the transformation. This transformation never change the nature of the objects.

Constructor & Destructor Documentation

◆ gp_Trsf2d() [1/2]

gp_Trsf2d::gp_Trsf2d ( )

Returns identity transformation.

◆ gp_Trsf2d() [2/2]

gp_Trsf2d::gp_Trsf2d ( const gp_Trsf T)

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

Member Function Documentation

◆ Form()

gp_TrsfForm gp_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 gp_Mat2d& gp_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 gp_Trsf2d::Invert ( )

◆ Inverted()

gp_Trsf2d gp_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()

Standard_Boolean gp_Trsf2d::IsNegative ( ) const

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

◆ Multiplied()

gp_Trsf2d gp_Trsf2d::Multiplied ( const gp_Trsf2d T) const

◆ Multiply()

void gp_Trsf2d::Multiply ( const gp_Trsf2d T)

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

◆ operator*()

gp_Trsf2d gp_Trsf2d::operator* ( const gp_Trsf2d T) const
inline

◆ operator*=()

void gp_Trsf2d::operator*= ( const gp_Trsf2d T)
inline

◆ Orthogonalize()

void gp_Trsf2d::Orthogonalize ( )
protected

Makes orthogonalization of "matrix".

◆ Power()

void gp_Trsf2d::Power ( const Standard_Integer  N)

◆ Powered()

gp_Trsf2d gp_Trsf2d::Powered ( const Standard_Integer  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().

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

◆ PreMultiply()

void gp_Trsf2d::PreMultiply ( const gp_Trsf2d T)

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

◆ RotationPart()

Standard_Real gp_Trsf2d::RotationPart ( ) const

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

◆ ScaleFactor()

Standard_Real gp_Trsf2d::ScaleFactor ( ) const

Returns the scale factor.

◆ SetMirror() [1/2]

void gp_Trsf2d::SetMirror ( const gp_Pnt2d P)

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

◆ SetMirror() [2/2]

void gp_Trsf2d::SetMirror ( const gp_Ax2d A)

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

◆ SetRotation()

void gp_Trsf2d::SetRotation ( const gp_Pnt2d P,
const Standard_Real  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 gp_Trsf2d::SetScale ( const gp_Pnt2d P,
const Standard_Real  S 
)

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

◆ SetScaleFactor()

void gp_Trsf2d::SetScaleFactor ( const Standard_Real  S)

Modifies the scale factor.

◆ SetTransformation() [1/2]

void gp_Trsf2d::SetTransformation ( const gp_Ax2d FromSystem1,
const gp_Ax2d ToSystem2 
)

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

◆ SetTransformation() [2/2]

void gp_Trsf2d::SetTransformation ( const gp_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 gp_Trsf2d::SetTranslation ( const gp_Vec2d V)

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

◆ SetTranslation() [2/2]

void gp_Trsf2d::SetTranslation ( const gp_Pnt2d P1,
const gp_Pnt2d P2 
)

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

◆ SetTranslationPart()

void gp_Trsf2d::SetTranslationPart ( const gp_Vec2d V)

Replaces the translation vector with V.

◆ SetValues()

void gp_Trsf2d::SetValues ( const Standard_Real  a11,
const Standard_Real  a12,
const Standard_Real  a13,
const Standard_Real  a21,
const Standard_Real  a22,
const Standard_Real  a23 
)

Sets the coefficients of the transformation. The transformation of the point x,y is the point x',y' with :

x' = a11 x + a12 y + a13 y' = a21 x + a22 y + a23

The method Value(i,j) will return aij. Raises ConstructionError if the determinant of the aij is null. If the matrix as not a uniform scale it will be orthogonalized before future using.

◆ Transforms() [1/2]

void gp_Trsf2d::Transforms ( Standard_Real X,
Standard_Real Y 
) const

◆ Transforms() [2/2]

void gp_Trsf2d::Transforms ( gp_XY Coord) const

Transforms a doublet XY with a Trsf2d.

◆ TranslationPart()

const gp_XY& gp_Trsf2d::TranslationPart ( ) const

Returns the translation part of the transformation's matrix.

◆ Value()

Standard_Real gp_Trsf2d::Value ( const Standard_Integer  Row,
const Standard_Integer  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()

gp_Mat2d gp_Trsf2d::VectorialPart ( ) const

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


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