|
C3D Toolkit
Kernel - 118052, Vision - 2.14.3.1813
|
The extended matrix of transformation in a three-dimensional space. More...
#include <mb_matrix3d.h>
Collaboration diagram for MbMatrix3D:Public Member Functions | |
| MbMatrix3D () | |
| Default constructor. Defines the identity matrix. | |
| MbMatrix3D (const MbMatrix3D &init) | |
| The copy constructor. | |
| MbMatrix3D (const MbPlacement3D &place) | |
| The constructor by placement. | |
| MbMatrix3D (const MbMatrix &m) | |
| The constructor by a two-dimensional matrix. | |
| MbMatrix3D (const MbMatrix3D &A, const MbMatrix3D &B) | |
| The constructor by two matrices. More... | |
| ~MbMatrix3D () | |
| Destructor. | |
| void | MouldCavityScale (MbCartPoint3D &fixedPoint, double deltaX, double deltaY, double deltaZ) |
| Get the matrix for scale of a mold cavern. More... | |
| bool | SetRoundedValue (bool total, double eps) |
| Round with eps tolerance. More... | |
| void | Normalize () |
| Normalize. | |
| bool | CalculateFixedPoint (MbCartPoint3D &fixedPoint) const |
| Calculate a fixed point of transformation. | |
| void | GetProperties (MbProperties &) |
| Get properties of the object. | |
| void | SetProperties (const MbProperties &) |
| Set properties of the object. | |
Initialization functions. | |
| MbMatrix3D & | Init () |
| Initialize a matrix as unit one. | |
| MbMatrix3D & | Init (const MbMatrix3D &) |
| Initialize by elements of another matrix. | |
| MbMatrix3D & | Init (const MbMatrix &) |
| Initialize by a two-dimensional matrix. | |
| MbMatrix3D & | Init (const MbPlacement3D &) |
| Initialize by a placement. | |
| MbMatrix3D & | Init (const MbMatrix3D &a, const MbMatrix3D &b) |
| Initialize by the product of given matrices. More... | |
Functions for check of matrices properties. | |
| bool | IsInvert () const |
| Get an attribute of negativity of the determinant of a rotation matrix. | |
| bool | IsSingle () const |
| Get an attribute of unit matrix. | |
| bool | IsSingleEps (double eps=PARAM_EPSILON) const |
| Get an attribute of the identity matrix with a given tolerance. | |
| bool | IsTranslation () const |
| Get an attribute of inequality to zero of translation vector. | |
| bool | IsRotation () const |
| Get an attribute of non-identity of a rotation matrix. | |
| bool | IsReflection () const |
| Get an attribute of negativity of the determinant of a rotation matrix. | |
| bool | IsLeft () const |
| Get an attribute of the left-definite matrix. | |
| bool | IsOrt () const |
| Get an attribute of orthogonality for the case if the matrix is affine. | |
| bool | IsOrthogonal () const |
| Get an attribute of orthogonality for the case if the matrix is a rotation matrix. | |
| bool | IsAffine () const |
| Get an attribute that the rotational matrix is arbitrary and affine. | |
| bool | IsScaling () const |
| Get an attribute of inequality to 1.0 of a scale component. More... | |
| bool | IsPerspective () const |
| bool | IsUnSet () const |
| Check whether bit flags are not set. | |
| bool | IsSame (const MbMatrix3D &, double accuracy) const |
| Determine whether an object is equal? | |
| bool | IsAbsIdentical (const MbMatrix3D &m) const |
| Get an attribute of unit matrices. | |
| bool | IsTranslationOnly () const |
| Get an attribute that there is only translation. | |
| bool | IsSubstitutionOnly (double epsilon=METRIC_EPSILON) const |
| Are the axis described by the matrix local system coincide with global axes up to a 90-degree rotation? | |
| bool | IsIsotropic (double &l) const |
| Get an attribute of isotropism. More... | |
Functions of access to matrix elements. | |
| double | El (size_t i, size_t j) const |
| Get an element of the matrix. | |
| const double * | GetEl () const |
| Get a pointer to the first matrix element. | |
| const MbVector3D & | GetAxisX () const |
| Get the first row (the X-axis). | |
| const MbVector3D & | GetAxisY () const |
| Get the second row (the Y-axis). | |
| const MbVector3D & | GetAxisZ () const |
| Get the third row (the Z-axis). | |
| const MbCartPoint3D & | GetOrigin () const |
| Get the fourth row (the origin of coordinates) | |
| MbVector3D | GetColumn (size_t i) const |
| Get the i-th column vector of the matrix. | |
| MbVector3D | GetRow (size_t i) const |
| Get the i-th row-vector of the matrix. | |
| MbHomogeneous3D | GetFullColumn (size_t i) const |
| Get the i-th column vector of the matrix. | |
| MbHomogeneous3D | GetFullRow (size_t i) const |
| Get the i-th row-vector of the matrix. | |
| void | GetOffset (MbCartPoint3D &p) const |
| Get components of matrix translation. | |
Functions for matrix elements modification. | |
| void | SetEl (const double *_el) |
| Assign a value to matrix elements. More... | |
| GLdouble * | SetEl () |
| Get an array of matrix elements. More... | |
| void | El (size_t i, size_t j, double e) |
| Assign a value to the matrix element. More... | |
| void | AddEl (size_t i, size_t j, double e) |
| Add a number to the matrix element. More... | |
| void | MulEl (size_t i, size_t j, double e) |
| Multiply the matrix element by a number. More... | |
| MbVector3D & | SetAxisX () |
| Get the first row (the X-axis). | |
| MbVector3D & | SetAxisY () |
| Get the second row (the Y-axis). | |
| MbVector3D & | SetAxisZ () |
| Get the third row (the Z-axis). | |
| MbCartPoint3D & | SetOrigin () |
| Give the fourth row (the origin of coordinates) | |
| void | SetOriginZ (double or_z) |
| Set Z component of the origin. | |
| void | SetColumn (size_t i, const MbCartPoint3D &) |
| Set values in the i-th column of the matrix. | |
| void | SetColumn (size_t i, const MbVector3D &) |
| Set values in the i-th column of the matrix. | |
| void | SetColumn (size_t i, const MbHomogeneous3D &) |
| Set values in the i-th column of the matrix. | |
| void | SetRow (size_t i, const MbCartPoint3D &) |
| Set values in the i-th row of the matrix. | |
| void | SetRow (size_t i, const MbVector3D &) |
| Set values in the i-th row of the matrix. | |
| void | SetRow (size_t i, const MbHomogeneous3D &) |
| Set values in the i-th row of the matrix. | |
| void | SetOffset (const MbCartPoint3D &p) |
| Set components of matrix translation. | |
| void | SetFlag (bool bReflection, bool bAffine=false, bool bOrt=true) const |
| Set the flag of state. More... | |
Matrices multiplication. | |
| void | Multiply (const MbMatrix3D &b) |
| Multiply by a matrix: this = this * b;. | |
| void | Multiply (const MbMatrix3D &a, const MbMatrix3D &b) |
| Multiply matrices this = a * b. | |
Scaling functions. | |
| void | Scale (double sx, double sy, double sz) |
| Scale by X, Y and Z. More... | |
| void | Scale (double s) |
| Scale by X, Y and Z. | |
| void | ScaleX (double s) |
| Scale by X. | |
| void | ScaleY (double s) |
| Scale by Y. | |
| void | ScaleZ (double s) |
| Scale by Z. | |
| void | ScaleAxes (double s) |
| Scale by X, Y and Z without translation. | |
| double | GetScaleX () const |
| Get scaling coefficient by X. | |
| double | GetScaleY () const |
| Get scaling coefficient by Y. | |
| double | GetScaleZ () const |
| Get scaling coefficient by Z. | |
Functions of matrix transformations: translation, rotation, etc. | |
| void | Move (const MbVector3D &to) |
| Translate by a given vector. | |
| void | Move (double dx, double dy, double dz) |
| Translate by given increments. | |
| void | MoveZero () |
| Translate to null. | |
| MbMatrix3D & | RotateAbout (const MbVector3D &axisDir, double angle) |
| Rotate around an axis. More... | |
| MbMatrix3D & | Rotate (const MbAxis3D &axis, double angle) |
| Rotate around axis by angle. | |
| MbMatrix3D & | Rotate (int axis, double angle) |
| Rotate around an axis. More... | |
| void | TransformLength (double &len, int axis=1) const |
| Transform the length. More... | |
| void | TransformCoord2D (double &x, double &y) const |
| Transform coordinates. More... | |
| MbMatrix3D & | Transform (const MbMatrix3D &matr) |
| Transform according to the given matrix. | |
| void | Invert (size_t n) |
| Invert the axis. | |
| MbMatrix3D & | Symmetry (const MbCartPoint3D &origin, const MbVector3D &normal) |
| Set the matrix to symmetry transformation (reflection). More... | |
| MbMatrix3D & | Symmetry (const MbCartPoint3D &origin, const MbVector3D &vx, const MbVector3D &vy) |
| Set the matrix to symmetry transformation (reflection). More... | |
Calculation of the algebraic properties of a matrix. | |
| void | Adj () |
| Transpose a matrix. | |
| double | Delta (size_t line, size_t column, size_t dim) const |
| Calculate the algebraic adjunct. | |
| double | Det (size_t dim) const |
| Calculate the determinant of a matrix. | |
| MbMatrix3D & | Div (MbMatrix3D &) const |
| Calculate inverse matrix. More... | |
Overload of arithmetical and logical operations. | |
| MbMatrix3D | operator* (const MbMatrix3D &m) const |
| Multiply by a matrix: M = this * m. | |
| MbMatrix3D & | operator*= (const MbMatrix3D &m) |
| Multiply by a matrix: this = this * m. | |
| MbMatrix3D & | operator= (const MbMatrix3D &m) |
| Assign a value. | |
| void | operator+= (const MbMatrix3D &) |
| Add matrices. | |
| void | operator-= (const MbMatrix3D &) |
| Subtract a matrix from the matrix. | |
| void | operator*= (double factor) |
| Multiply the matrix by a number. | |
| void | operator/= (double factor) |
| Divide the matrix by a number. | |
| bool | operator== (const MbMatrix3D &) const |
| Compare with a matrix (tolerance - LENGTH_EPSILON). | |
| double & | operator() (size_t i, size_t j) |
| Access to a matrix element by a reference. | |
| const double & | operator() (size_t i, size_t j) const |
| The value of a matrix element. | |
Static Public Attributes | |
| static const MbMatrix3D | identity |
| Identity matrix, I = diag(1,1,1,1);. | |
The extended matrix of transformation in a three-dimensional space.
The extended matrix of transformation in a three-dimensional space.
The extended matrix has dimension (4, 4) and is a regular matrix bordered below by a translation vector and by the null column to the right. The transformation of point "p" by the matrix "M" has the form: r = p * M (the row of coordinates is multiplied by the matrix to the left).
The transformation matrix from a local coordinate system can be obtained as follows:
the first row must be filled with the corresponding components of the first vector of a locale system, the second row must be filled with the corresponding components of the second vector of a local system, the third row must be filled with the corresponding components of the third vector of a locale system, the last row of the matrix must be filled with the corresponding coordinates of a local system origin. The matrix of transformation consists of four blocks:
| R, P |
| V, S |
where R - is a rotation matrix, the tensor with dimension (3, 3), V - translation vector, tensor (0, 3), P - perspective vector, tensor (3, 0) (always is null) S - scalar of scale transformation (the unit). \ n To speed up the calculation the matrix has additional data - flag of state.
Use "Get..." methods to get data of matrix from the outside.
To modify data of a matrix from the outside use "Set..." methods which automatically reset the system flag to unspecified state.
|
inlineexplicit |
The constructor by two matrices.
Matrix is defined as the product of two initial matrices: C = (B * A).
| [in] | A,B | - Initial matrices. |
| MbMatrix3D& MbMatrix3D::Init | ( | const MbMatrix3D & | a, |
| const MbMatrix3D & | b | ||
| ) |
Initialize by the product of given matrices.
Initialize by the product of given matrices. this = b * a (!= a * b)!!!.
| [in] | a,b | - Initial matrices. |
|
inline |
Get an attribute of inequality to 1.0 of a scale component.
Get an attribute of inequality to zero of perspective vector.
| bool MbMatrix3D::IsIsotropic | ( | double & | l | ) | const |
Get an attribute of isotropism.
Checks whether the matrix is ??orthogonal with equal lengths of
X, Y and Z axes (circle remains a circle)
| [out] | l | - The length of the X, Y and Z axes orts. |
|
inline |
Assign a value to matrix elements.
Matrix elements are initialized by elements of initial array.
| [in] | _el | - Initial array. |
|
inline |
Get an array of matrix elements.
ONLY FOR OGL !!!
|
inline |
Assign a value to the matrix element.
Assign a value to the matrix element.
| [in] | i | - A row index. |
| [in] | j | - A column index. |
| [in] | e | - Initial value which to be assigned to an element of the matrix. |
|
inline |
Add a number to the matrix element.
Add a number to the matrix element.
| [in] | i | - A row index. |
| [in] | j | - A column index. |
| [in] | e | - Initial number which to be added to the matrix element. |
|
inline |
Multiply the matrix element by a number.
Multiply the matrix element by a number.
| [in] | i | - A row index. |
| [in] | j | - A column index. |
| [in] | e | - Initial number by which to multiply the matrix element. |
| void MbMatrix3D::SetFlag | ( | bool | bReflection, |
| bool | bAffine = false, |
||
| bool | bOrt = true |
||
| ) | const |
Set the flag of state.
Set the flag of state.
| [in] | bReflection | - Negativity flag of the rotation matrix determinant. |
| [in] | bAffine | - Affinity flag. |
| [in] | bOrt | - Orthogonality flag. |
| void MbMatrix3D::Scale | ( | double | sx, |
| double | sy, | ||
| double | sz | ||
| ) |
Scale by X, Y and Z.
Scale by X, Y and Z.
| [in] | sx,sy,sz | - Scaling coefficients for each axis. |
| MbMatrix3D& MbMatrix3D::RotateAbout | ( | const MbVector3D & | axisDir, |
| double | angle | ||
| ) |
Rotate around an axis.
Rotate around an axis which passes through the origin in the axisDir direction.
| [in] | axisDir | - A vector which defines the direction of rotation. |
| [in] | angle | - A rotation angle. |
| MbMatrix3D& MbMatrix3D::Rotate | ( | int | axis, |
| double | angle | ||
| ) |
Rotate around an axis.
Rotate around the X, Y, or Z axis.
| [in] | axis | - The number of axis, i.e. AXIS_0X, AXIS_0Y or AXIS_0Z. |
| [in] | angle | - A rotation angle. |
| void MbMatrix3D::TransformLength | ( | double & | len, |
| int | axis = 1 |
||
| ) | const |
Transform the length.
The length is transformed according to a matrix (*this).
| [in,out] | len | - A length. |
| [in] | axis | - An axis on which the length is measured. |
|
inline |
Transform coordinates.
Coordinates are transformed according to a matrix. Two coordinates are transformed (z=0).
| [in,out] | x,y | - Coordinates by x and y. |
| MbMatrix3D& MbMatrix3D::Symmetry | ( | const MbCartPoint3D & | origin, |
| const MbVector3D & | normal | ||
| ) |
Set the matrix to symmetry transformation (reflection).
The matrix of symmetry transformation is found relative to the plane which is defined by a point and normal.
| [in] | origin | - A point of plane. |
| [in] | normal | - The normal of a plane. |
| MbMatrix3D& MbMatrix3D::Symmetry | ( | const MbCartPoint3D & | origin, |
| const MbVector3D & | vx, | ||
| const MbVector3D & | vy | ||
| ) |
Set the matrix to symmetry transformation (reflection).
The matrix of symmetry transformation is found relative to the plane which is defined by a point and two vectors.
| [in] | origin | - A point of plane (an origin). |
| [in] | vx,vy | - Vectors which parallel for a plane. |
| MbMatrix3D& MbMatrix3D::Div | ( | MbMatrix3D & | ) | const |
Calculate inverse matrix.
| void MbMatrix3D::MouldCavityScale | ( | MbCartPoint3D & | fixedPoint, |
| double | deltaX, | ||
| double | deltaY, | ||
| double | deltaZ | ||
| ) |
Get the matrix for scale of a mold cavern.
Get the matrix for scale of a mold cavern.
| [in] | fixedPoint | - Fixed point. |
| [in] | deltaX,deltaY,deltaZ | - Relative increment of size in the direction of corresponding coordinate. |
| bool MbMatrix3D::SetRoundedValue | ( | bool | total, |
| double | eps | ||
| ) |
Round with eps tolerance.
Round with eps tolerance.
| [in] | total | - If true, round anyway. |
| [in] | eps | - A round-off tolerance. |