Defines a 2D transformation matrix. More...
#include <cadex/ModelData_Transformation2d.hxx>
Public Member Functions | |
ModelData_Transformation2d (const ModelData_Transformation2d &theOther) | |
Constructor. | |
ModelData_Transformation2d (const ModelData_Vector2d &theTranslation) | |
Constructor. | |
ModelData_Transformation2d (const gp_Trsf2d &) | |
Constructor. | |
operator const gp_Trsf2d & () const | |
operator gp_Trsf2d & () | |
ModelData_Transformation2d & | operator= (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. | |
void | SetTranslation (const ModelData_Vector2d &theVec) |
Sets a translation matrix. | |
void | SetTranslationPart (double theX, double theY) |
Sets a translation component of the matrix. | |
void | SetTranslationPart (const ModelData_Vector2d &theVec) |
Sets a translation component of the matrix. | |
void | TranslationPart (double &theX, double &theY) const |
Returns a translation part. | |
ModelData_Vector2d | TranslationPart () const |
Returns a translation part. | |
void | SetScaleFactor (double theScale) |
Sets a scale factor. | |
double | ScaleFactor () const |
Returns a scale factor. | |
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. | |
ModelData_Transformation2d | Inverted () const |
Returns an inverse of this matrix. | |
void | Transform (double &theX, double &theY) const |
Transforms the coordinates using this transformation. | |
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.
cadex::ModelData_Transformation2d::ModelData_Transformation2d | ( | const ModelData_Vector2d & | theTranslation | ) |
Constructor.
Creates a transformation matrix from translation component.
cadex::ModelData_Transformation2d::ModelData_Transformation2d | ( | const gp_Trsf2d & | theOther | ) |
Constructor.
Creates an identity matrix (IsIdentity() will return true).
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).
void cadex::ModelData_Transformation2d::Invert | ( | ) |
Inverts the matrix.
Makes this matrix an inverse, i.e. A * A^(-1) = I.
|
inline |
Returns an inverse of this matrix.
double cadex::ModelData_Transformation2d::ScaleFactor | ( | ) | const |
void cadex::ModelData_Transformation2d::SetScaleFactor | ( | double | theScale | ) |
Sets a scale factor.
void cadex::ModelData_Transformation2d::SetTranslation | ( | const ModelData_Vector2d & | theVec | ) |
Sets a translation matrix.
Discards the existing transformation matrix and sets it to define translation for the specified vector.
To specify translation without affecting rotation and scale use SetTranslationPart() function.
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.
void cadex::ModelData_Transformation2d::SetTranslationPart | ( | const ModelData_Vector2d & | theVec | ) |
Sets a translation component of the matrix.
void cadex::ModelData_Transformation2d::SetTranslationPart | ( | double | theX, |
double | theY | ||
) |
Sets a translation component of the matrix.
void cadex::ModelData_Transformation2d::Transform | ( | double & | theX, |
double & | theY | ||
) | const |
Transforms the coordinates using this transformation.
theX, theY, theZ are input/output parameters.
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.