# Fast 3D Analytical Affine Transformation for Polygon-Based Computer-Generated Holograms
## 3 Theory  
The aim of the polygon-based method is the calculation of the polygon field in the plane of the hologram. However, we cannot obtain the polygon field or its spectrum directly by using standard diffraction theory, which is valid only between parallel planes. One of the conventional approaches to solve this problem is to map the desired light field or its spectrum using affine relations. The traditional affine transformation method is based on procedures such as rotation and translation to establish the relationship between the input and output coordinates, with the output represented by a set of known inputs and affine relations. Hence, the essence of affine transformation method is a mapping method, and the core problem of affine transformation is to find the affine matrix. In our proposed theory, we will find the affine matrix algebraically in a universal way. In the traditional 3D affine transformation algorithm, there is a global coordinate system \(\left(x,y,z\right)\) as the output coordinate system, as shown in Figure 3. The hologram plane \(\left(x,y\right)\) is located in \(z=0\), and the tilted triangle \(\Pi\) with vertexes \(\left(x_{1},y_{1},z_{1}\right)\), \(\left(x_{2},y_{2},z_{2}\right)\) and \(\left(x_{3},y_{3},z_{3}\right)\) is located in the global coordinate system. Figure 2: Coordinate systems of the traditional polygon-based method: source coordinate system \(\left(x_{s},y_{s},z_{s}\right)\), parallel local coordinate system \(\left(x_{p},y_{p},z_{p}\right)\) and hologram plane \(\left(x,y\right)\). Adapted from [PERSON] et al. [8]. We now define the affine coordinates \((s,t,p)\) as our input coordinates, as shown in Figure 4. A primitive triangle \(\Delta\) with vertexes \((s_{1},t_{1},p_{1})\), \((s_{2},t_{2},p_{2})\) and \((s_{3},t_{3},p_{3})\) is in the affine coordinate system, and the analytical expression of the primitive triangle spectrum is obtained by using two-dimensional Fourier transform for \(p=0\). The spectrum of the tilted triangle is finally obtained from the affine relationship between the primitive triangle \(\Delta\) and the tilted triangle \(\Pi\) with the analytical expression of the primitive triangle spectrum derived from the Fourier transform. Through affine transformation \(r_{g}^{\rightarrow}=Rr_{a}^{\rightarrow}+\overset{\rightarrow}{C}\), we can map affine coordinates \((s,t,p)\) into global (output) coordinates \((x,y,z)\), where \(r_{g}^{\rightarrow}=(x,y,z)^{t}\) is the coordinate vector of tilted triangle \(\Pi\) in the global coordinate system, \(r_{a}^{\rightarrow}=(s,t,p)^{t}\) is the coordinate vector of primitive triangle \(\Delta\) in the affine coordinates and the superscript \(t\) denotes the transpose operation. \(R\) is a 3 \(\times\) 3 matrix and \(\overset{\rightarrow}{C}\) is a 3 \(\times\) 1 vector. We let \((s_{1},t_{1},p_{1})=(0,0,0)\), \((s_{2},t_{2},p_{2})=(1,0,0)\) and \((s_{3},t_{3},p_{3})=(0,1,0)\). Therefore, we can write in terms of matrix multiplication as shown in Equation (6), where \(T\) is the affine transformation matrix and \(G\) and \(A\) represent matrices consisting of vertexes of tilted triangle \(\Pi\) and primitive triangle  
Figure 3: Tilted triangle \(\Pi\) in global coordinate system \((x,y,z)\) and hologram plane \((z=0)\). \(\Delta\), respectively. By calculating the twelve parameters of affine matrix \(T\), we can uniquely determine the 3D affine transformation:  
\[G= \begin{bmatrix}x_{1}&x_{2}&x_{3}\\ y_{1}&y_{2}&y_{3}\\ z_{1}&z_{2}&z_{3}\\ 1&1&1\end{bmatrix} =TA= \begin{bmatrix}r_{11}&r_{12}&r_{13}&c_{1}\\ r_{21}&r_{22}&r_{23}&c_{2}\\ r_{31}&r_{22}&r_{33}&c_{3}\\ 0&0&0&1\end{bmatrix}\begin{bmatrix}s_{1}&s_{2}&s_{3}\\ t_{1}&t_{2}&t_{3}\\ p_{1}&p_{2}&p_{3}\\ 1&1&1\end{bmatrix} . \tag{6}\]  
The key to the affine transformation algorithm is to find the elements of affine matrix \(T\). There is no inverse for \(4\times 3\) matrix \(A\), because inverse only exists for square matrices. The affine matrix \(T\) has been found by using the pseudo inverse matrix of \(A\)[25].