CAD Exchanger SDK
cadex::ModelData_Transformation2d Class Reference

Defines a 2D transformation matrix. More...

Public Member Functions

 ModelData_Transformation2d (const ModelData_Transformation2d &theOther)
 Constructor.
 
 ModelData_Transformation2d (const ModelData_Vector2d &theTranslation)
 Constructor. More...
 
 ModelData_Transformation2d (const gp_Trsf2d &)
 Constructor. More...
 
 operator const gp_Trsf2d & () const
 
 operator gp_Trsf2d & ()
 
ModelData_Transformation2doperator= (const gp_Trsf2d &)
 Assignment operator.
 
bool IsIdentity () const
 Returns true if the matrix is identity.
 
void SetRotationPart (double theV00, double theV01, double theV10, double theV11)
 Sets a rotation component of the matrix.
 
void RotationPart (double &theV00, double &theV01, double &theV10, double &theV11) const
 Returns a rotation component of the matrix.
 
void SetTranslation (double theX, double theY)
 Sets a translation matrix. More...
 
void SetTranslation (const ModelData_Vector2d &theVec)
 Sets a translation matrix. More...
 
void SetTranslationPart (double theX, double theY)
 Sets a translation component of the matrix. More...
 
void SetTranslationPart (const ModelData_Vector2d &theVec)
 Sets a translation component of the matrix. More...
 
void TranslationPart (double &theX, double &theY) const
 Returns a translation part.
 
ModelData_Vector2d TranslationPart () const
 Returns a translation part. More...
 
void SetScaleFactor (double theScale)
 Sets a scale factor. More...
 
double ScaleFactor () const
 Returns a scale factor. More...
 
double Data (int i, int j) const
 
void operator*= (const gp_Trsf2d &theOther)
 Multiplies this matrix with another one.
 
ModelData_Transformation2d operator* (const gp_Trsf2d &theOther) const
 Multiplies this matrix with another one.
 
void Multiply (const ModelData_Transformation2d &theOther)
 Multiplies this matrix with another one.
 
ModelData_Transformation2d Multiplied (const ModelData_Transformation2d &theOther) const
 
void operator*= (const ModelData_Transformation2d &theOther)
 
ModelData_Transformation2d operator* (const ModelData_Transformation2d &theOther) const
 
void Invert ()
 Inverts the matrix. More...
 
ModelData_Transformation2d Inverted () const
 Returns an inverse of this matrix. More...
 
void Transform (double &theX, double &theY) const
 Transforms the coordinates using this transformation. More...
 

Detailed Description

Defines a 2D transformation matrix.

Contains rotation and translation part and a scale factor. A rotation part (2 x 2 matrix) must not contain a scale factor or inversion, i.e. its matrix determinant must be equal to 1.

Individual matrix elements can retrieved using the Data() method.

Constructor & Destructor Documentation

◆ ModelData_Transformation2d() [1/2]

cadex::ModelData_Transformation2d::ModelData_Transformation2d ( const ModelData_Vector2d &  theTranslation)

Constructor.

Creates a transformation matrix from translation component.

See also
SetTranslationPart(), TranslationPart().

◆ ModelData_Transformation2d() [2/2]

cadex::ModelData_Transformation2d::ModelData_Transformation2d ( const gp_Trsf2d &  theOther)

Constructor.

Creates an identity matrix (IsIdentity() will return true).

Member Function Documentation

◆ Data()

double cadex::ModelData_Transformation2d::Data ( int  i,
int  j 
) const

i must be in the range [0, 2], and j must be in the range [0, 3], otherwise behavior is undefined (most likely a call will result in access violation error).

◆ Invert()

void cadex::ModelData_Transformation2d::Invert ( )

Inverts the matrix.

Makes this matrix an inverse, i.e. A * A^(-1) = I.

◆ Inverted()

ModelData_Transformation2d cadex::ModelData_Transformation2d::Inverted ( ) const
inline

Returns an inverse of this matrix.

See also
Invert().

◆ ScaleFactor()

double cadex::ModelData_Transformation2d::ScaleFactor ( ) const

Returns a scale factor.

By default, a scale factor is 1.

See also
SetScaleFactor().

◆ SetScaleFactor()

void cadex::ModelData_Transformation2d::SetScaleFactor ( double  theScale)

Sets a scale factor.

See also
ScaleFactor().

◆ SetTranslation() [1/2]

void cadex::ModelData_Transformation2d::SetTranslation ( double  theX,
double  theY 
)

Sets a translation matrix.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets a matrix to define translation by specified vector.

See also
SetRotation().

◆ SetTranslation() [2/2]

void cadex::ModelData_Transformation2d::SetTranslation ( const ModelData_Vector2d &  theVec)

Sets a translation matrix.

Sets a matrix to define translation by specified vector.

See also
SetRotation().

◆ SetTranslationPart() [1/2]

void cadex::ModelData_Transformation2d::SetTranslationPart ( double  theX,
double  theY 
)

Sets a translation component of the matrix.

See also
SetRotationPart().

◆ SetTranslationPart() [2/2]

void cadex::ModelData_Transformation2d::SetTranslationPart ( const ModelData_Vector2d &  theVec)

Sets a translation component of the matrix.

See also
SetRotationPart().

◆ Transform()

void cadex::ModelData_Transformation2d::Transform ( double &  theX,
double &  theY 
) const

Transforms the coordinates using this transformation.

theX, theY, theZ are input/output parameters.

◆ TranslationPart()

ModelData_Vector2d cadex::ModelData_Transformation2d::TranslationPart ( ) const

Returns a translation part.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.