Open CASCADE Technology 7.8.0
|
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. | |
gp_Trsf (const gp_Trsf2d &theT) | |
Creates a 3D transformation from the 2D transformation theT. The resulting transformation has a homogeneous vectorial part, V3, and a translation part, T3, built from theT: a11 a12 0 a13 V3 = a21 a22 0 T3 = a23 0 0 1. 0 It also has the same scale factor as theT. This guarantees (by projection) that the transformation which would be performed by theT 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. | |
void | SetMirror (const gp_Pnt &theP) |
Makes the transformation into a symmetrical transformation. theP is the center of the symmetry. | |
void | SetMirror (const gp_Ax1 &theA1) |
Makes the transformation into a symmetrical transformation. theA1 is the center of the axial symmetry. | |
void | SetMirror (const gp_Ax2 &theA2) |
Makes the transformation into a symmetrical transformation. theA2 is the center of the planar symmetry and defines the plane of symmetry by its origin, "X
Direction" and "Y Direction". | |
void | SetRotation (const gp_Ax1 &theA1, const Standard_Real theAng) |
Changes the transformation into a rotation. theA1 is the rotation axis and theAng is the angular value of the rotation in radians. | |
void | SetRotation (const gp_Quaternion &theR) |
Changes the transformation into a rotation defined by quaternion. Note that rotation is performed around origin, i.e. no translation is involved. | |
void | SetRotationPart (const gp_Quaternion &theR) |
Replaces the rotation part with specified quaternion. | |
void | SetScale (const gp_Pnt &theP, const Standard_Real theS) |
Changes the transformation into a scale. theP is the center of the scale and theS is the scaling value. Raises ConstructionError If <theS> is null. | |
void | SetDisplacement (const gp_Ax3 &theFromSystem1, const gp_Ax3 &theToSystem2) |
Modifies this transformation so that it transforms the coordinate system defined by theFromSystem1 into the one defined by theToSystem2. After this modification, this transformation transforms: | |
void | SetTransformation (const gp_Ax3 &theFromSystem1, const gp_Ax3 &theToSystem2) |
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 "theFromSystem1" to the coordinate system "theToSystem2". Example : | |
void | SetTransformation (const gp_Ax3 &theToSystem) |
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. | |
void | SetTransformation (const gp_Quaternion &R, const gp_Vec &theT) |
Sets transformation by directly specified rotation and translation. | |
void | SetTranslation (const gp_Vec &theV) |
Changes the transformation into a translation. theV is the vector of the translation. | |
void | SetTranslation (const gp_Pnt &theP1, const gp_Pnt &theP2) |
Makes the transformation into a translation where the translation vector is the vector (theP1, theP2) defined from point theP1 to point theP2. | |
void | SetTranslationPart (const gp_Vec &theV) |
Replaces the translation vector with the vector theV. | |
void | SetScaleFactor (const Standard_Real theS) |
Modifies the scale factor. Raises ConstructionError If theS is null. | |
void | SetForm (const gp_TrsfForm theP) |
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 : | |
Standard_Boolean | IsNegative () const |
Returns true if the determinant of the vectorial part of this transformation is negative. | |
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. | |
Standard_Real | ScaleFactor () const |
Returns the scale factor. | |
const gp_XYZ & | TranslationPart () const |
Returns the translation part of the transformation's matrix. | |
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. | |
gp_Quaternion | GetRotation () const |
Returns quaternion representing rotational part of the transformation. | |
gp_Mat | VectorialPart () const |
Returns the vectorial part of the transformation. It is a 3*3 matrix which includes the scale factor. | |
const gp_Mat & | 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. | |
Standard_Real | Value (const Standard_Integer theRow, const Standard_Integer theCol) 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 theRow < 1 or theRow > 3 or theCol < 1 or theCol > 4. | |
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 : | |
gp_Trsf | Multiplied (const gp_Trsf &theT) const |
gp_Trsf | operator* (const gp_Trsf &theT) const |
void | Multiply (const gp_Trsf &theT) |
Computes the transformation composed with <me> and theT. <me> = <me> * theT. | |
void | operator*= (const gp_Trsf &theT) |
void | PreMultiply (const gp_Trsf &theT) |
Computes the transformation composed with <me> and T. <me> = theT * <me> | |
void | Power (const Standard_Integer theN) |
gp_Trsf | 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 (Standard_Real &theX, Standard_Real &theY, Standard_Real &theZ) const |
void | Transforms (gp_XYZ &theCoord) const |
Transformation of a triplet XYZ with a Trsf. | |
template<class T > | |
void | GetMat4 (NCollection_Mat4< T > &theMat) const |
Convert transformation to 4x4 matrix. | |
void | DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const |
Dumps the content of me into the stream. | |
Standard_Boolean | InitFromJson (const Standard_SStream &theSStream, Standard_Integer &theStreamPos) |
Inits the content of me from the stream. | |
Protected Member Functions | |
void | Orthogonalize () |
Makes orthogonalization of "matrix". | |
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 :
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.
|
inline |
Returns the identity transformation.
Creates a 3D transformation from the 2D transformation theT. The resulting transformation has a homogeneous vectorial part, V3, and a translation part, T3, built from theT: a11 a12 0 a13 V3 = a21 a22 0 T3 = a23 0 0 1. 0 It also has the same scale factor as theT. This guarantees (by projection) that the transformation which would be performed by theT 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.
void gp_Trsf::DumpJson | ( | Standard_OStream & | theOStream, |
Standard_Integer | theDepth = -1 |
||
) | const |
Dumps the content of me into the stream.
|
inline |
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.
|
inline |
Convert transformation to 4x4 matrix.
gp_Quaternion gp_Trsf::GetRotation | ( | ) | const |
Returns quaternion representing rotational part of the 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.
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.
Standard_Boolean gp_Trsf::InitFromJson | ( | const Standard_SStream & | theSStream, |
Standard_Integer & | theStreamPos | ||
) |
Inits the content of me from the stream.
void gp_Trsf::Invert | ( | ) |
|
inline |
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 :
|
inline |
Returns true if the determinant of the vectorial part of this transformation is negative.
Computes the transformation composed with <me> and theT. <me> = <me> * theT.
|
protected |
Makes orthogonalization of "matrix".
void gp_Trsf::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 if theN < 0 and if the matrix of the transformation not inversible.
Computes the transformation composed with <me> and T. <me> = theT * <me>
|
inline |
Returns the scale factor.
Modifies this transformation so that it transforms the coordinate system defined by theFromSystem1 into the one defined by theToSystem2. After this modification, this transformation transforms:
|
inline |
Makes the transformation into a symmetrical transformation. theA1 is the center of the axial symmetry.
Makes the transformation into a symmetrical transformation. theA2 is the center of the planar symmetry and defines the plane of symmetry by its origin, "X Direction" and "Y Direction".
Makes the transformation into a symmetrical transformation. theP is the center of the symmetry.
void gp_Trsf::SetRotation | ( | const gp_Ax1 & | theA1, |
const Standard_Real | theAng | ||
) |
Changes the transformation into a rotation. theA1 is the rotation axis and theAng is the angular value of the rotation in radians.
void gp_Trsf::SetRotation | ( | const gp_Quaternion & | theR | ) |
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::SetRotationPart | ( | const gp_Quaternion & | theR | ) |
Replaces the rotation part with specified quaternion.
void gp_Trsf::SetScale | ( | const gp_Pnt & | theP, |
const Standard_Real | theS | ||
) |
Changes the transformation into a scale. theP is the center of the scale and theS is the scaling value. Raises ConstructionError If <theS> is null.
void gp_Trsf::SetScaleFactor | ( | const Standard_Real | theS | ) |
Modifies the scale factor. Raises ConstructionError If theS is null.
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 "theFromSystem1" to the coordinate system "theToSystem2". Example :
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.
to the local coordinate system defined with the Ax3 theToSystem. 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 & | theT | ||
) |
Sets transformation by directly specified rotation and translation.
Makes the transformation into a translation where the translation vector is the vector (theP1, theP2) defined from point theP1 to point theP2.
Changes the transformation into a translation. theV is the vector of the translation.
Replaces the translation vector with the vector theV.
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 :
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.
|
inline |
Transformation of a triplet XYZ with a Trsf.
|
inline |
Returns the translation part of the transformation's matrix.
|
inline |
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 theRow < 1 or theRow > 3 or theCol < 1 or theCol > 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.