# Research on Airspace Conflict Detection Method Based on Spherical Discrete Grid Representation
## 4 Algorithm Model Construction  
### Airspace Representation  
1. Element information representation * Working area: the area set by the airspace is set as a working area. The scope of the working area is composed of \(2n\) adjacent diamond areas of the same level as required. This paper takes a diamond area of the third level as an example, with an area of about 800,000 km\({}^{2}\). The number of the work area is represented by the 1-3 rd levels of the grid, that is, the location code;
* Airspace: It is represented by the grid matrix at levels 4-10 th. The grid surrounded by the four points of the coordinates of the boundary points of the airspace is the occupied grid of the airspace. Each airspace occupies the grid and expands one layer of the grid to obtain the airspace envelope. The initial 10 rhombus are level 0. According to the calculation formula of spherical arc length, the length of a single rhombus edge is about 7061 km. When dividing to level 10, the length of a single rhombus edge is about 7 km. The minimum distance of non-adjacent rhombus grids is one rhombus grid interval, that is, the vertical distance from the apex of the rhombus to the opposite side is about 6 km. During CD, the airspace is extended by one layer, that is, two surrounding layers are separated, and the minimum distance is 11.94 km, greater than 10 km. Therefore, the division to the 10 th level not only meets the minimum safe separation distance of airspace, but also does not cause grid deformation in different latitude areas, and meets the accuracy conditions required for the use of the AR grid;
* Route: the width of the air route is 20 km, and the minimum is not less than 8 km. Therefore, the route can be regarded as a linear airspace model. As shown in Figure 10. 2 Construction of airspace data matrix 1. The longitude and latitude coordinates of airspace boundary points are converted into spherical rectangular coordinates. The longitude and latitude coordinate \(G\) (longitude \(\lambda\), latitude \(\varphi\)), The equatorial radius of the Earth R corresponds to the three-dimensional rectangular coordinates \(C(X,\,Y,\,Z)\). The relationship of transformation from longitude and latitude coordinates to  
Figure 10: Schematic diagram of AR grid. spherical rectangular coordinates can be established from the spatial geometric relationship, as shown in Figure 5. Spherical rectangular coordinate grid positioning. Given the grid vertex coordinates \(P_{1}\), \(P_{2}\), \(P_{3}\), \(P_{4}\) and the coordinates of the point to be solved, connect the midpoint on the opposite side of the diamond grid to obtain the midpoint coordinates \(M_{1}\), \(M_{2}\), \(M_{3}\), \(M_{4}\). As shown in Figure 8, divide the grid into four quadrants, calculate the plane \(OM_{1}M_{3}\) normal vector \(\overrightarrow{v_{1}}\) and the plane \(OM_{2}M_{4}\) normal vector \(\overrightarrow{v_{2}}\), and determine the quadrant of the point according to the relationship between the point and the plane. The initial state of Hilbert is State I. The Hilbert state of the next level is determined according to the quadrant transfer mode. Carry out hierarchical division until the 10 th level. As shown in Figure 11. (c) Airspace matrix construction. After connecting the four points of the coordinate code, the boundary of the airspace is obtained, the grid occupied by the airspace is calculated, and the value is assigned to 1, and the value of other grids in the mission area is assigned to 0, and a 128 \(\times\) 128 data matrix composed of 0 and 1 is obtained. (d) Determination of airspace occupancy grid. Connect the coordinates of the airspace boundary points to obtain the airspace polygon, and determine whether all points in the matrix are within the airspace range. The value is assigned to 1 in the airspace range, and the value is 0 in the non-domain. The 128 \(\times\) 128 matrix composed of 0.1 is the airspace data matrix.