|
C3D Toolkit
Kernel - 118052, Vision - 2.14.3.1813
|
The extended matrix of transformation in a two-dimensional space. More...
#include <mb_matrix.h>
Collaboration diagram for MbMatrix:Public Member Functions | |
| MbMatrix () | |
| Default constructor. | |
| MbMatrix (const MbMatrix &init) | |
| Copy constructor. | |
| MbMatrix (const MbPlacement &place) | |
| The constructor by placement. | |
| MbMatrix (const MbCartPoint &pnt, const MbDirection &dir) | |
| The constructor by a point and a normalized vector. More... | |
| MbMatrix (const MbCartPoint &pc, double sx, double sy) | |
| The constructor of scaling matrix by x and y. More... | |
| MbMatrix (const MbCartPoint &pc, double angle) | |
| The constructor of rotation matrix. More... | |
| ~MbMatrix () | |
| Destructor. | |
| void | GetProperties (MbProperties &properties) |
| Get properties of the object. | |
| void | SetProperties (const MbProperties &properties) |
| Set properties of the object. | |
Initialization functions. | |
| MbMatrix & | Init () |
| Initialize a matrix as unit one. | |
| MbMatrix & | Init (const MbCartPoint &pnt, const MbDirection &dir) |
| Initialize a matrix by a point and normalized vector. More... | |
| MbMatrix & | Init (const MbCartPoint &pc, double sx, double sy) |
| Initialize scaling matrix by x and y. More... | |
| MbMatrix & | Init (const MbCartPoint &pc, double angle) |
| Initialize a rotation matrix. More... | |
| MbMatrix & | Set (const MbPlacement &place) |
| Initialize a matrix according to a placement. More... | |
| MbMatrix & | SetZero () |
| Set a zero matrix. | |
Functions for check of matrices properties. | |
| bool | IsInvert () const |
| Get an attribute of negativity of the determinant of a rotation matrix. | |
| bool | IsInvertEps (double eps=EXTENT_EPSILON) 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=LENGTH_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 | 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 MbMatrix &, double accuracy) const |
| Determine whether an object is equal? | |
| 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... | |
| bool | CanTransformGabarit () const |
| Is it possible to transform a bounding box without distortion? | |
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 MbVector & | GetAxisX () const |
| Get the first row (the X-axis). | |
| const MbVector & | GetAxisY () const |
| Get the second row (the Y-axis). | |
| const MbCartPoint & | GetOrigin () const |
| Get the third row (the origin of coordinates) | |
| MbVector | GetColumn (size_t i) const |
| Get the i-th column vector of the matrix. | |
| MbVector | GetRow (size_t i) const |
| Get the i-th row-vector of the matrix. | |
| MbHomogeneous | GetFullColumn (size_t i) const |
| Get the i-th column vector of the matrix. | |
| MbHomogeneous | GetFullRow (size_t i) const |
| Get the i-th row-vector of the matrix. | |
Functions for matrix elements modification. | |
| 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... | |
| void | SetColumn (size_t icol, const MbCartPoint &column) |
| Assign point coordinates values to column elements. More... | |
| void | SetColumn (size_t icol, const MbVector &column) |
| Assign vector components values to column elements. More... | |
| void | SetColumn (size_t icol, const MbHomogeneous &column) |
| Assign coordinates of the uniform point to column elements. More... | |
| void | SetRow (size_t irow, const MbVector &row) |
| Assign vector components values to row elements. More... | |
| void | SetRow (size_t irow, const MbCartPoint &row) |
| Assign point coordinates values to row elements. More... | |
| void | SetRow (size_t irow, const MbHomogeneous &row) |
| Assign coordinates of the uniform point to row elements. More... | |
| void | SetOrigin (const MbCartPoint &p) |
| Set components of matrix translation. | |
Matrices multiplication. | |
| MbMatrix & | PreMultiply (const MbMatrix &) |
| Multiply a matrix on the left. | |
| MbMatrix & | PostMultiply (const MbMatrix &) |
| Multiply a matrix on the right. | |
Scaling functions. | |
| MbMatrix & | Scale (double s) |
| Scale by X and Y. | |
| void | ScaleX (double s) |
| Scale by X. | |
| void | ScaleY (double s) |
| Scale by Y. | |
| double | GetScaleX () const |
| Get scaling coefficient by X. | |
| double | GetScaleY () const |
| Get scaling coefficient by Y. | |
| bool | IsDifferentScale () const |
| Check differences of scaling coefficients (X and Y). | |
Functions of matrix transformations: translation, rotation, etc. | |
| void | Shift (double shift) |
| Shift by X and Y. | |
| void | ShiftX (double shift) |
| Shift by X. | |
| void | ShiftY (double shift) |
| Shift by Y. | |
| MbMatrix & | Move (const MbVector &v) |
| Translate by the vector (multiply by translation matrix on the right). | |
| MbMatrix & | Move (double dx, double dy) |
| Translate by given increments. | |
| MbMatrix & | Rotate (double angle) |
| Rotate by an angle. More... | |
| MbMatrix & | Rotate (const MbDirection &) |
| Rotate according to the direction vector. More... | |
| MbMatrix & | Rotate (const MbCartPoint &, const MbDirection &angle) |
| Rotate at angle around a point. More... | |
| void | TransformCoord (double x, double y, double &xn, double &yn) const |
| Transform coordinates. More... | |
| void | TransformScalarX (double &len) const |
| Transform the length in the direction of 0X. More... | |
| MbMatrix & | Symmetry (const MbCartPoint &origin, const MbVector &normal) |
| Set the matrix to symmetry transformation (reflection). More... | |
| MbMatrix & | Symmetry (const MbCartPoint &origin, const MbDirection &direction) |
| Find a matrix for transformation of symmetry relative to a line given by a point and direction. | |
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. | |
| void | Div (MbMatrix &, double eps=DOUBLE_EPSILON) const |
| Calculate inverse matrix. | |
| double | NormMax () const |
| Maximal element of the matrix in absolute value. | |
Overload of arithmetical and logical operations. | |
| MbMatrix | operator* (const MbMatrix &) const |
| Multiply by the matrix on the right. | |
| MbMatrix & | operator*= (const MbMatrix &m) |
| Multiply by the matrix on the right. | |
| MbMatrix & | operator= (const MbMatrix &m) |
| Assign a value. | |
| bool | operator== (const MbMatrix &) 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 MbMatrix | identity |
| Identity matrix, I = diag(1,1,1);. | |
Protected Attributes | |
| double | el [MATRIX_DIM_2D][MATRIX_DIM_2D] |
| Elements of matrix. | |
Friends | |
| void | MulMatrix (const MbMatrix &, const MbMatrix &, MbMatrix &) |
| Multiply matrices. More... | |
The extended matrix of transformation in a two-dimensional space.
The extended matrix of transformation in a two-dimensional space.
The extended matrix has dimension (3, 3) 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 local system, the second row must be filled with the corresponding components of the second vector of a local 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 (2, 2), V - translation vector, tensor (0, 2), P - perspective vector, the tensor (2, 0) (always null), S - scalar of scale transformation (the unit). \ n
|
inline |
The constructor by a point and a normalized vector.
The constructor by a point and a normalized vector
| [in] | pnt | - A point. Sets translation relative to zero. |
| [in] | dir | - Unit vector. Sets a rotation. |
|
inline |
The constructor of scaling matrix by x and y.
The constructor of scaling matrix by x and y.
| [in] | pnt | - A point. Sets translation relative to zero. |
| [in] | sx,sy | - Scaling coefficients by x and y, respectively. |
|
inline |
The constructor of rotation matrix.
The constructor of rotation matrix around the point "pc" on the angle "angle".
| [in] | pc | - A point. |
| [in] | angle | - A rotation angle. |
|
inline |
Initialize a matrix by a point and normalized vector.
Initialize a matrix by a point and normalized vector.
| [in] | pnt | - A point. Sets translation relative to zero. |
| [in] | dir | - Unit vector. Sets a rotation. |
| MbMatrix& MbMatrix::Init | ( | const MbCartPoint & | pc, |
| double | sx, | ||
| double | sy | ||
| ) |
Initialize scaling matrix by x and y.
Initialize scaling matrix by x and y.
| [in] | pnt | - A point. Sets translation relative to zero. |
| [in] | sx,sy | - Scaling coefficients by the x and y, respectively. |
| MbMatrix& MbMatrix::Init | ( | const MbCartPoint & | pc, |
| double | angle | ||
| ) |
Initialize a rotation matrix.
Initialize a rotation matrix around the point "pc" on the angle "angle".
| [in] | pc | - A point. |
| [in] | angle | - A rotation angle. |
| MbMatrix& MbMatrix::Set | ( | const MbPlacement & | place | ) |
Initialize a matrix according to a placement.
Initialize a matrix according to a placement.
| [in] | place | - The initial placement. |
|
inline |
Get an attribute of inequality to 1.0 of a scale component.
Get an attribute of inequality to zero of perspective vector.
| bool MbMatrix::IsIsotropic | ( | double & | l | ) | const |
Get an attribute of isotropism.
Checks whether the matrix is orthogonal with equal lengths of
X and Y axes (circle remains a circle).
| [out] | l | - The length of the X and Y axes orts. |
|
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 MbMatrix::SetColumn | ( | size_t | icol, |
| const MbCartPoint & | column | ||
| ) |
Assign point coordinates values to column elements.
Assign point coordinates values to column elements.
| [in] | icol | - A column index. |
| [in] | column | - The initial point. |
Assign vector components values to column elements.
Assign vector components values to column elements.
| [in] | icol | - A column index. |
| [in] | column | - The initial vector. |
| void MbMatrix::SetColumn | ( | size_t | icol, |
| const MbHomogeneous & | column | ||
| ) |
Assign coordinates of the uniform point to column elements.
Assign coordinates of the uniform point to column elements.
| [in] | icol | - A column index. |
| [in] | column | - The initial point. |
Assign vector components values to row elements.
Assign vector components values to row elements.
| [in] | irow | - A column index. |
| [in] | row | - The initial vector. |
| void MbMatrix::SetRow | ( | size_t | irow, |
| const MbCartPoint & | row | ||
| ) |
Assign point coordinates values to row elements.
Assign point coordinates values to row elements.
| [in] | irow | - A column index. |
| [in] | row | - The initial point. |
| void MbMatrix::SetRow | ( | size_t | irow, |
| const MbHomogeneous & | row | ||
| ) |
Assign coordinates of the uniform point to row elements.
Assign coordinates of the uniform point to row elements.
| [in] | irow | - A column index. |
| [in] | row | - The initial point. |
| MbMatrix& MbMatrix::Rotate | ( | double | angle | ) |
Rotate by an angle.
Rotation is around the axis Z.
| [in] | angle | - A rotation angle. |
| MbMatrix& MbMatrix::Rotate | ( | const MbDirection & | ) |
Rotate according to the direction vector.
Rotation is around the Z axis, because matrix is two-dimensional. A direction vector defines a rotation angle.
| [in] | - | A direction vector. |
| MbMatrix& MbMatrix::Rotate | ( | const MbCartPoint & | , |
| const MbDirection & | angle | ||
| ) |
Rotate at angle around a point.
Rotate at angle around a point.
| [in] | - | A point. |
| [in] | angle | - A direction vector which defines a rotation angle |
|
inline |
Transform coordinates.
Coordinates are transformed according to a matrix.
| [in] | x,y | - Old coordinates by x and y. |
| [in] | xn,yn | - Transformed coordinates. |
|
inline |
Transform the length in the direction of 0X.
The length is transformed according to a matrix. If the matrix has a different scales for the X and Y, then the scale by Y is ignored.
| [in,out] | len | - The length in the direction of 0X. |
| MbMatrix& MbMatrix::Symmetry | ( | const MbCartPoint & | origin, |
| const MbVector & | normal | ||
| ) |
Set the matrix to symmetry transformation (reflection).
The matrix of symmetry transformation is found relative to a line which is defined by a point and the normal.
| [in] | origin | - A point of a line. |
| [in] | normal | - The normal of a line. |
Multiply matrices.
Multiply m1 matrix by m2 matrix (instead of res = m1 * m2).
| [in] | m1,m2 | - Initial matrices. |
| [out] | res | - The required matrix. |