# A 3D Two-Phase Landslide Dynamical Model on GIS Platform
## 2 Methods
### Geometric Modeling  
By parsing the file information of DEM data files and three-dimensional model data files, we achieved the transformation of DEM data files into three-dimensional models. We drew inspiration from [PERSON]'s \"tiff-to-stl\" project on GitHub and utilized it to achieve the conversion of DEM to STL format ([[https://github.com/peterber](https://github.com/peterber)]([https://github.com/peterber](https://github.com/peterber)) [PERSON]/tiff-to-stl, (accessed on 2 June 2023)). A DEM can be characterized as a numerical or digital portrayal of altitude values across a planetary surface, whether in its entirety or specific regions, presented as a function of geographical coordinates. DEM is commonly depicted as a grid of elevation values and holds a pivotal role in geospatial analysis, hydrological modeling, landscape characterization, and more [39]. The STL file format is utilized to depict the geometry of three-dimensional objects by segmenting their surfaces into small triangular facets. Each individual triangular facet is defined by the three-dimensional coordinates of its vertices in conjunction with a unit normal vector corresponding to the triangular facet. The direction of the unit normal vector is determined utilizing the right-hand rule, oriented outward from the triangular facet. It is important to note that STL files exclusively capture the surface geometry of three-dimensional objects and do not encompass additional attributes such as color, material textures, and the like. The data storage format of STL files comes in two variants: binary format and ASCII format. Due to its succinct nature, the binary format is the more prevalent choice. In the context of the present discourse, we have opted to utilize the binary format as our selected method for data storage. In the context of STL files' binary format, data adheres to a standardized structure. The initial 84 bytes of the file are allocated to precisely outline the file-related information pertinent to the three-dimensional model. Among these bytes, the initial 80 constitute the file header, serving as a repository for storing critical particulars, including the file name, etc. In immediate succession, a 4-byte integer is employed to convey the count of triangular facets constituting the model. Subsequently, a systematic presentation of the geometric particulars for each individual triangular facet follows. Each of these facets is allocated a consistent 50-byte space, where the initial 48 bytes meticulously capture crucial information: the facet's unit normal  
Figure 1: Three-dimensional landslide dynamics model and post-processing scheme. vector and the coordinates of its three vertices. These values are consistently encoded as three sets of 4-byte floating-point numbers. The final 2 bytes are designated for encapsulating attributes unique to the respective triangular facet. This incorporation contributes to a comprehensive portrayal of the model's surface characteristics, thereby enhancing the overall understanding of its geometric configuration (Table 1). Taking triangle ABC as an illustrative example, we elucidate the methodology for defining the unit normal vector. Given the coordinates of the three vertices of triangle ABC, we can derive the following:  
\[\mathbf{AB}=B-A \tag{1}\]  
\[\mathbf{AC}=C-A \tag{2}\]  
\[\mathbf{N}=\frac{\mathbf{AB}\times\mathbf{AC}}{\left|\mathbf{AB}\times \mathbf{AC}\right|} \tag{3}\]  
where \(A=\) (X\({}_{1}\), Y\({}_{1}\), Z\({}_{1}\)), \(B=\) (X\({}_{2}\), Y\({}_{2}\), Z\({}_{2}\)), \(C=\) (X\({}_{3}\), Y\({}_{3}\), Z\({}_{3}\)), and \(\mathbf{N}\) represents the unit normal vector of triangle ABC, with the normal direction determined by the right-hand screw rule. In order to extract information from each triangular face in the DEM, the method we employed is as follows:  
We exemplify the method for acquiring fundamental information on triangular patches using a grid data configuration featuring three rows and two columns.