# Measurement of High Numerical Aperture Cylindrical Surface with Iterative Stitching Algorithm
## 2 Principles
### Iterative Algorithm for the Cylindrical Sub-Aperture  
The surface profile of the high high-numerical-aperture (NA) cylindrical lens obtained by stitching the collected phase data with the approach described in Section 2.2 may not immediately have a seamless result. One of the reasons for this is that the restriction by the first order of the Taylor expansion in Equation (1). Besides, the cylindrical lens is not a closed surface, and unlike the cylindrical shaft, it lacks some constraints in the circumference direction. To produce better stitching, an iterative algorithm that enables us to make constant adjustments to the position of each sub-aperture is preferred. This can be realized by applying the least square method for finding the position errors \(R_{i}\) according to Equation (8). Then, the position errors \(R_{i}\) are substituted into the Rigid Body Transformation to correct the mismatch of the sub-apertures. After correcting the sub-apertures, the new corrected position errors \(R_{i}\) are calculated. The loop with the iterations enables us to get more reliable results. The specific steps of the algorithm are as follows:  
Step 1. Assume that the measuring aperture is arranged in space according to the preset coordinates. Then, the initial values of the cumulative errors have to be set as \(Err_{i}^{0}=\left(\Delta z_{i}^{0},\ \Delta y_{i}^{0},\ \Delta\gamma_{i}^{0},\ \Delta\beta_{i}^{0} \right)=(0,0,0,0)\). The initial phase values \(\varphi_{i}^{0}=\varphi_{i}\) are the phase data measured by the interferometer. The superscript denotes a current iteration number, and the subscript \(i\) denotes the number of sub-apertures.  
Step 2. Substitute \(\theta\), \(X\), and \(\varphi_{i}^{(t)}\) into Equation (8) to obtain the least squares solution \(\left(\Delta z_{i}^{(l+1)},\ \Delta y_{i}^{(l+1)},\ \Delta\gamma_{i}^{(l+1)},\ \Delta\beta_{i}^{(l+1)} \right)=R_{i}^{(l+1)}\), which is the error vector in the cylindrical coordination system. The superscript \(t\) denotes the iteration number, \(t=0,1,2\ldots\).  
Step 3. Find a new corrected \(Err_{i}^{(l+1)}\) according to the equation:  
\[Err_{i}^{(l+1)}=Err_{i}^{(l)}+R_{i}^{(l+1)} \tag{10}\]  
Step 4. Change \(\varphi_{i}^{(t)}\) into Cartesian coordinate sand substitute it into the transformation matrix, which includes the coefficient \(R_{i}^{t}\). After that, change the coordinate back into the cylindrical coordination:  
\[y_{i}^{(t)}=\varphi_{i}^{(t)}\times\cos(\theta_{i}^{(t)});z_{i}^{(t)}=\varphi _{i}^{(t)}\times sin\left(\theta_{i}^{(t)}\right);x_{i}^{(t)}=X_{i}^{(t+1)} \tag{11}\]  
\[\left[\begin{array}{ccccccccc}y_{i}^{(t+1)}&z_{i}^{(t+1)}&x_{i}^{(t+1)}&I \end{array}\right]=\left[\begin{array}{ccccccccc}y_{i}^{(t)}&z_{i}^{(t)}&x_{ i}^{(t)}&I\end{array}\right]*T_{1}T_{2}T_{3}T_{4} \tag{12}\]  
where \(T_{1}\), \(T_{2}\), \(T_{3}\), and \(T_{4}\) are the transformation matrixes taking \(R_{i}^{(l+1)}\) into account, and \(I\) is the unity matrix.  
\[\varphi_{i}^{(t+1)}=\sqrt{{y_{i}^{(t+1)}}^{2}+{z_{i}^{(t+1)}}^{2}};\ X_{i}^{(t +1)}=x_{i}^{(t+1)};\ \theta_{i}^{(t+1)}=\arctan(\frac{z^{(t+1)}}{y^{(t+1)}}) \tag{13}\]Step 5. Repeat the steps described above until \(R_{i}^{(t+1)}\) is less than the threshold or reaches the iteration number (usually \(10^{-3}\) um or 3 iterations according to practical experience). Then we can obtain a more reliable result for \(\varphi_{i}^{(t+1)}\).