.. role:: blue :class: blue Extended Matrix in Three-Dimensional Space MbMatrix3D ======================================================== .. _MbMatrix3D_Extended_Matrix_in_Three-Dimensional_Space_: .. kernel version: 118059 The :blue:`MbMatrix3D` class is declared in the *mb_matrix3d.h* file. In three-dimensional space, the :blue:`MbMatrix3D` matrix describes a transformation from one coordinate system to another. The matrix has the size four by four. Let a local affine coordinate system be constructed in the chosen coordinate system with the origin at the point **r** with coordinates *r*\ :sub:`1`, *r*\ :sub:`2`, *r*\ :sub:`3` and with basis vectors **a** = \[*a*\ :sub:`1` *a*\ :sub:`2` *a*\ :sub:`3`\], **b** = \[*b*\ :sub:`1` *b*\ :sub:`2` *b*\ :sub:`3`\], **c** = \[*c*\ :sub:`1` *c*\ :sub:`2` *c*\ :sub:`3`\]. The vectors **a**, **b**, **c** must be linearly independent, but they may be non-orthogonal to each other and may have arbitrary length. The :blue:`MbMatrix3D` matrix of transformation of coordinates from the local system to the chosen coordinate system has the form: .. math:: :nowrap: \[ \mathbf{M} = \begin{bmatrix} a_{1} & a_{2} & a_{3} & 0 \\ b_{1} & b_{2} & b_{3} & 0 \\ c_{1} & c_{2} & c_{3} & 0 \\ r_{1} & r_{2} & r_{3} & 1 \\ \end{bmatrix}. \] To denote extended matrices in three-dimensional space, we will use uppercase Latin letters in boldface, for example **M**. Note that each basis vector **a**, **b**, **c** and the origin point **r** of the local coordinate system corresponds to its own row in the matrix of transformation from the local system to the chosen coordinate system. The :blue:`MbMatrix3D` matrix is an extended matrix and works with homogeneous radius vectors and homogeneous vectors :blue:`MbHomogeneous3D` in three-dimensional space. When transforming a :ref:`MbCartPoint3D ` radius vector by the :blue:`MbMatrix3D` matrix, a fourth coordinate equal to one must be added to the point. Let a point with coordinates *x*\ :sub:`1`, *x*\ :sub:`2`, *x*\ :sub:`3` in the local coordinate system have coordinates *p*\ :sub:`1`, *p*\ :sub:`2`, *p*\ :sub:`3` in the chosen coordinate system. Then, by means of the extended :blue:`MbMatrix3D` matrix, the coordinates are related by .. math:: :nowrap: \[ \begin{bmatrix} p_{1} & p_{2} & p_{3} & 1 \end{bmatrix} = \begin{bmatrix} x_{1} & x_{2} & x_{3} & 1 \end{bmatrix} \cdot \begin{bmatrix} a_{1} & a_{2} & a_{3} & 0 \\ b_{1} & b_{2} & b_{3} & 0 \\ c_{1} & c_{2} & c_{3} & 0 \\ r_{1} & r_{2} & r_{3} & 1 \\ \end{bmatrix}. \] Note that a three-dimensional radius vector is multiplied by the extended :blue:`MbMatrix3D` matrix on the right. When transforming an :ref:`MbVector3D ` vector by the :blue:`MbMatrix3D` matrix, a fourth component equal to zero must be added to the vector. Let a vector with components *y*\ :sub:`1`, *y*\ :sub:`2`, *y*\ :sub:`3` in the local coordinate system have components *v*\ :sub:`1`, *v*\ :sub:`2`, *v*\ :sub:`3` in the chosen coordinate system. Then, by means of the extended :blue:`MbMatrix3D` matrix, the components are related by .. math:: :nowrap: \[ \begin{bmatrix} v_{1} & v_{2} & v_{3} & 0 \end{bmatrix} = \begin{bmatrix} y_{1} & y_{2} & y_{3} & 0 \end{bmatrix} \cdot \begin{bmatrix} a_{1} & a_{2} & a_{3} & 0 \\ b_{1} & b_{2} & b_{3} & 0 \\ c_{1} & c_{2} & c_{3} & 0 \\ r_{1} & r_{2} & r_{3} & 1 \\ \end{bmatrix}. \] Note that a three-dimensional vector is multiplied by the extended :blue:`MbMatrix3D` matrix on the right.