## 2 Surface Shape Measurement Principle
### Detection Principle
#### 2.2.2 Overall Design of the Detection System
The distance \(S_{i}\) between the point \((x_{i},y_{i},z_{i})\) and the straight line can be expressed as  
\[S_{i}=\sqrt{\frac{\frac{1}{m^{2}}\left(\frac{\frac{z_{1}^{2}-z_{0}}{\frac{1}{m }-z_{0}}-\frac{p}{m}}+p\right)^{2}+\left(\frac{\frac{z_{1}^{2}-z_{0}}{\frac{1} {m}-z_{0}}-\frac{p}{m}}\right)^{2}+1}{m^{2}+n^{2}+p^{2}}} \tag{9}\]  
Therefore, the radius of the cylinder \(R\) is known as  
\[\left\{ \begin{array}{l}S_{1}=S_{2}\\ S_{1}=S_{3}\\ m^{2}+n^{2}+p^{2}=1\end{array} \right. \tag{10}\]  
Arbitrary multiples of \(m\), \(n\), and \(p\) have no influence on the equation, and the formula \(m^{2}+n^{2}+p^{2}=1\) ensures the uniqueness of the solution to the equation. Solve Equation (10) and determine the position of the spatial axis. A point on its axis is measured using the instrumental method, and the direction vector of its axis is calculated to obtain the mathematical expression and spatial position of its axis. The point on the given axis is \((x_{0},y_{0},z_{0})\), the direction vector is \((m,n,p)\), and the axis equation is  
\[\frac{x-x_{0}}{m}=\frac{y-y_{0}}{n}=\frac{z-z_{0}}{p} \tag{11}\]  
Then, the surface data of the shaft are obtained by the line laser sensor and the included angle \(\varepsilon\) between the line laser displacement sensor and the X-O-Z plane. The conversion relationship between the detected value of the line laser sensor and the world coordinate system is as follows. \[ \begin{bmatrix}x\\ y\\ z\end{bmatrix} = \begin{bmatrix}\cos\alpha&0&0\\ 0&\sin\alpha&0\\ 0&0&1\end{bmatrix}\begin{bmatrix}x_{A}\\ x_{A}\\ z_{A}\end{bmatrix}  \tag{12}\]  
Among them, \(x_{A},z_{A}\) are detection values in the sensor coordinate system. In order to facilitate analysis and calculation based on coordinate transformation, the surface data of the workpiece are converted into the surface data of the axis on the axis, and the spatial position, translation, and rotation axis of the axis are known to make it coincide with the \(X\) axis. Because the axis is translated to coincide with the origin in advance, rotation will not affect the surface data of the circular axis. Move point \(C_{t}\) to the origin \(O\) (0, 0, 0) of the world coordinate system in Figure 5, and the movement matrix is  
\[\mathbf{T}= \begin{bmatrix}1&0&0&-x_{0}\\ 0&1&0&-y_{0}\\ 0&0&1&-z_{0}\\ 0&0&0&1\end{bmatrix}  \tag{13}\]  
Then, rotate the straight line clockwise around the \(Z\)-axis rotation direction. The size of the rotation angle \(\beta\) and the rotation equation \(\mathbf{T}_{1}\) are as follows. \[\beta=\arctan\frac{n}{m} \tag{14}\]  
\[\mathbf{T}_{1}= \begin{bmatrix}\cos(-\beta)&-\sin(-\beta)&0&0\\ \sin(-\beta)&\cos(-\beta)&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix}  \tag{15}\]  
The rotation angle, angle size \(\gamma\), and rotation equation \(\mathbf{T}_{2}\) around the \(Y\)-axis are as follows:  
\[\gamma=\arctan\frac{p}{\sqrt{m^{2}+n^{2}}} \tag{16}\]  
\[\mathbf{T}_{2}= \begin{bmatrix}\cos\gamma&0&\sin\gamma&0\\ 0&1&0&0\\ -\sin\gamma&0&\cos\gamma&0\\ 0&0&0&1\end{bmatrix}  \tag{17}\]  
Figure 5: Translation and rotation of spatial coordinate system. The conversion formula for converting the detected data into data with the axis on the \(X\)-axis is  
\[ \begin{bmatrix}x^{\prime}\\ y^{\prime}\\ z^{\prime}\\ 1\end{bmatrix} =\mathbf{TT}_{1}\mathbf{T}_{2} \begin{bmatrix}x\\ y\\ z\\ 1\end{bmatrix}  \tag{18}\]  
In the establishment of the surface measurement method, an important index is the determination of angle \(\alpha\). Theoretically, angle \(\alpha\) can be set at will, and a better angle needs to be determined in the actual experiment. Assuming that the amount of effective data obtained at that time of \(\alpha=0\) is 0.8, when the dip angle reaches \(45^{\circ}\), the effective data can basically be regarded as 1. But at the same time, the maximum data length that can be measured will be reduced, and at \(45^{\circ}\), there are only 0.707 detection lengths. The weights of data accuracy and data amount are set to 7 and 3, respectively, and then an evaluation model is established as  
\[