## 2 Principle
### Ray Tracing Model  
In the process of the light from the LCD screen entering the camera through the pinhole after being reflected from the test surface, the coordinates of the reflected points on the unit under test (UUT) in the PMD system can be obtained by using the iterative method in a ray tracing model [24; 25; 26], as shown in Figure 2. Firstly, we use the coordinate of a certain screen pixel \(S_{i}(x_{i},y_{i},z_{i})\) and the direction cosine \(S_{i}(K_{i},L_{i},M_{i})\) of the light emitted from this pixel as the initial data, where \(K,L,\) and \(M\) are defined as directional cosines of this ray around the \(x,y,\) and \(z\), respectively. Then, the coordinate of intersection point \(a_{1}(x_{1},y_{1},z_{1})\)  
Figure 1: Schematic of PMD test system.  
of the light on the tangent plane \(x^{\prime}oy^{\prime}\) of the component coordinate system is calculated in Equation (5):  
\[\left\{\begin{array}{l}\mathrm{D}=\frac{d}{M_{i}}\\ x_{1}=x_{i}+DK_{i}\\ y_{1}=y_{i}+DL_{i}\\ z_{1}=z_{i}+d\end{array}\right. \tag{5}\]  
where \(d\) is the distance in the \(z\)-direction between the tangent plane and \(S_{i}(x_{i},y_{i},z_{i})\), \(D=|S_{i}a_{1}|\) denotes the distance from the starting point of the ray \(S_{i}(x_{i},y_{i},z_{i})\) to \(a_{1}(x_{1},y_{1},z_{1})\), and take the point as the first approximate solution of the intersection point to be solved. Consequently, a line starting from the point of \(a_{1}\) which is parallel to the optical axis is intersected with the surface of the component at the point of \(a_{2}\), and the tangent plane of the element formed through point \(a_{2}\) is expressed as Equation (6). The \(x,y\) coordinates of \(a_{2}\) are the same as those of \(a_{1}\), and the z coordinate is calculated by \(W(x_{1},y_{1},z)=0\).  
\[G_{x}(x-x_{1})+G_{y}(y-y_{1})+G_{z}(z-z_{2})=0 \tag{6}\]  
where, \(G_{x}\), \(G_{y}\) and \(G_{z}\) are the normal components at point \(a_{2}\) in the \(x\), \(y\), and \(z\) directions, respectively.  
\[\left\{\begin{array}{l}G_{x}=-\frac{z_{x}}{\sqrt{1+(z_{x})^{2}+(z_{y})^{2}}} \end{array}\right.\left\{\begin{array}{l}z_{x}=\partial W/\partial x\\ z_{y}=\partial W/\partial y\end{array}\right. \tag{7}\] \[G_{y}=-\frac{z_{y}}{\sqrt{1+(z_{x})^{2}+(z_{y})^{2}}}\] \[G_{z}=\frac{1}{\sqrt{1+(z_{x})^{2}+(z_{y})^{2}}}\]  
Next, the tangent plane passing through the point of \(a_{2}\) intersects with the ray at the point of \(a_{3}\), which is used as a new approximate solution. Let \(\Delta a=|a_{1}a_{3}|\), which is the distance between them, so we can obtain the following relationship.  
\[\left\{\begin{array}{l}x_{3}-x_{1}=\Delta aK_{i}\\ y_{3}-y_{1}=\Delta aL_{i}\\ z_{3}-z_{1}=\Delta aM_{i}\\ z_{3}-z_{2}=z_{1}+\Delta aM_{i}-z_{2}\end{array}\right. \tag{8}\]  
Equation (8) is substituted into Equation (6) to obtain the following Equation (9), then we can obtain the \(\Delta a\) at last.  
\[G_{x}(\Delta aK_{i})+G_{y}(\Delta aL_{i})+G_{z}(z_{1}+\Delta aM_{i}-z_{2})=0 \tag{9}\]  
Figure 2: (**a**) Ray tracing; (**b**) The difference between the sampling point coordinates of regular rectangular grids and the coordinates of sampling points obtained by ray tracing.  
\[\Delta a=\frac{G_{z}(z_{2}-z_{1})}{G_{x}K_{i}+G_{y}L_{i}+G_{z}M_{i}} \tag{10}\]  
The above steps are repeated until \(\Delta a\) is smaller than a pre-setting threshold, and \(a_{3}\) will be very close to the coordinate of the reflected point \(M(x_{m},y_{m},z_{m})\) of the surface. Therefore, \(a_{3}\) can be treated as the coordinate of reflection point on UUT.  
From the previous derivation, we can obtain the actual coordinates of the sampled points exactly by ray tracing, and there is a difference between the sampling point coordinates of regular rectangular grids and the coordinates of sampling points obtained by ray tracing, as shown in Figure 2b. The ray-traced sampling points are used in the integration process as \((x,y)\) in Equation (4) in both simulation and experiment.