Open CASCADE Technology  6.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions
gp_GTrsf2d Class Reference

Defines a non persistent transformation in 2D space. <br>

This transformation is a general transformation.
It can be a Trsf2d from package gp, an affinity, or you can
define your own transformation giving the corresponding
matrix of transformation.

With a GTrsf2d you can transform only a doublet of coordinates
XY. It is not possible to transform other geometric objects
because these transformations can change the nature of non-
elementary geometric objects.
A 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 |

where {V1, V2} defines the vectorial part of the
transformation and T defines the translation part of
the transformation.
Warning
A 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.
More...

#include <gp_GTrsf2d.hxx>

Public Member Functions

 gp_GTrsf2d ()
 returns identity transformation.
More...
 
 gp_GTrsf2d (const gp_Trsf2d &T)
 Converts the gp_Trsf2d transformation T into a
general transformation.
More...
 
 gp_GTrsf2d (const gp_Mat2d &M, const gp_XY &V)
 Creates a transformation based on the matrix M and the
vector V where M defines the vectorial part of the
transformation, and V the translation part.
More...
 
void SetAffinity (const gp_Ax2d &A, const Standard_Real Ratio)
 Changes this transformation into an affinity of ratio Ratio
with respect to the axis A.
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 A, the vectors
HP and HP' satisfy: HP' = Ratio * HP.
More...
 
void SetValue (const Standard_Integer Row, const Standard_Integer Col, const Standard_Real Value)
 
Replaces   the coefficient (Row, Col) of the matrix representing <br>

this transformation by Value,
Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
More...

 
void SetTranslationPart (const gp_XY &Coord)
 
 Replacesthe translation part of this <br>

transformation by the coordinates of the number pair Coord.
More...

 
void SetTrsf2d (const gp_Trsf2d &T)
 Assigns the vectorial and translation parts of T to this transformation.
More...
 
void SetVectorialPart (const gp_Mat2d &Matrix)
 Replaces the vectorial part of this transformation by Matrix.
More...
 
Standard_Boolean IsNegative () const
 
Returns true if the determinant of the vectorial part of <br>

this transformation is negative.
More...

 
Standard_Boolean IsSingular () const
 
 Returns true if this transformation is singular (and <br>

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

 
gp_TrsfForm Form () const
 
Returns the nature of the transformation.  It can be <br>

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

 
const gp_XYTranslationPart () const
 Returns the translation part of the GTrsf2d.
More...
 
const gp_Mat2dVectorialPart () const
 Computes the vectorial part of the GTrsf2d. The returned
Matrix is a 2*2 matrix.
More...
 
Standard_Real Value (const Standard_Integer Row, const Standard_Integer Col) const
 
Returns the coefficients of the global matrix of transformation. <br>

Raised OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
More...

 
Standard_Real operator() (const Standard_Integer Row, const Standard_Integer Col) const
 
void Invert ()
 
gp_GTrsf2d Inverted () const
 Computes the reverse transformation.
Raised an exception if the matrix of the transformation
is not inversible.
More...
 
void Multiply (const gp_GTrsf2d &T)
 
void operator*= (const gp_GTrsf2d &T)
 
gp_GTrsf2d Multiplied (const gp_GTrsf2d &T) const
 Computes the transformation composed with T and <me>.
In a C++ implementation you can also write Tcomposed = <me> * T.
Example :
GTrsf2d T1, T2, Tcomp; ...............
//composition :
Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
// transformation of a point
XY P(10.,3.);
XY P1(P);
Tcomp.Transforms(P1); //using Tcomp
XY P2(P);
T1.Transforms(P2); //using T1 then T2
T2.Transforms(P2); // P1 = P2 !!!
More...
 
gp_GTrsf2d operator* (const gp_GTrsf2d &T) const
 
void PreMultiply (const gp_GTrsf2d &T)
 Computes the product of the transformation T and this
transformation, and assigns the result to this transformation:
this = T * this
More...
 
void Power (const Standard_Integer N)
 
gp_GTrsf2d Powered (const Standard_Integer N) const
 
Computes the following composition of transformations <br>

<me> * <me> * .......* <me>, N time.
if N = 0 <me> = Identity
if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().

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

 
void Transforms (gp_XY &Coord) const
 
gp_XY Transformed (const gp_XY &Coord) const
 
void Transforms (Standard_Real &X, Standard_Real &Y) const
 Applies this transformation to the coordinates:
More...
 
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.
More...
 
const gp_Mat2d_CSFDB_Getgp_GTrsf2dmatrix () const
 
const gp_XY_CSFDB_Getgp_GTrsf2dloc () const
 
gp_TrsfForm _CSFDB_Getgp_GTrsf2dshape () const
 
void _CSFDB_Setgp_GTrsf2dshape (const gp_TrsfForm p)
 
Standard_Real _CSFDB_Getgp_GTrsf2dscale () const
 
void _CSFDB_Setgp_GTrsf2dscale (const Standard_Real p)
 

Detailed Description

Defines a non persistent transformation in 2D space. <br>

This transformation is a general transformation.
It can be a Trsf2d from package gp, an affinity, or you can
define your own transformation giving the corresponding
matrix of transformation.

With a GTrsf2d you can transform only a doublet of coordinates
XY. It is not possible to transform other geometric objects
because these transformations can change the nature of non-
elementary geometric objects.
A 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 |

where {V1, V2} defines the vectorial part of the
transformation and T defines the translation part of
the transformation.
Warning
A 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::gp_GTrsf2d ( )

returns identity transformation.

gp_GTrsf2d::gp_GTrsf2d ( const gp_Trsf2d T)

Converts the gp_Trsf2d transformation T into a
general transformation.

gp_GTrsf2d::gp_GTrsf2d ( const gp_Mat2d M,
const gp_XY V 
)

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

Member Function Documentation

const gp_XY& gp_GTrsf2d::_CSFDB_Getgp_GTrsf2dloc ( ) const
inline
const gp_Mat2d& gp_GTrsf2d::_CSFDB_Getgp_GTrsf2dmatrix ( ) const
inline
Standard_Real gp_GTrsf2d::_CSFDB_Getgp_GTrsf2dscale ( ) const
inline
gp_TrsfForm gp_GTrsf2d::_CSFDB_Getgp_GTrsf2dshape ( ) const
inline
void gp_GTrsf2d::_CSFDB_Setgp_GTrsf2dscale ( const Standard_Real  p)
inline
void gp_GTrsf2d::_CSFDB_Setgp_GTrsf2dshape ( const gp_TrsfForm  p)
inline
gp_TrsfForm gp_GTrsf2d::Form ( ) const

Returns the nature of the transformation.  It can be <br>

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

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

Standard_Boolean gp_GTrsf2d::IsNegative ( ) const

Returns true if the determinant of the vectorial part of <br>

this transformation is negative.

Standard_Boolean gp_GTrsf2d::IsSingular ( ) const

 Returns true if this transformation is singular (and <br>

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_GTrsf2d gp_GTrsf2d::Multiplied ( const gp_GTrsf2d T) const

Computes the transformation composed with T and <me>.
In a C++ implementation you can also write Tcomposed = <me> * T.
Example :
GTrsf2d T1, T2, Tcomp; ...............
//composition :
Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
// transformation of a point
XY P(10.,3.);
XY P1(P);
Tcomp.Transforms(P1); //using Tcomp
XY P2(P);
T1.Transforms(P2); //using T1 then T2
T2.Transforms(P2); // P1 = P2 !!!

void gp_GTrsf2d::Multiply ( const gp_GTrsf2d T)
Standard_Real gp_GTrsf2d::operator() ( const Standard_Integer  Row,
const Standard_Integer  Col 
) const
inline
gp_GTrsf2d gp_GTrsf2d::operator* ( const gp_GTrsf2d T) const
inline
void gp_GTrsf2d::operator*= ( const gp_GTrsf2d T)
inline
void gp_GTrsf2d::Power ( const Standard_Integer  N)
gp_GTrsf2d gp_GTrsf2d::Powered ( const Standard_Integer  N) const

Computes the following composition of transformations <br>

<me> * <me> * .......* <me>, N time.
if N = 0 <me> = Identity
if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().

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

void gp_GTrsf2d::PreMultiply ( const gp_GTrsf2d T)

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

void gp_GTrsf2d::SetAffinity ( const gp_Ax2d A,
const Standard_Real  Ratio 
)

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

void gp_GTrsf2d::SetTranslationPart ( const gp_XY Coord)

 Replacesthe translation part of this <br>

transformation by the coordinates of the number pair Coord.

void gp_GTrsf2d::SetTrsf2d ( const gp_Trsf2d T)

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

void gp_GTrsf2d::SetValue ( const Standard_Integer  Row,
const Standard_Integer  Col,
const Standard_Real  Value 
)

Replaces   the coefficient (Row, Col) of the matrix representing <br>

this transformation by Value,
Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3

void gp_GTrsf2d::SetVectorialPart ( const gp_Mat2d Matrix)

Replaces the vectorial part of this transformation by Matrix.

gp_XY gp_GTrsf2d::Transformed ( const gp_XY Coord) const
void gp_GTrsf2d::Transforms ( gp_XY Coord) const
void gp_GTrsf2d::Transforms ( Standard_Real X,
Standard_Real Y 
) const

Applies this transformation to the coordinates:

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

    Note:
  • Transforms modifies X, Y, or the coordinate pair Coord, while
  • Transformed creates a new coordinate pair.
const gp_XY& gp_GTrsf2d::TranslationPart ( ) const

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.

Standard_Real gp_GTrsf2d::Value ( const Standard_Integer  Row,
const Standard_Integer  Col 
) const

Returns the coefficients of the global matrix of transformation. <br>

Raised OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3

const gp_Mat2d& gp_GTrsf2d::VectorialPart ( ) const

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: