Defines a transformation matrix. More...
Public Member Functions | |
ModelData_Transformation () | |
Constructor. | |
ModelData_Transformation (const ModelData_Transformation &theOther) | |
Constructor. | |
ModelData_Transformation (const ModelData_Vector &theTranslation) | |
Constructor. | |
ModelData_Transformation (const ModelData_Axis1Placement &theAxis, double theAngle, const ModelData_Vector &theTranslation=ModelData_Vector(), double theAngularPrecision=1e-12) | |
Constructor. | |
ModelData_Transformation (const ModelData_Axis3Placement &theSource, const ModelData_Axis3Placement &theTarget) | |
Constructor. | |
ModelData_Transformation (const gp_Trsf &) | |
Constructor. | |
operator const gp_Trsf & () const | |
operator gp_Trsf & () | |
ModelData_Transformation & | operator= (const gp_Trsf &) |
Assignment operator. | |
bool | IsIdentity () const |
Returns true if the matrix is identity. | |
void | SetRotation (const ModelData_Axis1Placement &theAx1, double theAngle) |
Sets a rotation matrix. | |
void | Rotation (ModelData_XYZ &theXYZ, double &theAngle) const |
Returns a rotation component of the matrix. | |
void | SetRotationPart (double theV00, double theV01, double theV02, double theV10, double theV11, double theV12, double theV20, double theV21, double theV22) |
Sets a rotation component of the matrix. | |
void | RotationPart (double &theV00, double &theV01, double &theV02, double &theV10, double &theV11, double &theV12, double &theV20, double &theV21, double &theV22) const |
Returns a rotation component of the matrix. | |
void | SetTranslation (const ModelData_Vector &theVec) |
Sets a translation matrix. | |
void | SetTranslation (double theX, double theY, double theZ) |
Sets a translation matrix. | |
void | SetTranslationPart (const ModelData_Vector &theVec) |
Sets a translation component of the matrix. | |
void | SetTranslationPart (double theX, double theY, double theZ) |
Sets a translation component of the matrix. | |
void | TranslationPart (double &theX, double &theY, double &theZ) const |
Returns a translation part. | |
ModelData_Vector | 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_Trsf &theOther) |
Multiplies this matrix with another one. | |
ModelData_Transformation | operator* (const gp_Trsf &theOther) const |
Multiplies this matrix with another one. | |
void | Multiply (const ModelData_Transformation &theOther) |
Multiplies this matrix with another one. | |
ModelData_Transformation | Multiplied (const ModelData_Transformation &theOther) const |
void | operator*= (const ModelData_Transformation &theOther) |
ModelData_Transformation | operator* (const ModelData_Transformation &theOther) const |
void | Invert () |
Inverts the matrix. | |
ModelData_Transformation | Inverted () const |
Returns an inverse of this matrix. | |
void | Transform (double &theX, double &theY, double &theZ) const |
Transforms the coordinates using this transformation. | |
Defines a transformation matrix.
Contains rotation and translation part and a scale factor. A rotation part (3 x 3 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_Transformation::ModelData_Transformation | ( | ) |
Constructor.
Creates an identity matrix (IsIdentity() will return true).
cadex::ModelData_Transformation::ModelData_Transformation | ( | const ModelData_Vector & | theTranslation | ) |
Constructor.
Creates a transformation matrix from translation component.
cadex::ModelData_Transformation::ModelData_Transformation | ( | const ModelData_Axis1Placement & | theAxis, |
double | theAngle, | ||
const ModelData_Vector & | theTranslation = ModelData_Vector() , |
||
double | theAngularPrecision = 1e-12 |
||
) |
Constructor.
Creates a transformation matrix from rotation and translation components. If theAngle (in radians) is less than theAngularPrecision then the rotation component is ignored.
cadex::ModelData_Transformation::ModelData_Transformation | ( | const ModelData_Axis3Placement & | theSource, |
const ModelData_Axis3Placement & | theTarget | ||
) |
Constructor.
Creates a transformation matrix describing a transformation from theSource axis placement to theTarget.
If one of the axis placements is left-handed then the rotation matrix will have negative determinant.
double cadex::ModelData_Transformation::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_Transformation::Invert | ( | ) |
Inverts the matrix.
Makes this matrix an inverse, i.e. A * A^(-1) = I.
|
inline |
Returns an inverse of this matrix.
void cadex::ModelData_Transformation::Rotation | ( | ModelData_XYZ & | theXYZ, |
double & | theAngle | ||
) | const |
Returns a rotation component of the matrix.
Returns a rotation axis and an angle in radians.
double cadex::ModelData_Transformation::ScaleFactor | ( | ) | const |
void cadex::ModelData_Transformation::SetRotation | ( | const ModelData_Axis1Placement & | theAx1, |
double | theAngle | ||
) |
Sets a rotation matrix.
Discards the existing transformation matrix and sets it to define rotation around the axis with specified angle in radians.
To specify rotation without affecting translation and scale use SetRotationPart() function.
\sa SetTranslation().
void cadex::ModelData_Transformation::SetScaleFactor | ( | double | theScale | ) |
Sets a scale factor.
void cadex::ModelData_Transformation::SetTranslation | ( | const ModelData_Vector & | 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.
\sa SetRotation().
void cadex::ModelData_Transformation::SetTranslation | ( | double | theX, |
double | theY, | ||
double | theZ | ||
) |
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_Transformation::SetTranslationPart | ( | const ModelData_Vector & | theVec | ) |
Sets a translation component of the matrix.
void cadex::ModelData_Transformation::SetTranslationPart | ( | double | theX, |
double | theY, | ||
double | theZ | ||
) |
Sets a translation component of the matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void cadex::ModelData_Transformation::Transform | ( | double & | theX, |
double & | theY, | ||
double & | theZ | ||
) | const |
Transforms the coordinates using this transformation.
theX, theY, theZ are input/output parameters.
ModelData_Vector cadex::ModelData_Transformation::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.