A TIN network construction method based on spatial minimum spanning tree and convex hull polygon
By constructing a method based on spatial minimum spanning tree and convex hull polygon, the problem of insufficient triangular mesh quality and global optimality in existing TIN generation algorithms is solved. The generated irregular triangular mesh has correct topology and excellent shape, which improves the efficiency of the algorithm and meets the requirements of high-precision geographic modeling and engineering applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANTONG UNIV
- Filing Date
- 2026-01-28
- Publication Date
- 2026-05-29
AI Technical Summary
Existing TIN generation algorithms have shortcomings in terms of triangulation quality and global optimality. They are prone to generating low-quality triangles, self-intersections, holes, or incomplete coverage, making it difficult to meet the requirements of high-precision geographic modeling and engineering applications.
We adopt a construction method based on spatial minimum spanning tree and convex hull polygon. By constructing spatial minimum spanning tree and convex hull polygon as the framework, and combining the principle of maximizing the minimum angle and the skipping mechanism of edges and points, we can ensure that the triangle shape is good and there are no topological errors, thereby improving the efficiency of the algorithm.
The generated irregular triangular network has a correct topology and excellent shape, avoiding self-intersections and holes, significantly improving algorithm efficiency and meeting the needs of high-precision geographic modeling and engineering applications.
Smart Images

Figure CN122115713A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of geographic information system data processing, specifically to a method for constructing a TIN network based on a spatial minimum spanning tree and convex hull polygons. Background Technology
[0002] Triangulated Irregular Networks (TINs), as a digital model representing continuous surfaces, have been widely applied in Geographic Information Systems (GIS), terrain modeling, computer graphics, 3D reconstruction, finite element analysis, remote sensing image processing, and path planning due to their good balance between data accuracy and efficiency. The core idea of TINs is to connect sampling points into a set of non-overlapping triangles. This not only effectively avoids the data redundancy and smoothing effects common in regular grids (such as Digital Elevation Models, DEMs), but also significantly improves the efficiency and accuracy of data representation while preserving terrain details.
[0003] In existing technologies, TIN generation algorithms mainly include: point-by-point insertion method, divide-and-conquer algorithm and triangular mesh growth method.
[0004] Point insertion is a classic and widely used algorithm. Its basic principle is to first construct an initial large triangle (hypertriangle) containing all data points, then sequentially insert each data point into the current triangulation. The triangulation is updated through local lookups and edge flipping (such as empty circumcircle detection and optimization under the Delaunay criterion), and finally, all triangles related to the initial hypertriangle are deleted. This method is relatively simple to implement and suitable for incremental data processing. Its disadvantage is its high time complexity (typically O(n^2)). 2 The efficiency (or higher, depending on the point insertion order and optimization strategy) is low when processing large-scale point sets. Furthermore, failure to optimize the insertion order (e.g., using randomization or spatial sorting) can lead to a decrease in the quality of the generated triangular mesh, resulting in elongated triangles that negatively impact subsequent analysis and visualization.
[0005] The core idea of the divide-and-conquer algorithm is to recursively divide the point set into smaller subsets until the subset size is small enough (usually 2-3 points), then construct sub-triangulations for each subset, and finally merge the sub-triangulations level by level and optimize. Theoretically, this algorithm has a good time complexity (O(n log n)), but its implementation is complex, especially in the merging phase where it needs to handle a large number of boundary cases.
[0006] Triangulation growth is a construction method based on a local expansion strategy. Its basic idea is to start from an initial triangle (or a starting edge) and gradually "grow" new triangles outwards according to certain geometric criteria (such as shortest distance, maximum angle, or Delaunay condition) until all data points are covered. This method is intuitive, easy to implement, and has certain advantages when processing data with obvious spatial clustering characteristics; however, it is sensitive to the selection of the initial seed. If the growth strategy is inappropriate, it is easy to generate non-optimal triangles (such as narrow triangles), making it difficult to guarantee global Delaunay optimality, and it may cause holes or incomplete coverage under complex point distributions.
[0007] Based on the above analysis, existing technologies for constructing TINs still have significant shortcomings in terms of triangulation quality and global optimality. While the point-by-point insertion method is simple to implement and supports incremental updates, it is sensitive to point order and prone to generating low-quality triangles. The divide-and-conquer algorithm is complex to implement, has poor robustness in the merging phase, and does not support dynamic data updates. The triangulation growth method highly depends on the initial seed and local growth strategy, easily getting trapped in local optima, leading to problems such as holes, incomplete coverage, or morphological degradation in the triangulation, making it difficult to meet the stringent requirements of topological integrity and geometric quality for high-precision geographic modeling and engineering applications. Therefore, there is an urgent need for a TIN construction method that can guarantee Delaunay optimality or near-optimality while possessing strong robustness. Summary of the Invention
[0008] To further improve the construction quality of TINs and maintain global optimality, this application proposes a TIN construction method based on a spatial minimum spanning tree and a convex circumscribed polygon. Specifically, this patent pre-constructs a spatial minimum spanning tree and a convex circumscribed polygon for the input scatter set, and then uses these two geometric structures as a "framework" to construct the TIN. During the growth process of the TIN, it ensures that each generated triangle has excellent morphological characteristics (satisfying the conditions of "empty circumcircle" or "minimum angle maximization") and topological correctness, ultimately constructing a high-quality irregular triangular network. At the same time, a "skip" mechanism for edges and points is proposed to avoid invalid traversal during the triangular network construction process, maximizing the algorithm's time efficiency.
[0009] To achieve the above objectives, the specific solution of this application is as follows:
[0010] A method for constructing a TIN network based on a spatial minimum spanning tree and convex hull polygons is described below:
[0011] S1: Construct the minimum spanning tree in space:
[0012] A complete graph is constructed from a set of scattered points with horizontal and vertical coordinates in a plane. By default, any two points in the complete graph are connected by an edge, and the weight of the edge is the Euclidean distance between the two points.
[0013] The distance between a point and a set of points is defined as the minimum Euclidean distance between the point and all points in the set, and the corresponding point is the feature point of that point with respect to the set of points; the distance between two sets of points is defined as the minimum Euclidean distance between all pairs of points in the two sets, and the corresponding pair of points is the feature point pair of the two sets.
[0014] Initialize the "selected set", "unselected set", "distance array", and "index array". Randomly select an initial point and add it to the "selected set". All other points are assigned to the "unselected set". The "distance array" stores the Euclidean distance from each point in the "unselected set" to the initial point. The "index array" is filled with the initial feature indices. The minimum spanning tree is initialized to empty. Iteratively expand the minimum spanning tree.
[0015] S2: Construct a convex hull polygon:
[0016] Traverse the scatter set and select the point with the smallest ordinate as the reference point; sort the points according to their azimuth angles with respect to the reference point, and place the reference point at the end of the sorting result to obtain a reordered scatter set. The azimuth angle is defined as the angle from the horizontal rightward reference direction, rotated counterclockwise until the reference point points to the direction of the point to be measured.
[0017] Initialize the "current index" to 0, and initialize the convex hull polygon to the first point of the reordered scatter set; traverse the subsequent vertices of the "current vertex", select the target successor vertex with the smallest azimuth angle with respect to the "current vertex", add it to the convex hull polygon and update the "current index", repeat until the "current index" points to the end point of the reordered scatter set, and the construction is complete;
[0018] S3: Construct point and edge objects;
[0019] S4: Initial construction of an irregular triangular network;
[0020] S5: Repair irregular triangular meshes based on the principle of "maximizing the minimum angle".
[0021] Preferably, it is characterized by:
[0022] The steps for defining the distance between a point and a set of points in S1 are as follows: For a point Hedianji , ,make have ,but Accordingly, it is called For point About point sets The feature index, called For point About point sets Feature points;
[0023] The steps to define the distance between two point sets are as follows: For point set... and , , ,make and ,have ,but Accordingly, ordered pairs are called ordered pairs. For ordered point sets Feature index pairs are called ordered point pairs. For ordered point sets Feature point pairs.
[0024] Preferably, the iterative expansion of the minimum spanning tree in S1 is as follows: In each iteration, the "nearest distance" is initially set to positive infinity and the "target index" is initially empty; all points in the "unselected set" are traversed, and the Euclidean distance between the current point and the newly added point in the "selected set" in the previous round is calculated (denoted as the current distance). If the current distance is less than the existing distance from the point to the "selected set", the "distance array" and the "index array" are updated; if the distance from the point to the "selected set" is less than the "nearest distance", the "nearest distance" and the "target index" are updated; after the traversal is completed, the point P in the "unselected set" and the feature point Q in the "selected set" are obtained through the "target index", the edge PQ is added to the minimum spanning tree, P is moved from the "unselected set" to the "selected set", and the record corresponding to P in the "index array" and the "distance array" is removed; the iteration is repeated until the "unselected set" is empty, the minimum spanning tree is constructed, and the construction process does not require the prior construction of the adjacency matrix.
[0025] Preferably, the method for constructing the midpoint object in S3 is as follows:
[0026] All points in the graph are constructed as objects. Each point object contains an index, x and y coordinates, elevation, "cumulative angle", and "upper bound angle" attributes. The "cumulative angle" is a floating-point number, initialized to 0.0, and incremented by the radian value of the vertex angle of the point in the triangle when the triangle is constructed. The "upper bound angle" is a floating-point number. Points on the convex hull are set to the radian value of the vertex angle of the point on the convex hull, and points not on the convex hull are set to 2π. When the "cumulative angle" equals the "upper bound angle", the point is a "full point" and will no longer participate in the construction of new triangles.
[0027] Preferably, the method for constructing edge objects in S3 is as follows:
[0028] The edges on the minimum spanning tree and the convex hull polygon are constructed as edge objects. Each edge object contains an index, two endpoints (point objects), a "triangle count", a "triangle upper bound", and a "set of skipped indices". The "triangle count" is an integer, initialized to 0, and incremented by 1 when constructing a triangle containing that edge. The "triangle upper bound" is an integer, set to 1 for edges on the convex hull and 2 for edges on non-convex hulls. When the "triangle count" equals the "triangle upper bound", the edge is a "full edge" and will not participate in the construction of a new triangle. The "set of skipped indices" is a list that stores the indices of points to be skipped when constructing a triangle based on that edge.
[0029] Preferably, the method for constructing the irregular triangular mesh in S4 is as follows: First, add the edge objects obtained in S3 to the "existing edge set"; set the "current pointer" to initially point to the first edge of the "existing edge set", and the "end pointer" to initially point to the last edge of the "existing edge set", and initialize the irregular triangular mesh to empty;
[0030] Start traversing the edges in the "existing edge set", taking the edge pointed to by the "current pointer" as the research object, and denoting it as the "current edge"; let the two endpoints of the "current edge" be P1 and P2; first check whether the state of edge P1P2 is "full edge", if so, skip edge P1P2 directly, otherwise start traversing the points in the graph;
[0031] Let the current point be P3. Check whether the index of P3 is in the "skip index set" of edge P1P2 and whether the state of P3 is "full point". If neither is true, check whether points P1, P2 and P3 simultaneously meet the following three conditions. Otherwise, skip P3 directly.
[0032] Condition 1: Edge P1P3 does not intersect with any edge in the "existing edge set";
[0033] Condition 2: Edge P2P3 does not intersect with any edge in the "existing edge set";
[0034] Condition 3: All points in the scatter set except P1, P2, and P3 are not in the circumcircle of triangle P1P2P3;
[0035] Conditions 1 and 2 require the detection of intersections of straight segments. This patent uses a "double-span" detection method, the process of which is as follows:
[0036] Generate line segment AB from two points A and B on the plane, and generate line CD from two other points C and D. and If the positive and negative signs are opposite, then points A and B are on opposite sides of line CD, and line segment AB is said to cross line CD; otherwise, points A and B are on the same side, and line segment AB does not cross line CD. Furthermore, if it is found that line segment AB crosses line CD and line segment CD crosses line AB, then line segment AB intersects line segment CD; otherwise, they do not intersect.
[0037] Condition 3 requires the rapid calculation of the circumcenter of the triangle. The method is as follows:
[0038] First, given three non-collinear points on the plane: Construct the following four vectors: Then, the following three matrices are constructed: ,but The coordinates of the circumcenter O are: ;
[0039] If all three conditions above are met, triangle P1P2P3 is added to the irregular triangular mesh, and the following procedure is executed:
[0040] First, add the degree of the vertex angle P1 in triangle P1P2P3 to the "Cumulative Angle" attribute of point P1. Similarly, add the degree of the vertex angle P2 and the vertex angle P3 to the "Cumulative Angle" attribute of points P2 and P3 respectively.
[0041] Next, check if edge P1P3 already exists in the "existing edge set"; if it does not exist, set its "triangle count" attribute to 1, add the index of P2 to its "skip index set", and then add it to the "existing edge set"; if it exists, access the existing edge, increment its "triangle count" attribute by 1, add the index of P2 to its "skip index set", and the processing flow of P2P3 is similar to that of P1P3, so it will not be described again.
[0042] Finally, increment the "triangle count" attribute of edge P1P2 by 1; add the index of P3 to the "skip index set" of edge P1P2, and then check whether the state of edge P1P2 has changed to "full edge". If so, truncate the traversal of subsequent points; otherwise, continue.
[0043] Each time a new edge is added to the "existing edge set", the "end pointer" moves one position to the right. When all points have been traversed or the traversal is truncated, the "current pointer" moves one position to the right and begins generating triangles based on the next edge. Once the "current pointer" meets the "end pointer", it means that the edges in the "existing edge set" have been processed. Accordingly, the irregular triangular network corresponding to the scattered point set is initially generated.
[0044] Preferably, step S5 is as follows:
[0045] Reset the "current pointer" in step four so that it points to the first edge in the "existing edge set" again; traverse the edges in the "existing edge set" and record the two endpoints of the current edge as P1 and P2; first check if the state of edge P1P2 is "full edge". If so, edge P1P2 must not be on the edge of the vulnerability area and is skipped directly. Otherwise, initialize the "target triangle" to empty, initialize the "maximum and minimum interior angles" to negative infinity, and start traversing the points in the graph.
[0046] Let the current point be P3. Check if the index of P3 is in the "skip index set" of edge P1P2 and if the state of P3 is "full point". If neither is true, check if points P1, P2 and P3 simultaneously satisfy conditions 1 and 2 proposed in step 4. If so, construct triangle P1P2P3 and calculate its minimum interior angle, denoted as "current minimum interior angle". If "current minimum interior angle" is greater than "maximum minimum interior angle", update "maximum minimum interior angle" to "current minimum interior angle" and update "target triangle" to triangle P1P2P3.
[0047] After completing the traversal of points, check if the "target triangle" is still empty. If not, record the "target triangle" as triangle P1P2Q, add it to the irregular triangular mesh, and simultaneously execute the following procedures:
[0048] First, add the degree of the vertex angle P1 in triangle P1P2Q to the "Cumulative Angle" attribute of point P1. Similarly, add the degree of the vertex angle P2 and the vertex angle Q to the "Cumulative Angle" attribute of points P2 and Q respectively.
[0049] Next, check if edge P1Q already exists in the "existing edge set". If it does not exist, set its "triangle count" attribute to 1, add the index of P2 to its "skip index set", and then add it to the "existing edge set". If it exists, access the existing edge, increment its "triangle count" attribute by 1, and add the index of P2 to its "skip index set". The processing flow for edge P2Q is similar to that for edge P1Q and will not be described again.
[0050] Finally, increment the "triangle count" attribute of edge P1P2 by 1, add the index of Q to the "skip index set" of edge P1P2, and then check whether the state of edge P1P2 has changed to "full edge". If so, truncate the traversal of subsequent points; otherwise, continue.
[0051] The above process is iterated until all edges have been traversed; accordingly, the holes in the irregular triangular mesh have been repaired, and its topological correctness is guaranteed.
[0052] After all the above steps, the present invention can be used to construct an irregular triangular network based on the input scatter set, and the generated result has no topological errors and has an excellent overall shape.
[0053] Compared with the prior art, this application has at least the following beneficial effects:
[0054] 1. This invention uses the convex hull polygon of the scattered point set (which is the theoretical boundary of the irregular triangular network, and its edges must be contained in the triangular network) and the spatial minimum spanning tree (which has the excellent topological properties of "no loops" and "no self-intersections", and its edges are highly likely to be contained in the triangular network) as the construction framework. Combined with the vulnerability repair steps after the initial construction, it ensures that the final generated irregular triangular network does not have topological errors such as self-intersections, holes or incomplete coverage, thus meeting the requirements of topological integrity for high-precision geographic modeling and engineering applications.
[0055] 2. During the construction of the triangulation network, the "empty circumcircle" condition ensures the excellent shape of the triangles. Then, through the "maximum minimum angle" principle in the defect repair stage, the generated irregular triangulation network has a shape that is close to that of an equilateral triangle in the central area. There are almost no narrow and long triangles. This effectively solves the problem of triangulation network shape deterioration and non-optimal triangles in the existing technology. It achieves the global optimal or near-optimal triangulation result under geometric quality constraints.
[0056] 3. This invention proposes a skipping mechanism for "full points", "full edges" and "index sets to be skipped". During the construction of the triangulation network, points and edges that have no construction potential can be skipped directly, avoiding invalid traversal. At the same time, the dual-pointer iterative construction mode and the vulnerability patching stage do not need to be processed repeatedly because a large number of points and edges are already in the "full points" and "full edges" state, which significantly improves the time efficiency of the algorithm and solves the problem of low efficiency of existing technologies (such as the point-by-point insertion method) when processing large-scale point sets.
[0057] 4. When constructing the minimum spanning tree, an improvement based on the Prim algorithm is made. Taking advantage of the fact that the Euclidean distance between any two points can be directly calculated, there is no need to pre-construct the adjacency matrix, which greatly reduces the space complexity of the algorithm and reduces the storage resource consumption. Compared with the traditional Prim algorithm, it has a greater advantage in resource adaptation. Attached Figure Description
[0058] Figure 1 This is a schematic diagram of the technical process of the present invention;
[0059] Figure 2 An example of a complete graph visualization;
[0060] Figure 3 This is a schematic diagram illustrating the distance between points and a set of points.
[0061] Figure 4 This is a schematic diagram illustrating the distance between point sets;
[0062] Figure 5 A schematic diagram illustrating the process of constructing a spatial minimum spanning tree;
[0063] Figure 6 A visual example of a spatial minimum spanning tree;
[0064] Figure 7 This is a schematic diagram of the azimuth angle;
[0065] Figure 8 A schematic diagram illustrating the construction process of a convex hull polygon;
[0066] Figure 9 A visualization example of a convex-hulled polygon tree;
[0067] Figure 10 This is a diagram illustrating the "full" state.
[0068] Figure 11 This is a diagram illustrating the "full edge" state.
[0069] Figure 12 This is a schematic diagram of the logic flow for three conditional judgments;
[0070] Figure 13 This is a schematic diagram illustrating the change process of the edge pointer;
[0071] Figure 14 A schematic diagram illustrating the initial construction process of an irregular triangular network;
[0072] Figure 15 This is a diagram illustrating the process of change in the number of "full points";
[0073] Figure 16 This is a schematic diagram illustrating the process of change in the number of "full edges";
[0074] Figure 17 This is a schematic diagram illustrating the patching process for irregular triangular network vulnerabilities.
[0075] Figure 18 This is a visualization example of an irregular triangular network. Detailed Implementation
[0076] Please see Figure 1 This application provides a method for constructing a TIN network based on a spatial minimum spanning tree and a convex hull polygon. The steps of the construction method are as follows:
[0077] S1: Construct a minimum spanning tree in space
[0078] The specific steps of S1 are as follows:
[0079] S11: Constructing a complete graph: For a scattered set of points with horizontal and vertical coordinates in a plane, construct a complete graph, that is, assume that there is an edge connecting any two points, and the Euclidean distance between the two points is the weight of the edge connecting the two points. Figure 2 This is a complete graph visualization instance.
[0080] S12: Notation Convention: In this application, a single uppercase English letter (with a subscript allowed) is used to represent a point, for example: , , Use forms like The symbol represents a point set, where n is the total number of points in the point set, i is the index of a point in the point set, and the range is . ( Represents the set of integers. That is, the set of all integers between 0 and n-1 (the same applies below); the function dis(a,b) is used to represent the distance between two objects a and b. When both a and b are points, dis(a,b) is the Euclidean distance between the two points.
[0081] S13: Define the distance between a point and a set of points: for a point Hedianji , ,make have ,but Accordingly, it is called For point About point sets The feature index, called For point About point sets The feature points. Figure 3 This is a visual representation of the above definition.
[0082] S14: Define the distance between two point sets: for point set... and , , ,make and ,have ,but Accordingly, ordered pairs are called ordered pairs. For ordered point sets Feature index pairs are called ordered point pairs. For ordered point sets Feature point pairs. Figure 4 This is a visual representation of the above definition.
[0083] S15: Initialize the minimum spanning tree and related variables: Set up two point sets, denoted as "selected set" and "unselected set" respectively. Then set up a "distance array" and an "index array". The former stores and maintains the distances from each point in the "unselected set" to the "selected set", and the latter stores and maintains the feature indices of each point in the "unselected set" with respect to the "selected set". Randomly select an initial point and add it to the "selected set". Add the remaining points to the "unselected set". Fill the "distance array" with the distances from each point in the "unselected set" to the initial point. Fill the "index array" with the same number of "0" values as the number of points in the "unselected set" (at this point, the "selected set" contains only one initial point, and its index "0" is the feature index of each point in the "unselected set" with respect to the "selected set"). Simultaneously, initialize the minimum spanning tree to empty.
[0084] S16: Iterative Construction of the Minimum Spanning Tree: Iteratively expand the minimum spanning tree. In each iteration, set the variables "nearest distance" and "target index". The former is used to store and maintain the distance dis(selected set, unselected set) between the "selected set" and the "unselected set", initialized to positive infinity; the latter is used to store and maintain the feature index pairs between the "selected set" and the "unselected set". Traverse all points in the "unselected set":
[0085] First, calculate the Euclidean distance between the current point and the newly added points in the "selected set" from the previous iteration, and denote this value as the "current distance". If the "current distance" is less than dis(current point, selected set), then update dis(current point, selected set) to the "current distance" in the "distance array". Simultaneously, update the feature index of the current point with respect to the "selected set" in the "index array" to the last index of the "selected set".
[0086] Next, compare dis(current point, selected set) with the "nearest distance". If dis(current point, selected set) is less than the "nearest distance", then update the "nearest distance" to dis(current point, selected set). At the same time, update the "target index" to the index of the current point in the "unselected set".
[0087] After traversing the "unselected set" according to the above process, obtain the corresponding point in the "unselected set" using the "target index", denoted as P. Then, obtain the feature index of P with respect to the "selected set" from the "index array", and further obtain the feature point of P with respect to the "selected set", denoted as Q. The point pair (P, Q) is the feature point pair of (selected set, unselected set). Add the edge PQ to the minimum spanning tree in space. At the same time, remove Q from the "unselected set" and add it to the "selected set". Correspondingly, remove the record corresponding to Q from the "index list" and "distance list".
[0088] Execute the above process until the "unselected set" becomes an empty set. Correspondingly, the "selected set" contains all points in the graph, and the spatial minimum spanning tree is completed. Figure 5 This is a schematic diagram of the above process. Figure 6 This is a visual instance of a spatial minimum spanning tree.
[0089] The process of constructing the spatial minimum spanning tree in this application is based on Prim's algorithm, but with improvements. The significant difference lies primarily in whether or not an adjacency matrix is pre-constructed. Traditional Prim's algorithm requires constructing a space complexity of O(n log n). adjacency matrix This is to store the graph, where n is the number of points in the graph. Let be the weight of the edge between point i and point j. When there is no edge connecting the two points, it is equivalent to assuming that there is an edge with a weight of positive infinity connecting the two points, i.e. As can be seen, the adjacency matrix mainly represents two types of information: the first is whether there is an edge connecting two points in the graph, and the second is the weight of the edge between two connected points. In this application, we assume that there is an edge connecting any two points, so the first type of information does not need to be stored. Furthermore, the weight of a point between two points is the Euclidean distance between them, which can be directly calculated, so the second type of information also does not need to be stored. Therefore, there is no need to construct an adjacency matrix, thereby reducing the space complexity of the algorithm.
[0090] S2: Construct a convex hull polygon
[0091] In one embodiment, S2 includes the following steps:
[0092] S21: Baseline acquisition and scatter set sorting
[0093] The scattered point set is traversed, and the point with the smallest y-coordinate is selected as the reference point. If the point with the smallest y-coordinate is not unique, the point with the smallest x-coordinate is selected as the reference point. Next, the scattered point set is sorted based on the azimuth angle of the current point with respect to the reference point (the reference point is placed at the end of the sorted results by default). The azimuth angle of the point to be measured with respect to the reference point is defined as follows: the horizontal direction to the right is taken as the reference direction, and the direction from the reference point to the point to be measured is the measured direction. It is assumed that the reference direction rotates counterclockwise. If the direction coincides with the direction to be measured, then This is called the azimuth angle of the point to be measured about the reference point. Figure 7 This is a schematic diagram of azimuth angles. When two points have the same azimuth angle with respect to the reference point, the Euclidean distance between each point and the reference point is further calculated, and the point with the greater distance is placed before the point with the greater distance. The sorting result is denoted as the "reordered scatter set".
[0094] S22: Iteratively construct the convex hull polygon
[0095] Initialize the "current index" to 0, and initialize the convex hull polygon to the first point of the reordered scatter set. Obtain subsequent vertices of the convex hull polygon as follows:
[0096] Visit the point with the index "current index" in the "reordered scatter set" and denote it as the "current vertex". Initialize the "minimum azimuth" to positive infinity and the "target successor vertex" to empty. Traverse all vertices following the "current vertex" in the "reordered scatter set" in order, calculate the azimuth of each vertex with respect to the "current vertex", and denote it as the "current azimuth". Compare the "current azimuth" with the "minimum azimuth". If the former is smaller than the latter, update the "minimum azimuth" to the "current azimuth" and update the "target successor vertex" to that vertex. After traversal, add the "target successor vertex" to the convex hull polygon, and update the "current index" to the index of the "target successor vertex" in the "reordered scatter set".
[0097] Repeat the above process until the "current index" is updated to the index of the last point of the "reordered scatter set", and the convex hull polygon is completed. Figure 8 This is a schematic diagram of the above process. Figure 9 This is a visualization instance of a convex hull polygon.
[0098] S3: Constructing vertex and edge objects
[0099] S31: Constructing a point object
[0100] All points in the graph are constructed as objects. In addition to the usual attributes such as index, x and y coordinates, and elevation, each point object also includes the attributes of "cumulative angle" and "upper bound angle".
[0101] The "Cumulative Angles" attribute is a floating-point type and initialized to 0.0. Assuming a triangle ABC is constructed with vertices A, B, and C during the triangulation process, the "Cumulative Angles" attribute of point A is incremented by the degree measure (in radians) of vertex angle A in triangle ABC. Similarly, the "Cumulative Angles" attributes of points B and C are incremented by the degree measures of vertex angles B and C, respectively. This attribute is dynamically updated during the triangulation process.
[0102] The "Angle Upper Bound" attribute is also a floating-point type. For points not on the convex hull, its "Angle Upper Bound" is set to 2π; for points on the convex hull, its "Angle Upper Bound" is set to the degree of the corresponding vertex angle of that point on the convex hull. This attribute can be considered a constant and will not change during the triangulation generation process.
[0103] When the "Cumulative Angle" property of a point object is updated to be equal to its "Upper Angle Boundary" property, it means that the point has been completely surrounded by triangles, and it is impossible for any more triangles containing that point to be constructed and added to the irregular triangular mesh. In this patent, a point that has reached this state is called a "full point". Figure 10 Show.
[0104] S32: Construct edge objects
[0105] The existing edges in the graph (edges on the minimum spanning tree and the convex hull polygon) are constructed as objects, each edge object having a common attribute such as an index and two endpoints (point objects of type (1)). In addition, it also includes the attributes of "triangle count", "triangle upper bound" and "index set to be skipped".
[0106] The "Triangle Count" attribute is an integer representing the number of triangles to which the current edge is contained, initialized to 0. For example, if triangle ABC containing edge AB is constructed during the triangulation process, the "Triangle Count" attribute of edge AB is incremented by 1. This attribute is dynamically updated during the triangulation construction process.
[0107] The "Triangle Upper Bound" attribute is also an integer, representing the maximum number of triangles that the edge can be contained within. For edges not on the convex hull, its "Triangle Upper Bound" is set to 2; for edges on the convex hull, its "Triangle Upper Bound" is set to 1. This attribute can be considered a constant and will not change during the triangulation process.
[0108] When the "triangle count" property of an edge object is updated to be equal to its "triangle upper bound" property, it means that no more triangles containing that edge can be constructed and added to the irregular triangular mesh. This patent refers to an edge that reaches this state as a "full edge". Figure 11 Show.
[0109] The "Skip Index Set" is a list that stores the indices of points that should be skipped by default when constructing a triangle based on the points traversed by this edge. For example, if we are traversing points based on edge AB, points A and B must be skipped; otherwise, invalid triangles will be created. Furthermore, if triangle ABC has already been constructed and added to the triangulation network, point C must also be skipped; otherwise, duplicate triangles will be created in the network.
[0110] S4: Initial construction of an irregular triangular network
[0111] S41: First, set up a set of edge objects, denoted as "existing edge set", and add all the edge objects constructed in S32 to it to complete the initialization of "existing edge set".
[0112] Next, set two pointer variables, denoted as "current pointer" and "end pointer". The "current pointer" always points to the edge being processed in the "existing edge set", initially pointing to the first edge in the set; the "end pointer" always points to the most recently added edge in the "existing edge set", initially pointing to the last edge in the set. Simultaneously, initialize the "irregular triangular mesh" object to null.
[0113] S42: Iterative Construction of Irregular Triangular Networks
[0114] We begin traversing the edges in the "existing edge set," taking the edge pointed to by the "current pointer" as the object of study, and denoting it as the "current edge." Let the two endpoints of the "current edge" be P1 and P2. First, we check whether the state of edge P1P2 is "full edge." If it is, we skip edge P1P2 directly; otherwise, we begin traversing the points in the graph.
[0115] Let the current point be P3. Check whether the index of P3 is in the "skip index set" of edge P1P2 and whether the state of P3 is "full point". If neither is true, check whether points P1, P2 and P3 simultaneously meet the following three conditions. Otherwise, skip P3 directly.
[0116] Condition 1: Edge P1P3 does not intersect with any edge in the "existing edge set";
[0117] Condition 2: Edge P2P3 does not intersect with any edge in the "existing edge set";
[0118] Condition 3: All points in the scatter set except P1, P2, and P3 are not in the circumcircle of triangle P1P2P3.
[0119] Conditions 1 and 2 require the detection of intersections of straight segments. This patent uses a "double-span" detection method, the process of which is as follows:
[0120] Generate line segment AB from two points A and B on the plane, and generate line CD from two other points C and D. and If the signs of the positive and negative signs are opposite, then points A and B are located on opposite sides of line CD, and line segment AB is said to cross line CD; otherwise, points A and B are located on the same side, and line segment AB does not cross line CD. Furthermore, if it is found that line segment AB crosses line CD and line segment CD crosses line AB, then line segment AB intersects line segment CD; otherwise, they do not intersect.
[0121] Condition 3 requires the rapid calculation of the circumcenter of the triangle. The method is as follows:
[0122] First, given three non-collinear points on the plane: Construct the following four vectors: Then, the following three matrices are constructed: ,but The coordinates of the circumcenter O are: .
[0123] The logic flow for judging the above three conditions is shown in Figure 12 .
[0124] If all three conditions above are met, triangle P1P2P3 is added to the irregular triangular mesh, and the following procedure is executed:
[0125] First, add the degree of the vertex angle P1 in triangle P1P2P3 to the "Cumulative Angle" attribute of point P1. Similarly, add the degree of the vertex angle P2 and the vertex angle P3 to the "Cumulative Angle" attribute of points P2 and P3 respectively.
[0126] Next, check if edge P1P3 already exists in the "existing edge set". If it does not exist, set its "triangle count" attribute to 1, add the index of P2 to its "skip index set", and then add it to the "existing edge set". If it exists, access the existing edge, increment its "triangle count" attribute by 1, add the index of P2 to its "skip index set", and the processing flow for P2P3 is similar to that for P1P3, so it will not be described again.
[0127] Finally, increment the "triangle count" attribute of edge P1P2 by 1. Add the index of P3 to the "skip index set" of edge P1P2, and then check whether the state of edge P1P2 has changed to "full edge". If so, truncate the traversal of subsequent points; otherwise, continue.
[0128] Each time a new edge is added to the "existing edge set", the "end pointer" moves one position to the right. When all points have been traversed or the traversal is truncated, the "current pointer" moves one position to the right and begins generating triangles based on the next edge.
[0129] Figure 13 This is a visualization of the changes in the "current pointer" and "last pointer." The horizontal axis represents the number of iterations, and the vertical axis represents the pointer variable values. It can be seen that the "current pointer" moves backward at a constant speed throughout the entire iteration process (i.e., it moves one position backward in each iteration), while the "last pointer" moves backward significantly faster than the "current pointer" in the initial stage of the iteration. However, after a certain iteration, its speed slows down significantly and it is eventually caught up by the "current pointer." Once the two pointers meet, it indicates that the edges in the "existing edge set" have been processed. Accordingly, the irregular triangular network corresponding to this scatter plot is initially generated. Figure 14 This is a schematic diagram of the above process.
[0130] Figure 15 This is a visualization example of the process of changing the number of "full points". The horizontal axis represents the number of iterations, and the vertical axis represents the number of points that reached the "full point" state in the graph. Figure 16This is a visualization example of the changing number of "full edges". The horizontal axis represents the number of iterations, and the vertical axis represents the number of edges in the graph that have reached the "full edge" state. As the iterations proceed, the triangular mesh gradually grows, and the number of "full vertices" and "full edges" both increase steadily. According to the above discussion, "full vertices" and "full edges" must be skipped directly during the traversal. It can be seen that as the triangular mesh grows, more and more vertices and edges can be skipped directly, and correspondingly, the growth efficiency of the triangular mesh becomes faster and faster.
[0131] S5: Patch irregular triangular mesh vulnerabilities
[0132] The irregular triangular network constructed by S4 may contain some vulnerabilities. To ensure its topological correctness, these vulnerabilities need to be patched based on the principle of "maximizing the minimum angle". The operation process is as follows:
[0133] Reset the "current pointer" in S4 so that it points to the first edge in the "existing edge set" again. Traverse the edges in the "existing edge set" and denote the two endpoints of the current edge as P1 and P2. First, check if the state of edge P1P2 is "full edge". If it is, then edge P1P2 is definitely not on the edge of the vulnerability area and is skipped directly. Otherwise, initialize the "target triangle" to empty and initialize the "maximum and minimum interior angles" to negative infinity, and start traversing the points in the graph.
[0134] Let the current point be P3. Check whether the index of P3 is in the "skip index set" of edge P1P2 and whether the state of P3 is "full point". If neither is true, check whether points P1, P2 and P3 simultaneously satisfy conditions 1 and 2 proposed in S4. If so, construct triangle P1P2P3 and calculate its minimum interior angle, which is denoted as "current minimum interior angle". If "current minimum interior angle" is greater than "maximum minimum interior angle", update "maximum minimum interior angle" to "current minimum interior angle" and update "target triangle" to triangle P1P2P3.
[0135] After completing the traversal of points, check if the "target triangle" is still empty. If not, record the "target triangle" as triangle P1P2Q, add it to the irregular triangular mesh, and simultaneously execute the following procedures:
[0136] First, add the degree of the vertex angle P1 in triangle P1P2Q to the "Cumulative Angle" attribute of point P1. Similarly, add the degree of the vertex angle P2 and the vertex angle Q to the "Cumulative Angle" attribute of points P2 and Q respectively.
[0137] Next, check if edge P1Q already exists in the "existing edge set". If it does not exist, set its "triangle count" attribute to 1, add the index of P2 to its "skip index set", and then add it to the "existing edge set". If it exists, access the existing edge, increment its "triangle count" attribute by 1, and add the index of P2 to its "skip index set". The processing flow for edge P2Q is similar to that for edge P1Q, and will not be described again.
[0138] Finally, increment the "triangle count" attribute of edge P1P2 by 1, add the index of Q to the "skip index set" of edge P1P2, and then check whether the state of edge P1P2 has changed to "full edge". If so, truncate the traversal of subsequent points; otherwise, continue.
[0139] The above process is repeated iteratively until all edges have been traversed. Accordingly, the holes in the irregular triangular mesh have been repaired, and its topological correctness is guaranteed. Figure 17 This is a schematic diagram of the above process.
[0140] Although this step requires traversing the points and edges again, since most points and edges in S4 have already reached the state of "full point" and "full edge", it can be skipped directly. Therefore, the time consumption is minimal and it will not have a significant negative impact on the overall efficiency of the algorithm.
[0141] After all the above steps, this invention can be used to construct irregular triangular networks based on an input scatter set. Figure 18 This is an example of an irregular triangular network generated by this algorithm. It can be seen intuitively that the irregular triangular network does not have topological errors (self-intersection or holes), and most of the triangles in the central region are close to equilateral triangles in shape, with almost no elongated triangles. It is evident that the irregular triangular network generated by this algorithm has high quality.
Claims
1. A method for constructing a TIN network based on a spatial minimum spanning tree and a convex hull polygon, characterized in that: The steps are as follows: S1: Construct the minimum spanning tree in space: A complete graph is constructed from a set of scattered points with horizontal and vertical coordinates in a plane. By default, any two points in the complete graph are connected by an edge, and the weight of the edge is the Euclidean distance between the two points. The distance between a point and a set of points is defined as the minimum Euclidean distance between the point and all points in the set, and the corresponding point is the feature point of that point with respect to the set of points; the distance between two sets of points is defined as the minimum Euclidean distance between all pairs of points in the two sets, and the corresponding pair of points is the feature point pair of the two sets. Initialize the "selected set", "unselected set", "distance array" and "index array", randomly select an initial point to add to the "selected set", and assign the remaining points to the "unselected set". The "distance array" stores the Euclidean distance from each point in the "unselected set" to the initial point. The "index array" is filled with the initial feature indices. The minimum spanning tree is initialized to empty. Iteratively expand the minimum spanning tree. S2: Construct a convex hull polygon: Traverse the scatter set and select the point with the smallest ordinate as the reference point; sort the points according to their azimuth angles with respect to the reference point, and place the reference point at the end of the sorting result to obtain a reordered scatter set. The azimuth angle is defined as the angle from the horizontal rightward reference direction, rotated counterclockwise until the reference point points to the direction of the point to be measured. Initialize the "current index" to 0, and initialize the convex hull polygon to the first point of the reordered scatter set; traverse the vertices after the "current vertex", select the target successor vertex with the smallest azimuth angle with respect to the "current vertex", add it to the convex hull polygon and update the "current index", repeat until the "current index" points to the end point of the reordered scatter set, and the construction is complete; S3: Construct point and edge objects; S4: Initial construction of an irregular triangular network; S5: Repair irregular triangular meshes based on the principle of "maximizing the minimum angle".
2. The TIN network construction method based on spatial minimum spanning tree and convex hull polygon according to claim 1, characterized in that: The steps for defining the distance between a point and a set of points in S1 are as follows: For a point Hedianji , ,make have ,but Accordingly, it is called For point About point sets The feature index, called For point About point sets Feature points; The steps to define the distance between two point sets are as follows: For point set... and , , ,make and ,have ,but Accordingly, ordered pairs are called ordered pairs. For ordered point sets Feature index pairs are called ordered point pairs. For ordered point sets Feature point pairs.
3. The TIN network construction method based on spatial minimum spanning tree and convex hull polygon according to claim 2, characterized in that: The iterative expansion of the minimum spanning tree in S1 is as follows: In each iteration, the "nearest distance" is initially set to positive infinity and the "target index" is initially empty; all points in the "unselected set" are traversed, and the Euclidean distance between the current point and the newly added point in the "selected set" in the previous round is calculated (denoted as the current distance). If the current distance is less than the existing distance from the point to the "selected set", the "distance array" and "index array" are updated; if the distance from the point to the "selected set" is less than the "nearest distance", the "nearest distance" and "target index" are updated; after traversal, the point P in the "unselected set" and the feature point Q in the "selected set" are obtained through the "target index", the edge PQ is added to the minimum spanning tree, P is moved from the "unselected set" to the "selected set", and the record corresponding to P in the "index array" and "distance array" is removed; the iteration is repeated until the "unselected set" is empty, and the minimum spanning tree is constructed. The construction process does not require the prior construction of the adjacency matrix.
4. The TIN network construction method based on spatial minimum spanning tree and convex hull polygon according to claim 1, characterized in that: The method for constructing the S3 midpoint object is as follows: All points in the graph are constructed as objects. Each point object contains an index, x and y coordinates, elevation, "cumulative angle", and "upper bound angle" attributes. The "cumulative angle" is a floating-point number, initialized to 0.0, and incremented by the radian value of the vertex angle of the point in the triangle when a triangle is constructed. The "upper bound angle" is a floating-point number. Points on the convex hull are set to the radian value of the vertex angle of the point on the convex hull, and points not on the convex hull are set to 2π. When the "cumulative angle" equals the "upper bound angle", the point is a "full point" and will no longer participate in the construction of new triangles.
5. The TIN network construction method based on spatial minimum spanning tree and convex hull polygon according to claim 4, characterized in that: The method for constructing edge objects in S3 is as follows: The edges on the minimum spanning tree and the convex hull polygon are constructed as edge objects. Each edge object contains an index, two endpoints (point objects), a "triangle count", a "triangle upper bound", and a "set of skipped indices". The "triangle count" is an integer, initialized to 0, and incremented by 1 when constructing a triangle containing that edge. The "triangle upper bound" is an integer, set to 1 for edges on the convex hull and 2 for edges on the non-convex hull. When the "triangle count" equals the "triangle upper bound", the edge is a "full edge" and will not participate in the construction of a new triangle. The "set of skipped indices" is a list that stores the indices of points to be skipped when constructing a triangle based on that edge.
6. The TIN network construction method based on spatial minimum spanning tree and convex hull polygon according to claim 5, characterized in that: The method for constructing the irregular triangular mesh in S4 is as follows: First, add the edge objects obtained in S3 to the "existing edge set"; set the "current pointer" to initially point to the first edge of the "existing edge set", and the "end pointer" to initially point to the last edge of the "existing edge set", and initialize the irregular triangular mesh to empty; Start traversing the edges in the "existing edge set", taking the edge pointed to by the "current pointer" as the research object, and denoting it as the "current edge"; let the two endpoints of the "current edge" be P1 and P2; first check whether the state of edge P1P2 is "full edge", if so, skip edge P1P2 directly, otherwise start traversing the points in the graph; Let the current point be P3. Check whether the index of P3 is in the "skip index set" of edge P1P2 and whether the state of P3 is "full point". If neither is true, check whether points P1, P2 and P3 simultaneously meet the following three conditions. Otherwise, skip P3 directly. Condition 1: Edge P1P3 does not intersect with any edge in the "existing edge set"; Condition 2: Edge P2P3 does not intersect with any edge in the "existing edge set"; Condition 3: All points in the scatter set except P1, P2, and P3 are not in the circumcircle of triangle P1P2P3; Conditions 1 and 2 require the detection of intersections of straight line segments. This patent uses a "double-span" detection method, the process of which is as follows: Generate line segment AB from two points A and B on the plane, and generate line CD from two other points C and D. and If the signs of positive and negative signals are opposite, then points A and B are located on opposite sides of line CD, and line segment AB is said to straddle line CD. Conversely, if points A and B are on the same side, it is said that line segment AB does not cross line CD; furthermore, if it is found that line segment AB crosses line CD and line segment CD crosses line AB, then line segment AB intersects line segment CD, otherwise they do not intersect. Condition 3 requires the rapid calculation of the circumcenter of the triangle. The method is as follows: First, given three non-collinear points on the plane: Construct the following four vectors: Then, the following three matrices are constructed: ,but The coordinates of the circumcenter O are: ; If all three conditions above are met, triangle P1P2P3 is added to the irregular triangular mesh, and the following procedure is executed: First, add the degree of the vertex angle P1 in triangle P1P2P3 to the "Cumulative Angle" attribute of point P1. Similarly, add the degree of the vertex angle P2 and the vertex angle P3 to the "Cumulative Angle" attribute of points P2 and P3 respectively. Next, check if edge P1P3 already exists in the "existing edge set"; if it does not exist, set its "triangle count" attribute to 1, add the index of P2 to its "skip index set", and then add it to the "existing edge set"; if it exists, access the existing edge, increment its "triangle count" attribute by 1, add the index of P2 to its "skip index set", and the processing flow of P2P3 is similar to that of P1P3, so it will not be described again. Finally, increment the "triangle count" attribute of edge P1P2 by 1; add the index of P3 to the "skip index set" of edge P1P2, and then check whether the state of edge P1P2 has changed to "full edge". If so, truncate the traversal of subsequent points; otherwise, continue. Each time a new edge is added to the "existing edge set", the "end pointer" moves one position to the right. When all points have been traversed or the traversal is truncated, the "current pointer" moves one position to the right and begins generating triangles based on the next edge. Once the "current pointer" meets the "end pointer", it means that the edges in the "existing edge set" have been processed. Accordingly, the irregular triangular network corresponding to the scattered point set is initially generated.
7. The TIN network construction method based on spatial minimum spanning tree and convex hull polygon according to claim 6, characterized in that: The steps in S5 are as follows: Reset the "current pointer" in step four so that it points to the first edge in the "existing edge set" again; traverse the edges in the "existing edge set" and record the two endpoints of the current edge as P1 and P2; first check if the state of edge P1P2 is "full edge". If so, edge P1P2 must not be on the edge of the vulnerability area and is skipped directly. Otherwise, initialize the "target triangle" to empty and initialize the "maximum and minimum interior angles" to negative infinity, and start traversing the points in the graph. Let the current point be P3. Check if the index of P3 is in the "skip index set" of edge P1P2 and if the state of P3 is "full point". If neither is true, check if points P1, P2 and P3 simultaneously satisfy conditions 1 and 2 proposed in step 4. If so, construct triangle P1P2P3 and calculate its minimum interior angle, denoted as "current minimum interior angle". If "current minimum interior angle" is greater than "maximum minimum interior angle", update "maximum minimum interior angle" to "current minimum interior angle" and update "target triangle" to triangle P1P2P3. After completing the traversal of points, check if the "target triangle" is still empty. If not, record the "target triangle" as triangle P1P2Q, add it to the irregular triangular mesh, and simultaneously execute the following procedures: First, add the degree of the vertex angle P1 in triangle P1P2Q to the "Cumulative Angle" attribute of point P1. Similarly, add the degree of the vertex angle P2 and the vertex angle Q to the "Cumulative Angle" attribute of points P2 and Q respectively. Next, check if edge P1Q already exists in the "existing edge set". If it does not exist, set its "triangle count" attribute to 1, add the index of P2 to its "skip index set", and then add it to the "existing edge set". If it exists, access the existing edge, increment its "triangle count" attribute by 1, and add the index of P2 to its "skip index set". The processing flow for edge P2Q is similar to that for edge P1Q and will not be described again. Finally, increment the "triangle count" attribute of edge P1P2 by 1, add the index of Q to the "skip index set" of edge P1P2, and then check whether the state of edge P1P2 has changed to "full edge". If so, truncate the traversal of subsequent points; otherwise, continue. The above process is iterated until all edges have been traversed; accordingly, the holes in the irregular triangular mesh have been repaired, and its topological correctness is guaranteed. After all the above steps, the present invention can be used to construct an irregular triangular network based on the input scatter set, and the generated result has no topological errors and has an excellent overall shape.