# Bounding Volume Hierarchy-Assisted Fast SAR Image Simulation Based on Spatial Segmentation
## 3 Fast SAR Image Simulation Based on Spatial Segmentation
### SAR Echo Generating and Imaging  
After each thread finishes the task of executing the designed kernel function, the echo signal of the corresponding latticed blocks can be obtained, as shown in Figure 7, which is stored in two matrices with a real part and an imaginary part, respectively. The number of latticed blocks placed in each echo matrix cell \((x,y)\) is matched with the number of threads in the longitudinal dimension (\(Z\)-axis) of the 3D Grid, and the echo signal of the latticed blocks along the \(Z\)-axis in parallel are vectorially superimposed to obtain the echo matrix cell \((x,y)\) information. The target echo matrix can be obtained by traversing the full cell positions of the echo matrix. The target SAR-simulated image can be obtained by focusing on the target echo matrix using the RD imaging algorithm. The specific steps for generating echo signals and imaging based on the CUDA platform using each thread to execute the CUDA kernel function in parallel are as follows:  
1. Based on the current position of the echo matrix cell \(\left(x\leq N_{a}\quad y\leq N_{r}\right)\), the sampling moments along the azimuthal and range directions can be locked, as determined by the divided azimuthal and range directions of the time axis;
2. Each thread directly deals with the EM waves transmitted by each latticed block. The azimuthal and range envelope constraints on the echo matrix cell \((x,y)\) are used to select the coherent lattices \((P_{z},P_{z}\leq N_{s}<N)\) in the current latticed block \(\left(P_{z},\frac{z\leq Z}{P_{z}\leq N}\right)\). Then, the discrete EM waves for the coherent lattice target are transmitted. Multiple scattering path tracking of the transmitted EM waves is carried out, and the EM waves correspond to the coherent lattices \(P_{z}^{i}\) in turn. Using the multiple backscatter field calculation method in Section 2.2, the backscatter coefficient amplitude \(c_{k}^{i}\) of the EM wave corresponds to the coherent lattices, and \(P_{z}^{i}\) is obtained; at the same time, the corresponding phase information \(Pha_{k}^{i}\) is obtained from the real-time slant range \(R_{k}^{i}\) of \(P_{z}^{i}\). By multiplying the amplitude \(\sigma_{k}^{i}\) by the sine or cosine of the phase \(Pha_{k}^{i}\), the real part \(a_{k}^{i}\) and the imaginary part \(b_{k}^{i}*j\) of the corresponding echo signal can be obtained, respectively; the echo emulation signals for each latticed block are recorded as follows: \(Echo_{z}=\sum\limits_{k=1}^{K}\sum\limits_{i=1}^{N_{z}}\sigma_{k}^{i}*Pha_{k} ^{i}=\left[\sum\limits_{k=1}^{K}a_{k}^{i}\quad\sum\limits_{k=1}^{K}b_{k}^{i}*j\right]\). 3. By superimposing the echo matrix cell \((x,y)\) corresponding to the echo of the latticed blocks along the longitudinal dimension \(Z\) of the grid, the echo matrix cell \((x,y)\) can be denoted as \(Echo_{(x,y)}=\sum\limits_{z=1}^{Z}Echo_{z}\);
4. Each thread executes steps (2) to (3) independently. Traversing the positions of all the cells of the target echo matrix in parallel can quickly complete the echo simulation task. The raw echo matrix \(Echo_{T}=\sum\limits_{x=1}^{N_{z}}\sum\limits_{y=1}^{N_{z}}Echo_{(x,y)}\) is obtained and stored as complex numbers \([a+bi]\);
5. Finally, the raw echo matrix is downloaded from the GPU to the CPU. The RD imaging algorithm is used to focus the simulated echo matrix in two dimensions to obtain the simulated SAR image of the target, and the process of SAR echo imaging can be equated to the two-dimensional deconvolution process of reconstructing the backscatter coefficient of the target. The proposed method utilizes the parallel computing advantage of the CUDA platform, integrating the SAR phase reference system and spatial segmentation theory. It adopts the echo matrix cell method to regard each target echo matrix cell as a subfield of the backscatter field to configure the 3D Grid planar dimensional index.