Open CASCADE Technology  6.9.1
Public Member Functions | Protected Member Functions
gp_Trsf Class Reference

Defines a non-persistent transformation in 3D space. The following transformations are implemented : . Translation, Rotation, Scale . Symmetry with respect to a point, a line, a plane. 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_Trsf.hxx>

Public Member Functions

 gp_Trsf ()
 Returns the identity transformation. More...
 
 gp_Trsf (const gp_Trsf2d &T)
 Creates a 3D transformation from the 2D transformation T. The resulting transformation has a homogeneous vectorial part, V3, and a translation part, T3, built from T: a11 a12 0 a13 V3 = a21 a22 0 T3 = a23 0 0 1. 0 It also has the same scale factor as T. This guarantees (by projection) that the transformation which would be performed by T in a plane (2D space) is performed by the resulting transformation in the xOy plane of the 3D space, (i.e. in the plane defined by the origin (0., 0., 0.) and the vectors DX (1., 0., 0.), and DY (0., 1., 0.)). The scale factor is applied to the entire space. More...
 
void SetMirror (const gp_Pnt &P)
 Makes the transformation into a symmetrical transformation. P is the center of the symmetry. More...
 
void SetMirror (const gp_Ax1 &A1)
 Makes the transformation into a symmetrical transformation. A1 is the center of the axial symmetry. More...
 
void SetMirror (const gp_Ax2 &A2)
 Makes the transformation into a symmetrical transformation. A2 is the center of the planar symmetry and defines the plane of symmetry by its origin, "X Direction" and "Y Direction". More...
 
void SetRotation (const gp_Ax1 &A1, const Standard_Real Ang)
 Changes the transformation into a rotation. A1 is the rotation axis and Ang is the angular value of the rotation in radians. More...
 
void SetRotation (const gp_Quaternion &R)
 Changes the transformation into a rotation defined by quaternion. Note that rotation is performed around origin, i.e. no translation is involved. More...
 
void SetScale (const gp_Pnt &P, const Standard_Real S)
 Changes the transformation into a scale. P is the center of the scale and S is the scaling value. Raises ConstructionError If <S> is null. More...
 
void SetDisplacement (const gp_Ax3 &FromSystem1, const gp_Ax3 &ToSystem2)
 Modifies this transformation so that it transforms the coordinate system defined by FromSystem1 into the one defined by ToSystem2. After this modification, this transformation transforms: More...
 
void SetTransformation (const gp_Ax3 &FromSystem1, const gp_Ax3 &ToSystem2)
 Modifies this transformation so that it transforms the coordinates of any point, (x, y, z), relative to a source coordinate system into the coordinates (x', y', z') which are relative to a target coordinate system, but which represent the same point The transformation is from the coordinate system "FromSystem1" to the coordinate system "ToSystem2". Example : In a C++ implementation : Real x1, y1, z1; // are the coordinates of a point in the // local system FromSystem1 Real x2, y2, z2; // are the coordinates of a point in the // local system ToSystem2 gp_Pnt P1 (x1, y1, z1) Trsf T; T.SetTransformation (FromSystem1, ToSystem2); gp_Pnt P2 = P1.Transformed (T); P2.Coord (x2, y2, z2);. More...
 
void SetTransformation (const gp_Ax3 &ToSystem)
 Modifies this transformation so that it transforms the coordinates of any point, (x, y, z), relative to a source coordinate system into the coordinates (x', y', z') which are relative to a target coordinate system, but which represent the same point The transformation is from the default coordinate system {P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.), VZ (0., 0. ,1.) } to the local coordinate system defined with the Ax3 ToSystem. Use in the same way as the previous method. FromSystem1 is defaulted to the absolute coordinate system. More...
 
void SetTransformation (const gp_Quaternion &R, const gp_Vec &T)
 Sets transformation by directly specified rotation and translation. More...
 
void SetTranslation (const gp_Vec &V)
 Changes the transformation into a translation. V is the vector of the translation. More...
 
void SetTranslation (const gp_Pnt &P1, const gp_Pnt &P2)
 Makes the transformation into a translation where the translation vector is the vector (P1, P2) defined from point P1 to point P2. More...
 
void SetTranslationPart (const gp_Vec &V)
 Replaces the translation vector with the vector V. More...
 
void SetScaleFactor (const Standard_Real S)
 Modifies the scale factor. Raises ConstructionError If S is null. More...
 
void SetValues (const Standard_Real a11, const Standard_Real a12, const Standard_Real a13, const Standard_Real a14, const Standard_Real a21, const Standard_Real a22, const Standard_Real a23, const Standard_Real a24, const Standard_Real a31, const Standard_Real a32, const Standard_Real a33, const Standard_Real a34)
 Sets the coefficients of the transformation. The transformation of the point x,y,z is the point x',y',z' with : 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 transformation (relative to a point, an axis or a plane), a scaling transformation, or a compound transformation. More...
 
Standard_Real ScaleFactor () const
 Returns the scale factor. More...
 
const gp_XYZTranslationPart () const
 Returns the translation part of the transformation's matrix. More...
 
Standard_Boolean GetRotation (gp_XYZ &theAxis, Standard_Real &theAngle) const
 Returns the boolean True if there is non-zero rotation. In the presence of rotation, the output parameters store the axis and the angle of rotation. The method always returns positive value "theAngle", i.e., 0. < theAngle <= PI. Note that this rotation is defined only by the vectorial part of the transformation; generally you would need to check also the translational part to obtain the axis (gp_Ax1) of rotation. More...
 
gp_Quaternion GetRotation () const
 Returns quaternion representing rotational part of the transformation. More...
 
gp_Mat VectorialPart () const
 Returns the vectorial part of the transformation. It is a 3*3 matrix which includes the scale factor. More...
 
const gp_MatHVectorialPart () const
 Computes the homogeneous vectorial part of the transformation. It is a 3*3 matrix which doesn't include the scale factor. In other words, the vectorial part of this transformation is equal to its homogeneous vectorial part, multiplied by 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 Value (const Standard_Integer Row, const Standard_Integer Col) const
 Returns the coefficients of the transformation's matrix. It is a 3 rows * 4 columns matrix. This coefficient includes the scale factor. Raises OutOfRanged if Row < 1 or Row > 3 or Col < 1 or Col > 4. More...
 
void Invert ()
 
gp_Trsf 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. Computes the transformation composed with T and <me>. In a C++ implementation you can also write Tcomposed = <me> * T. Example : Trsf T1, T2, Tcomp; ............... Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1) Pnt P1(10.,3.,4.); Pnt P2 = P1.Transformed(Tcomp); //using Tcomp Pnt P3 = P1.Transformed(T1); //using T1 then T2 P3.Transform(T2); // P3 = P2 !!! More...
 
gp_Trsf Multiplied (const gp_Trsf &T) const
 
gp_Trsf operator* (const gp_Trsf &T) const
 
void Multiply (const gp_Trsf &T)
 Computes the transformation composed with <me> and T. <me> = <me> * T. More...
 
void operator*= (const gp_Trsf &T)
 
void PreMultiply (const gp_Trsf &T)
 Computes the transformation composed with <me> and T. <me> = T * <me> More...
 
void Power (const Standard_Integer N)
 
gp_Trsf Powered (const Standard_Integer N) const
 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, Standard_Real &Z) const
 
void Transforms (gp_XYZ &Coord) const
 Transformation of a triplet XYZ with a Trsf. More...
 
Standard_Real _CSFDB_Getgp_Trsfscale () const
 
void _CSFDB_Setgp_Trsfscale (const Standard_Real p)
 
gp_TrsfForm _CSFDB_Getgp_Trsfshape () const
 
void _CSFDB_Setgp_Trsfshape (const gp_TrsfForm p)
 
const gp_Mat_CSFDB_Getgp_Trsfmatrix () const
 
const gp_XYZ_CSFDB_Getgp_Trsfloc () const
 

Protected Member Functions

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

Detailed Description

Defines a non-persistent transformation in 3D space. The following transformations are implemented : . Translation, Rotation, Scale . Symmetry with respect to a point, a line, a plane. Complex transformations can be obtained by combining the previous elementary transformations using the method Multiply. The transformations 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 |

where {V1, V2, V3} 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_Trsf::gp_Trsf ( )

Returns the identity transformation.

gp_Trsf::gp_Trsf ( const gp_Trsf2d T)

Creates a 3D transformation from the 2D transformation T. The resulting transformation has a homogeneous vectorial part, V3, and a translation part, T3, built from T: a11 a12 0 a13 V3 = a21 a22 0 T3 = a23 0 0 1. 0 It also has the same scale factor as T. This guarantees (by projection) that the transformation which would be performed by T in a plane (2D space) is performed by the resulting transformation in the xOy plane of the 3D space, (i.e. in the plane defined by the origin (0., 0., 0.) and the vectors DX (1., 0., 0.), and DY (0., 1., 0.)). The scale factor is applied to the entire space.

Member Function Documentation

const gp_XYZ& gp_Trsf::_CSFDB_Getgp_Trsfloc ( ) const
inline
const gp_Mat& gp_Trsf::_CSFDB_Getgp_Trsfmatrix ( ) const
inline
Standard_Real gp_Trsf::_CSFDB_Getgp_Trsfscale ( ) const
inline
gp_TrsfForm gp_Trsf::_CSFDB_Getgp_Trsfshape ( ) const
inline
void gp_Trsf::_CSFDB_Setgp_Trsfscale ( const Standard_Real  p)
inline
void gp_Trsf::_CSFDB_Setgp_Trsfshape ( const gp_TrsfForm  p)
inline
gp_TrsfForm gp_Trsf::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, an axis or a plane), a scaling transformation, or a compound transformation.

Standard_Boolean gp_Trsf::GetRotation ( gp_XYZ theAxis,
Standard_Real theAngle 
) const

Returns the boolean True if there is non-zero rotation. In the presence of rotation, the output parameters store the axis and the angle of rotation. The method always returns positive value "theAngle", i.e., 0. < theAngle <= PI. Note that this rotation is defined only by the vectorial part of the transformation; generally you would need to check also the translational part to obtain the axis (gp_Ax1) of rotation.

gp_Quaternion gp_Trsf::GetRotation ( ) const

Returns quaternion representing rotational part of the transformation.

const gp_Mat& gp_Trsf::HVectorialPart ( ) const

Computes the homogeneous vectorial part of the transformation. It is a 3*3 matrix which doesn't include the scale factor. In other words, the vectorial part of this transformation is equal to its homogeneous vectorial part, multiplied by the scale factor. The coefficients of this matrix must be multiplied by the scale factor to obtain the coefficients of the transformation.

void gp_Trsf::Invert ( )
gp_Trsf gp_Trsf::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. Computes the transformation composed with T and <me>. In a C++ implementation you can also write Tcomposed = <me> * T. Example : Trsf T1, T2, Tcomp; ............... Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1) Pnt P1(10.,3.,4.); Pnt P2 = P1.Transformed(Tcomp); //using Tcomp Pnt P3 = P1.Transformed(T1); //using T1 then T2 P3.Transform(T2); // P3 = P2 !!!

Standard_Boolean gp_Trsf::IsNegative ( ) const

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

gp_Trsf gp_Trsf::Multiplied ( const gp_Trsf T) const
void gp_Trsf::Multiply ( const gp_Trsf T)

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

gp_Trsf gp_Trsf::operator* ( const gp_Trsf T) const
inline
void gp_Trsf::operator*= ( const gp_Trsf T)
inline
void gp_Trsf::Orthogonalize ( )
protected

Makes orthogonalization of "matrix".

void gp_Trsf::Power ( const Standard_Integer  N)
gp_Trsf gp_Trsf::Powered ( const Standard_Integer  N) const

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.

void gp_Trsf::PreMultiply ( const gp_Trsf T)

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

Standard_Real gp_Trsf::ScaleFactor ( ) const

Returns the scale factor.

void gp_Trsf::SetDisplacement ( const gp_Ax3 FromSystem1,
const gp_Ax3 ToSystem2 
)

Modifies this transformation so that it transforms the coordinate system defined by FromSystem1 into the one defined by ToSystem2. After this modification, this transformation transforms:

  • the origin of FromSystem1 into the origin of ToSystem2,
  • the "X Direction" of FromSystem1 into the "X Direction" of ToSystem2,
  • the "Y Direction" of FromSystem1 into the "Y Direction" of ToSystem2, and
  • the "main Direction" of FromSystem1 into the "main Direction" of ToSystem2. Warning When you know the coordinates of a point in one coordinate system and you want to express these coordinates in another one, do not use the transformation resulting from this function. Use the transformation that results from SetTransformation instead. SetDisplacement and SetTransformation create related transformations: the vectorial part of one is the inverse of the vectorial part of the other.
void gp_Trsf::SetMirror ( const gp_Pnt P)

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

void gp_Trsf::SetMirror ( const gp_Ax1 A1)

Makes the transformation into a symmetrical transformation. A1 is the center of the axial symmetry.

void gp_Trsf::SetMirror ( const gp_Ax2 A2)

Makes the transformation into a symmetrical transformation. A2 is the center of the planar symmetry and defines the plane of symmetry by its origin, "X Direction" and "Y Direction".

void gp_Trsf::SetRotation ( const gp_Ax1 A1,
const Standard_Real  Ang 
)

Changes the transformation into a rotation. A1 is the rotation axis and Ang is the angular value of the rotation in radians.

void gp_Trsf::SetRotation ( const gp_Quaternion R)

Changes the transformation into a rotation defined by quaternion. Note that rotation is performed around origin, i.e. no translation is involved.

void gp_Trsf::SetScale ( const gp_Pnt P,
const Standard_Real  S 
)

Changes the transformation into a scale. P is the center of the scale and S is the scaling value. Raises ConstructionError If <S> is null.

void gp_Trsf::SetScaleFactor ( const Standard_Real  S)

Modifies the scale factor. Raises ConstructionError If S is null.

void gp_Trsf::SetTransformation ( const gp_Ax3 FromSystem1,
const gp_Ax3 ToSystem2 
)

Modifies this transformation so that it transforms the coordinates of any point, (x, y, z), relative to a source coordinate system into the coordinates (x', y', z') which are relative to a target coordinate system, but which represent the same point The transformation is from the coordinate system "FromSystem1" to the coordinate system "ToSystem2". Example : In a C++ implementation : Real x1, y1, z1; // are the coordinates of a point in the // local system FromSystem1 Real x2, y2, z2; // are the coordinates of a point in the // local system ToSystem2 gp_Pnt P1 (x1, y1, z1) Trsf T; T.SetTransformation (FromSystem1, ToSystem2); gp_Pnt P2 = P1.Transformed (T); P2.Coord (x2, y2, z2);.

void gp_Trsf::SetTransformation ( const gp_Ax3 ToSystem)

Modifies this transformation so that it transforms the coordinates of any point, (x, y, z), relative to a source coordinate system into the coordinates (x', y', z') which are relative to a target coordinate system, but which represent the same point The transformation is from the default coordinate system {P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.), VZ (0., 0. ,1.) } to the local coordinate system defined with the Ax3 ToSystem. Use in the same way as the previous method. FromSystem1 is defaulted to the absolute coordinate system.

void gp_Trsf::SetTransformation ( const gp_Quaternion R,
const gp_Vec T 
)

Sets transformation by directly specified rotation and translation.

void gp_Trsf::SetTranslation ( const gp_Vec V)

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

void gp_Trsf::SetTranslation ( const gp_Pnt P1,
const gp_Pnt P2 
)

Makes the transformation into a translation where the translation vector is the vector (P1, P2) defined from point P1 to point P2.

void gp_Trsf::SetTranslationPart ( const gp_Vec V)

Replaces the translation vector with the vector V.

void gp_Trsf::SetValues ( const Standard_Real  a11,
const Standard_Real  a12,
const Standard_Real  a13,
const Standard_Real  a14,
const Standard_Real  a21,
const Standard_Real  a22,
const Standard_Real  a23,
const Standard_Real  a24,
const Standard_Real  a31,
const Standard_Real  a32,
const Standard_Real  a33,
const Standard_Real  a34 
)

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

x' = a11 x + a12 y + a13 z + a14 y' = a21 x + a22 y + a23 z + a24 z' = a31 x + a32 y + a33 z + a34

The method Value(i,j) will return aij. Raises ConstructionError if the determinant of the aij is null. The matrix is orthogonalized before future using.

void gp_Trsf::Transforms ( Standard_Real X,
Standard_Real Y,
Standard_Real Z 
) const
void gp_Trsf::Transforms ( gp_XYZ Coord) const

Transformation of a triplet XYZ with a Trsf.

const gp_XYZ& gp_Trsf::TranslationPart ( ) const

Returns the translation part of the transformation's matrix.

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

Returns the coefficients of the transformation's matrix. It is a 3 rows * 4 columns matrix. This coefficient includes the scale factor. Raises OutOfRanged if Row < 1 or Row > 3 or Col < 1 or Col > 4.

gp_Mat gp_Trsf::VectorialPart ( ) const

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


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