## 2 Methodology  
### Adaptive DEM Flight Space Layering Model  
DEM is a mathematical expression of the true three-dimensional shape of Earth's surface. It is a type of physical ground model that represents ground elevation information through a set of ordered numerical arrays. In the field of UAV flight path planning, it serves as fundamental data. It can intuitively and realistically depict the geographical features of the UAV's flight environment. The DEM represents terrain surface features through a discrete elevation data matrix, and its mathematical expression can be defined as follows:  
\[DEM=\{Z_{\bar{\eta}}\}i=1,2,\ldots,mj=1,2,\ldots,n \tag{1}\]  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Algorithm Category** & **Combined Methods** & **Computational Capability** & **Advantages** & **Disadvantages** & **Applicable Scenarios** \\ \hline \hline \multirow{6}{*}{
\begin{tabular}{c} \multirow{4}  
In this context, \(Z_{ij}\) represents the height value of the grid points i and j in the matrix, and m and n represent the spatial resolution of the regular grid. Compared to Digital Terrain Models (DTMs), DEMs specifically refer to elevation datasets without features, whereas DTMs also include derived terrain parameters, such as the slope and aspect. This distinction is particularly important in complex navigation, as pure elevation data are more conducive to geometric calculations for real-time path planning. By incorporating DEM data, three-dimensional path planning can be achieved. However, due to the expansion of the search space dimensions, a significant increase in computational load occurs. In cases in which the scale of regional drones is controllable or the flying altitude is substantially higher than the obstacle requirements, DEM layering operations can transform the three-dimensional planning into two-dimensional planning, thereby simplifying the computational load. However, when drones fly through complex mountainous environments, this simplification results in increased path searching consumption due to insufficient two-dimensional information. Based on this, this study combines the flight performance of drones with an adaptive optimal flight level selection method, using adjacent higher layers as alternative obstacle avoidance layers to enable three-dimensional planning. This approach can minimize the computational load while retaining the advantages of three-dimensional paths. For a given drone flight altitude range [\(H_{min}\), \(H_{max}\)] and the stratified altitude \(\Delta\)H, a set of drone flight stratification thresholds is defined as follows:  
\[H=\left\{H_{p}\big{|}H_{p}=H_{min}+p\times\Delta H\right\}_{p=0}^{N} \tag{2}\]  
As indicated by the formula, the selection of \(\Delta\)H directly determines the number of vertical layers. This parameter should be maximized under the constraint that the aircraft's inter-layer transition capability must be satisfied within a unit distance, thereby minimizing the computational and memory overhead caused by excessive layering, as shown in Figure 1.  
Among them, N represents the number of layers, and its mathematical expression is shown as follows:  
\[N=\text{round}\left(\frac{H_{max}-H_{min}}{\Delta\text{H}}\right) \tag{3}\]  
If the drone is flying at the k-th level, this means its flight altitude \(D(i,j)\) lies between two adjacent height planes. \[L_{k}=\{(i,j)|H_{k}\leq D(i,j)<H_{k+1}\},k=1,2,\ldots,N-1 \tag{4}\]  
The mathematical expression for the set of terrain obstacles at flight level k is as follows:  
\[Obs_{k}=\Bigg{\{} \begin{aligned} (i,j)|Obs_{k}(i,j)= \begin{cases}1,Z_{ij}\geq H_{k}\\ 0,Z_{ij}<H_{k}\end{cases}\Bigg{\}},k=1,2,\ldots,N-1\end{aligned}  \tag{5}\]  
There are two criteria for selecting the flight level: on the one hand, the flight level should be as low as possible to minimize energy consumption; on the other hand, obstacles should be avoided. However, these two points are contradictory in real-world scenarios.