# Synthesis of Four-Link Initial Kinematic Chains with Spherical Pairs for Spatial Mechanisms
## 2 Materials and Methods
\begin{split}& m_{i1}=sin\psi_{i}^{j}\cdot cos\varphi_{i}^{j}+ cos\theta_{i}^{j}\cdot cos\psi_{i}^{j}\cdot cos\varphi_{i}^{j}\\ & m_{i2}^{j}=-sin\psi_{i}^{j}\cdot sin\varphi_{i}^{j}+cos\theta_{i }^{j}\cdot cos\psi_{i}^{j}\cdot sin\varphi_{i}^{j}\\ & m_{i3}^{j}=-sin\theta_{i}^{j}\cdot cos\psi_{i}^{j}\end{split}  \tag{4}\]  
These represent the direction cosines of the local \(z\)-axis relative to the fixed axes:  
\[ \begin{split}& n_{i1}^{j}=sin\theta_{i}^{j}\cdot sin\varphi_{i}^ {j}\\ & n_{i2}^{j}=sin\theta_{i}^{j}\cdot cos\varphi_{i}^{j}\\ & n_{i3}^{j}=cos\varphi_{i}^{j}\end{split}  \tag{5}\]  
The matrix \(T_{j\circ}^{i}\) essentially transforms the orientation of solid \(Q_{1}\) or \(Q_{2}\) in a fixed coordinate system. Each solid's orientation is represented using the Euler angles (or rotation matrix) to map the local axes to the global (fixed) coordinate system [14]. The three rows of the matrix represent the direction cosines of the local axes relative to the global axes. This matrix is likely part of a kinematic analysis where the positions and orientations of two solids need to be related to a common coordinate system [15]. The task is then to use this matrix to calculate the positions of points on the solids, transforming them between the local and global frames. The matrices \(T_{j\circ}^{i}\) and their transposed versions represent the rotation matrices that transform the coordinate system of one solid to another. Let us break down each part of equations and matrices:  
\(T_{01}^{i}= \begin{bmatrix}T_{10}^{i}\end{bmatrix} ^{T}\) and \(T_{02}^{i}= \begin{bmatrix}T_{20}^{i}\end{bmatrix} ^{T}\) are the cross-products of these matrices used to compute relative orientations between the rigid bodies. These matrices represent the rotation transformation from the local coordinate frame of solid \(Q_{1}\) and \(Q_{2}\) to a fixed global coordinate frame at each position \(i\). Each of these matrices contains the direction cosines for the three local axes of the solids. In matrix form, we have the following:  
\[T_{01}^{i}= \begin{bmatrix}T_{10}^{i}\end{bmatrix} ^{T}= \begin{bmatrix}e_{i1}^{1 }&m_{i1}^{1}&n_{i1}^{1}\\ e_{i2}^{1}&m_{i2}^{1}&n_{i2}^{1}\\ e_{i3}^{1}&m_{i3}^{1}&n_{i3}^{1}\end{bmatrix}  \tag{6}\]\[T_{02}^{i}=\left[T_{20}^{i}\right]^{T}= \begin{bmatrix}e_{i1}^{2}&m_{i1}^{2}&n_{i1}^ {2}\\ e_{i2}^{2}&m_{i2}^{2}&n_{i2}^{2}\\ e_{i3}^{2}&m_{i3}^{2}&n_{i3}^{2}\end{bmatrix}  \tag{7}\]  
where the components \(e_{i1}\), \(m_{i1}\), \(n_{i1}\), etc., are the direction cosines of the respective axes relative to the global coordinate frame. The matrix \(T_{21}^{i}\) represents the transformation of the coordinate frame of \(Q_{2}\) relative to \(Q_{1}\). It is the result of multiplying the matrices \(T_{01}^{i}\) and \(T_{20}^{i}\). The components of the resulting matrix are  
\[T_{21}^{i}=\left[ \begin{array}{cccc}e_{i1}^{1}e_{i1}^{2}+e_{i2}^{1}m_{i1}^{2 }+e_{i3}^{1}n_{i1}^{2}&e_{i1}^{1}e_{i2}^{2}+e_{i2}^{1}m_{i2}^{2}+e_{i3}^{1}n_{i 2}^{2}&e_{i1}^{1}e_{i3}^{2}+e_{i2}^{1}m_{i3}^{2}+e_{i3}^{1}n_{i3}^{2}\\ n_{i1}^{1}e_{i1}^{2}+m_{i2}^{1}m_{i1}^{2}+m_{i3}^{1}n_{i1}^{2}&n_{i1}^{1}e_{i2}^ {2}+m_{i2}^{1}m_{i2}^{2}+m_{i3}^{1}n_{i2}^{2}&m_{i1}^{1}e_{i3}^{2}+m_{i2}^{1}m_ {i3}^{2}+m_{i3}^{1}n_{i3}^{2}\\ n_{i1}^{1}e_{i1}^{2}+n_{i2}^{1}m_{i1}^{2}+n_{i3}^{1}n_{i1}^{2}&n_{i1}^{1}e_{i2}^ {2}+n_{i2}^{1}m_{i2}^{2}+n_{i3}^{1}n_{i2}^{2}&n_{i1}^{1}e_{i2}^{2}+n_{i2}^{1}m_ {i3}^{2}+n_{i3}^{1}n_{i3}^{2}\end{array} \right] \tag{8}\]  
This matrix is formed by using the dot products of the rows of \(T_{01}^{i}\) with the columns of \(T_{02}^{i}\). The result is a \(3\times 3\) matrix that represents the relative orientation between \(Q_{2}\) and \(Q_{1}\). Similarly, the matrix \(T_{12}^{i}\) represents the transformation of the coordinate frame of \(Q_{1}\) relative to \(Q_{2}\) and is the result of multiplying \(T_{02}^{i}\) and \(T_{10}^{i}\). The components of \(T_{12}^{i}\) are  
\[T_{12}^{i}=