CAD Exchanger SDK
cadex::ModelData_Transformation Class Reference

Defines a transformation matrix. More...

Public Member Functions

 ModelData_Transformation ()
 Constructor. More...
 
 ModelData_Transformation (const ModelData_Transformation &theOther)
 Constructor.
 
 ModelData_Transformation (const ModelData_Vector &theTranslation)
 Constructor. More...
 
 ModelData_Transformation (const ModelData_Axis1Placement &theAxis, double theAngle, const ModelData_Vector &theTranslation=ModelData_Vector(), double theAngularPrecision=1e-12)
 Constructor. More...
 
 ModelData_Transformation (const ModelData_Axis3Placement &theSource, const ModelData_Axis3Placement &theTarget)
 Constructor. More...
 
 ModelData_Transformation (const gp_Trsf &)
 Constructor.
 
 operator const gp_Trsf & () const
 
 operator gp_Trsf & ()
 
ModelData_Transformationoperator= (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. More...
 
void Rotation (ModelData_XYZ &theXYZ, double &theAngle) const
 Returns a rotation component of the matrix. More...
 
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. More...
 
void SetTranslation (double theX, double theY, double theZ)
 Sets a translation matrix. More...
 
void SetTranslationPart (const ModelData_Vector &theVec)
 Sets a translation component of the matrix. More...
 
void SetTranslationPart (double theX, double theY, double theZ)
 Sets a translation component of the matrix. More...
 
void TranslationPart (double &theX, double &theY, double &theZ) const
 Returns a translation part.
 
ModelData_Vector 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_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. More...
 
ModelData_Transformation Inverted () const
 Returns an inverse of this matrix. More...
 
void Transform (double &theX, double &theY, double &theZ) const
 Transforms the coordinates using this transformation. More...
 

Detailed Description

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.

Examples:
assemblycreator/main.cxx, and modelexplorer/main.cxx.

Constructor & Destructor Documentation

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.

See also
SetTranslationPart(), TranslationPart().
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.

Member Function Documentation

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.

ModelData_Transformation cadex::ModelData_Transformation::Inverted ( ) const
inline

Returns an inverse of this matrix.

See also
Invert().
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

Returns a scale factor.

By default, a scale factor is 1.

See also
SetScaleFactor().
void cadex::ModelData_Transformation::SetRotation ( const ModelData_Axis1Placement theAx1,
double  theAngle 
)

Sets a rotation matrix.

Sets a matrix to define rotation around the axis with specified angle in radians.

See also
SetTranslation().
void cadex::ModelData_Transformation::SetScaleFactor ( double  theScale)

Sets a scale factor.

See also
ScaleFactor().
void cadex::ModelData_Transformation::SetTranslation ( const ModelData_Vector theVec)

Sets a translation matrix.

Sets a matrix to define translation by specified vector.

See also
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.

See also
SetRotation().
void cadex::ModelData_Transformation::SetTranslationPart ( const ModelData_Vector theVec)

Sets a translation component of the matrix.

See also
SetRotationPart().
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.

See also
SetRotationPart().
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.