.. role:: blue :class: blue .. role:: bfit :class: bfit Extended Matrix in Two-Dimensional Space MbMatrix ================================================= .. _MbMatrix_Extended_Matrix_in_Two-Dimensional_Space_: .. kernel version: 118059 The :blue:`MbMatrix` class is declared in the *mb_matrix.h* file. In a two-dimensional space, the :blue:`MbMatrix` matrix describes a transformation from one coordinate system to another. The matrix has the size three by three. Let a local affine coordinate system be constructed in the chosen coordinate system with the origin at the point :bfit:`r` with coordinates *r*\ :sub:`1`, *r*\ :sub:`2` and with the basis vectors :bfit:`a` = [*a*\ :sub:`1` *a*\ :sub:`2`], :bfit:`b` = [*b*\ :sub:`1` *b*\ :sub:`2`]. The vectors :bfit:`a` and :bfit:`b` must not be collinear, but they may be non-orthogonal to each other and may have arbitrary lengths. The :blue:`MbMatrix` matrix of the coordinate transformation from the local system to the chosen coordinate system has the form: .. math:: M = \begin{bmatrix} a_{1} & a_{2} & 0 \\ b_{1} & b_{2} & 0 \\ r_{1} & r_{2} & 1 \\ \end{bmatrix}. To denote extended matrices in the two-dimensional space we will use uppercase Latin letters in bold italics, for example :bfit:`M`. Note that each basis vector :bfit:`a`, :bfit:`b` and the origin point :bfit:`r` of the local coordinate system correspond to their own row in the transformation matrix from the local system to the chosen coordinate system. The :blue:`MbMatrix` matrix is extended and works with homogeneous radius vectors and homogeneous vectors :ref:`MbHomogeneous ` in a two-dimensional space. When transforming a :ref:`MbCartPoint ` radius vector by the :blue:`MbMatrix` matrix, a third coordinate equal to one must be added to the point. Let a point with coordinates *x*\ :sub:`1`, *x*\ :sub:`2` in the local coordinate system have coordinates *p*\ :sub:`1`, *p*\ :sub:`2` in the chosen coordinate system, then with the extended :blue:`MbMatrix` matrix the coordinates are related by .. math:: \begin{bmatrix} p_{1} & p_{2} & 1 \\ \end{bmatrix} = \begin{bmatrix} x_{1} & x_{2} & 1 \\ \end{bmatrix} \cdot \begin{bmatrix} a_{1} & a_{2} & 0 \\ b_{1} & b_{2} & 0 \\ r_{1} & r_{2} & 1 \\ \end{bmatrix}. Note that a two-dimensional radius vector is multiplied by the extended :blue:`MbMatrix` matrix on the right. When transforming an :blue:`MbVector` vector by the :blue:`MbMatrix` matrix, a third component equal to zero must be added to the vector. Let a vector with components *y*\ :sub:`1`, *y*\ :sub:`2` in the local coordinate system have components *r*\ :sub:`1`, *r*\ :sub:`2` in the chosen coordinate system, then with the extended :blue:`MbMatrix` matrix the components are related by .. math:: \begin{bmatrix} r_{1} & r_{2} & 0 \\ \end{bmatrix} = \begin{bmatrix} y_{1} & y_{2} & 0 \\ \end{bmatrix} \cdot \begin{bmatrix} a_{1} & a_{2} & 0 \\ b_{1} & b_{2} & 0 \\ r_{1} & r_{2} & 1 \\ \end{bmatrix}. Note that a two-dimensional vector is multiplied by the extended :blue:`MbMatrix` matrix on the right.