# A 3D Two-Phase Landslide Dynamical Model on GIS Platform
## 2 Methods
### Geometric Modeling
Given the pixel values associated with raster cells A, B, C, D, E, and F, our approach involves traversing each row of the raster data. Upon encountering raster cell A, we initiate the retrieval of pixel values for its three neighboring cells--specifically, B, C, and D. Following this, we meticulously assess the validity of pixel values for cells B and C. Once both the B and C data are validated and provided that the pixel value of A is also verified, the raster cells A, B, and C coalesce to form the triangular facet ABC. Analogously, if the pixel value of D satisfies the validity criteria, raster cells B, C, and D collectively compose the triangular facet BCD. This sequence of operations is replicated as we proceed to traverse raster cell C, during which we employ the identical methodology to scrutinize the pixel values of cells C, D, E, and F. Assuming that the data for all the aforementioned cells are substantiated as valid, a total of four triangular facets can be synthesized (Figure 2). More precisely, a set of four adjacent raster cells constitutes the basis for generating two distinct triangular facets. Within the context of an m-row and n-column dataset, the theoretical potential exists to derive up to (m \(-\) 1) \(\times\) (n \(-\) 1) \(\times\) 2 triangular facets. It is of paramount importance to underscore that the term \"valid pixel values\" within the aforementioned context pertains to pixel values that are devoid of anomalies and conform to predetermined stipulations encompassing both the raster and data ranges. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Bytes** & **Data Type** & **Description** \\ \hline
80 & ASCII & file header \\
4 & unsigned integer & triangle facet count \\
4 & float & i for unit normal vector \\
4 & float & j for unit normal vector \\
4 & float & k for unit normal vector \\
4 & float & X for unit normal vector1 \\
4 & float & Y for unit normal vector1 \\
4 & float & Z for unit normal vector1 \\
4 & float & X for unit normal vector2 \\
4 & float & Y for unit normal vector2 \\
4 & float & Z for unit normal vector3 \\
2 & unsigned integer & attribute information \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Binary format. Assuming that '\(t\)' represents the affine transformation information extracted from the raster image, it constitutes a tuple comprising six elements. These elements respectively signify the X-coordinate of the top-left corner of the raster image, horizontal pixel resolution, horizontal rotation angle, Y-coordinate of the top-left corner, vertical rotation angle, and vertical pixel resolution. Consequently, the coordinates of raster cell 'A' can be represented as follows:  
\[A_{x}=t(0)+\left((X_{min}+X)\times t(1)+(Y_{min}+Y)\times t(2)\right) \tag{4}\]  
\[A_{y}=t(3)+\left((X_{min}+X)\times t(4)+(Y_{min}+Y)\times t(5)\right) \tag{5}\]  
\[A_{z}=Z \tag{6}\]  
where \(t(0)\) is the X-coordinate of the top-left corner of the raster image, \(t(1)\) is the horizontal pixel resolution, \(t(2)\) is the horizontal rotation angle, \(t(3)\) is the Y-coordinate of the top-left corner, \(t(4)\) is the vertical rotation angle, \(t(5)\) is the vertical pixel resolution, \(X\) represents the row number of raster A, \(Y\) represents the column number of raster A, \(X_{min}\) indicates the minimum value of row numbers within the specified window range, and \(Y_{min}\) indicates the minimum value of column numbers within the specified window range. The variable \(Z\) is contingent on the specified requirements, and in this context, we default to utilizing the pixel values from the raster. By employing the aforementioned approach, the conversion from DEM to STL format can be achieved. Simultaneously, based on the analysis of the formats of the aforementioned two files, integration into a GIS platform can be achieved through Python programming language.