A super-efficient terrain construction method
By preprocessing the earth and stone modeling algorithm and building a triangular network, the problem of inefficient terrain construction in the existing technology is solved, and efficient earth and stone model construction is achieved.
Patent Information
- Application Number
- CN202110827034.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-21
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2041-07-21
AI Technical Summary
The existing earth and stone modeling algorithm has low network construction efficiency, resulting in low terrain construction efficiency.
By obtaining the original coordinate point data of the terrain for preprocessing, the initial line is constructed and the triangle network is constructed cycleically, the triangle data collection is generated and the earth and stone model is rendered.
Significantly reduce the amount of computing, improve construction efficiency, shorten construction time, and achieve simplicity and efficiency.
Smart Images

Figure CN113554751B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of geographic information technology, and particularly relates to an ultra-efficient terrain construction method. Background Art
[0002] The Geographic Information System (GIS) describes and expresses the geographical world through digital technology, leading to a great transformation in geographical theories and methods. Earthwork modeling is an extremely important function in GIS. Its role is to connect three-dimensional discrete coordinate points to generate a terrain three-dimensional grid model through a specific algorithm. Only when the earthwork model is generated can the terrain be browsed and subsequent operations be carried out. The algorithm is the "soul" of the software, and a good algorithm should meet the characteristics of simplicity and efficiency. In recent years, with the development of the integrated application of BIM+GIS, the functions in GIS can also play an important role in BIM. For example, earthwork modeling has important applications such as earthwork quantity calculation, earthwork allocation, and site planning in BIM.
[0003] Foreign earthwork modeling software started very early and there are many types. Among them, the relatively famous one is Civil 3D launched by AutoDesk. This software can generate a terrain surface by importing elevation point XYZ coordinate data and constructing a network by itself. The advantages of this software are high efficiency and three-dimensional browsing, but the disadvantages are that the software volume is huge (taking Civil 3D 2020 as an example, the software installation package size is more than 3GB), there are many functions but it is a bit bloated, and the functions cannot be customized.
[0004] Due to the late start of domestic engineering software and the fact that domestic engineering software is basically monopolized by foreign software companies, the development of domestic earthwork modeling software has been slow. Domestic earthwork modeling software often appears in the form of plugins. For example, the famous "Southern CASS" is a domestic plugin for AutoCAD. The operation method of this plugin is similar to that of Civil 3D. It also generates a terrain surface after importing elevation point XYZ data. However, this plugin is relatively poor in three-dimensional browsing.
[0005] In the past decade, due to the monopoly and intervention of foreign engineering software companies, the development of domestic engineering software has been frustrated. To break the foreign technology monopoly and actively respond to the country's call for "domestication of engineering software" and make up for the shortfalls of such engineering software, it is urgent to develop software that meets the needs of China's engineering construction industry.
[0006] Earthwork modeling is widely used in engineering construction. For example: scheme design, site layout, road planning, earthwork quantity calculation, slope design, field drainage design, etc. To meet the needs of various projects, it is urgent to develop earthwork modeling software with high performance. Since developing software must first study the algorithm, researching high-performance earthwork modeling algorithms is of great significance. Summary of the Invention
[0007] The technical problem to be solved by the present invention is the technical problem that the existing earthwork modeling algorithm has low network construction efficiency, resulting in low terrain construction efficiency. The purpose is to provide a super-efficient terrain construction method to solve the above problems.
[0008] The present invention is realized through the following technical solutions:
[0009] A super-efficient terrain construction method includes the following steps:
[0010] S1: Obtain the original terrain coordinate point data, and preprocess the original terrain coordinate point data to obtain the processed terrain coordinate point data;
[0011] S2: Obtain a terrain coordinate point set based on the processed terrain coordinate point data;
[0012] S3: Construct an initial line based on the terrain coordinate point set, and circularly construct a triangular mesh according to the terrain coordinate point set and the initial line to obtain a triangular data set;
[0013] S4: Render the obtained triangular data set to obtain an earthwork model.
[0014] Further, in step S1, the specific operation of preprocessing the original terrain coordinate point data to obtain the processed terrain coordinate point data is as follows: de-duplicate and screen the original terrain coordinate point data, then sort the de-duplicated and screened coordinate point data in ascending order, number the coordinate points in the sorted order after sorting, and finally output each coordinate point in the format of number, X, Y, Z to the coordinate data text. The data in the coordinate data text is the processed terrain coordinate point data.
[0015] Further, in step S2, the specific operation of obtaining a terrain coordinate point set based on the processed terrain coordinate point data is as follows: read each line of coordinate data in the coordinate data text, split each line of data into number, X, Y, Z after obtaining it, and store through these data to obtain a terrain coordinate point. Loop in sequence until all terrain coordinate points are input into the terrain coordinate point set.
[0016] Further, the super-efficient terrain construction method further includes initializing a line set and a triangle set; the line set is used to store the straight lines generated during the calculation process; the triangle set is used to store the newly generated triangles.
[0017] Further, step S3 specifically includes:
[0018] S31: Combine the first point p1 in the terrain coordinate point set with the point p2 closest to the first point to form the first straight line, and the first straight line is the straight line l0;
[0019] S32: Extract the straight line l0 from the set of lines, then traverse the set of terrain coordinate points, continuously record the magnitudes of the interior angles corresponding to the terrain coordinate points in the triangles formed by the straight line l0 and the terrain coordinate points. After the traversal, obtain the point p0 that can form the largest interior angle. Connect the two points p1 and p2 of the straight line l0 to the point p0 respectively to obtain the straight lines l1 and l2, and store the straight lines l1 and l2 in the set of lines;
[0020] S33: Conduct intersection and duplication tests on the straight line l0, the straight line l1, and the straight line l2:
[0021] If the test passes, generate a triangle and store the triangle in the set of triangles; then remove the lines that have been used from the set of lines and add the newly added lines. Then, determine whether the number of lines in the set of lines is zero. If it is not zero, return to step S32; if it is zero, execute step S4;
[0022] If the test fails, remove the lines from the set of lines and add the newly added lines; then determine whether the number of lines in the set of lines is zero. If it is not zero, return to step S32; if it is zero, execute step S4.
[0023] Furthermore, in step S32, it also includes: when traversing the set of terrain coordinate points, narrow the search range of the terrain coordinate points, and the search range is limited to 1.5 to 2 times the average point distance. Since each loop calculation requires traversing and calculating the set of terrain coordinate points, if the search range is not controlled, the calculation speed will decrease significantly as the number of coordinate points increases. Therefore, it is necessary to control the calculation amount by restricting the search range to achieve performance optimization.
[0024] Furthermore, in step S4, the rendering the obtained triangle data set to obtain an earthwork model specifically is: rendering the obtained triangle data set through the DirectX framework or the OpenGL framework to obtain an earthwork model.
[0025] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0026] An ultra-high-efficiency terrain construction method provided by the present invention can significantly reduce the amount of calculation, thereby improving the construction efficiency, greatly shortening the construction time, and realizing the characteristics of simplicity and high efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings required for the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings. In the drawings:
[0028] Figure 1 is the development flowchart;
[0029] Figure 2 is the coordinate point processing flowchart;
[0030] Figure 3 is the network construction flowchart;
[0031] Figure 4 is the schematic diagram of the triangle construction process;
[0032] Figure 5 is the terrain model created by the method of the present invention;
[0033] Figure 6 is the terrain model created by Civil 3D (with Figure 5 the same coordinate points as the terrain model created by the method of the present invention).
[0034] Figure 7 is the time comparison chart before optimization using C# as the programming language;
[0035] Figure 8 is the time comparison chart after optimization using C# as the programming language;
[0036] Figure 9 is the time comparison chart after optimization using C++ as the programming language;
[0037] Figure 10 is the time comparison chart before and after optimization. Specific embodiments
[0038] To make the purpose, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with the embodiments and the accompanying drawings. The illustrative embodiments of the present invention and their descriptions are only used to explain the present invention and are not intended to limit the present invention.
[0039] Embodiment
[0040] The software development platform selects Visual Studio 2019 (the latest version). To improve the development efficiency and compatibility of the software, C# is selected as the programming language for development. C# is a secure, stable, simple, and elegant object-oriented programming language derived from C and C++. While inheriting the powerful features of C and C++, it removes some of their complex features (such as no macros and no multiple inheritance). C# combines the simple visual operations of VB and the high running efficiency of C++. With its powerful operation ability, elegant syntax style, innovative language features, and convenient support for component-oriented programming, it has become the preferred language for.NET development. As Figure 1 shown, Figure 1 it is the development flow chart.
[0041] Since there may be problems such as duplication, errors, and disorder in the original coordinate point data, the coordinate points need to be processed before importing them into the software. As Figure 2 shown, Figure 2 it is the coordinate point processing flow: first, remove duplicates of the coordinate points in Excel, and then use the filtering function in the table to filter out unreasonable elevation points (lower than the actual lowest point or higher than the actual highest point) and delete them. Sort the remaining coordinate points in ascending order, and after sorting, number the coordinate points in sequence. After the coordinate points are processed, output the coordinate points to a text file in the format of number, X, Y, Z for the program to read.
[0042] There are usually two methods for constructing the Delaunay triangulated irregular network (Delaunay-TIN): one is the construction method based on the geometric property "no four points are concyclic"; the other is the generation method derived from the definition of the Voroni diagram. Since the Voronoi diagram algorithm is relatively complex, inefficient, and has a large memory overhead, this method is rarely used nowadays.
[0043] This algorithm is based on the Delaunay triangulation algorithm and is obtained through improvement and optimization. As Figure 3 shown, Figure 3 it is the network construction flow chart.
[0044] Reading coordinate point data: Read each line of coordinate data in the coordinate data text. After obtaining each line of data, split it into number, X, Y, and Z and input them into the original coordinate point set respectively. Loop sequentially until all coordinate points are input into the original point set.
[0045] Initialization of other datasets: The other variables required in the calculation process are mainly the line set and the triangle set. The line set mainly stores the temporary edges generated during the calculation process and is also the basis for determining whether the loop ends. The triangle set is mainly used to store the new triangles generated in each calculation for final output and display.
[0046] Construct the initial line: First, form the first line by connecting the first point in the original point set with the nearest point. At this time, the number of lines in the line set is 1. Use whether the number of the line list is equal to 0 as the judgment condition for the end of the loop operation.
[0047] Loop to construct the triangular mesh: The schematic diagram of the triangle construction process is as Figure 4 shown. In each loop calculation, extract the last element in the line set, that is, line l0, and then traverse the original point set, continuously record the interior angle size corresponding to the point formed by the line and the point. After the traversal ends, obtain the point p0 that can form the largest interior angle, and connect the two points p1 and p2 of the line with the point p0 respectively to get two new edges l1 and l2 and store them in the line set.
[0048] Test the new edges. After all tests pass, generate triangles and store them in the triangle list. Remove the used edges from the new edge list and add the newly added edges, and loop in turn until the number of elements in the new edge list is 0.
[0049] Finally, send the obtained triangle data set to the Directx 11 framework for terrain rendering to obtain the earthwork model.
[0050] The embodiment of the present invention provides a super-efficient terrain construction method, which specifically includes the following steps:
[0051] S1: Obtain the original terrain coordinate point data, remove duplicates and filter the original terrain coordinate point data, then sort the de-duplicated and filtered coordinate point data in ascending order, number the coordinate points in the sorted order after sorting, and finally output each coordinate point in the format of number, X, Y, Z to the coordinate data text. The data in the coordinate data text is the processed terrain coordinate point data;
[0052] S2: Read each line of coordinate data in the coordinate data text, obtain each line of data and split it into number, X, Y, Z, and store a terrain coordinate point through these data. Loop in turn until all terrain coordinate points are input into the terrain coordinate point set;
[0053] S3: Construct the initial line based on the terrain coordinate point set, and loop to construct the triangular mesh according to the terrain coordinate point set and the initial line to obtain the triangle data set;
[0054] S4: Render the obtained triangle data set to obtain an earthwork model.
[0055] The ultra-efficient terrain construction method further includes initializing a line set and a triangle set; the line set is used to store the straight lines generated during the calculation process; the triangle set is used to store the newly generated triangles.
[0056] The specific steps of step S3 include:
[0057] S31: Combine the first point p1 in the terrain coordinate point set with the point p2 closest to the first point to form the first straight line, which is the straight line l0.
[0058] S32: Extract the straight line l0 from the line set, and then traverse the terrain coordinate point set, continuously record the interior angle sizes corresponding to the terrain coordinate points in the triangles formed by the straight line l0 and the terrain coordinate points. After the traversal, obtain the point p0 that can form the largest interior angle. Connect the two points p1 and p2 of the straight line l0 to the point p0 respectively to obtain the straight lines l1 and l2, and store the straight lines l1 and l2 in the line set.
[0059] S33: Perform intersection and duplication tests on the straight lines l0, l1, and l2:
[0060] If the test passes, generate a triangle and store the triangle in the triangle set; then remove the used straight lines from the line set and add the newly added straight lines, and then determine whether the number of straight lines in the line set is zero. If it is not zero, return to step S32; if it is zero, execute step S4.
[0061] If the test fails, remove the straight lines from the line set and add the newly added straight lines; then determine whether the number of straight lines in the line set is zero. If it is not zero, return to step S32; if it is zero, execute step S4.
[0062] In step S32, it also includes: when traversing the terrain coordinate point set, narrow the search range of the terrain coordinate points. In this embodiment, the maximum side length of the search range is set to 100. Since each loop calculation requires traversing and calculating the terrain coordinate point set, if the search range is not controlled, the calculation speed will decrease significantly as the number of coordinate points increases. Therefore, it is necessary to control the calculation amount by restricting the search range to achieve performance optimization.
[0063] In step S4, the specific operation of rendering the obtained triangle data set to obtain an earthwork model is: rendering the obtained triangle data set through the DirectX framework or the OpenGL framework to obtain an earthwork model.
[0064] Terrain Model Display: This time, the earthwork modeling was carried out using the terrain design data of Lishui Airport as the original data. There were a total of 6,611 coordinate points, and the number of triangles in the terrain was 13,106.
[0065] As Figure 5 shown, Figure 5 is the terrain model created by the algorithm of the present invention; Figure 6 is the terrain model created by Civil 3D. By observing Figure 5 and Figure 6 it can be seen that the model obtained by the algorithm of the present invention is consistent with the model created by Civil 3D, thus verifying the correctness of the algorithm of the present invention.
[0066] Performance Test: To ensure the accuracy of the test data, the same number of points was measured 3 times, and the average value was taken as the final result.
[0067] Table 1 Performance test data table before optimization when developed using C# as the programming language
[0068]
[0069] Table 2 Performance test data table after optimization when developed using C# as the programming language
[0070]
[0071] Table 3 Performance test data table after optimization when developed using C++ as the programming language
[0072]
[0073] Table 1 is the performance test data table before optimization when developed using C# as the programming language, Table 2 is the performance test data table after optimization using C#; Table 3 is the performance test data table after optimization using C++.
[0074] As Figures 7 - 9 shown, Figure 7 is the time comparison chart before optimization when using C# as the programming language;
[0075] Figure 8 is the time comparison chart after optimization when using C# as the programming language. After optimization, the performance has increased by about 10 times.
[0076] Figure 9 is the time comparison chart after optimization when using C++ as the programming language. Compared with C#, the performance can be further increased by 10 - 14 times.
[0077] As Figure 10 shown, after algorithm optimization and changing the programming language, the overall performance has increased by 100 times compared to the initial stage, and the construction time is within an acceptable range, and the algorithm optimization has achieved the expected goal.
[0078] The specific embodiments described above further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A super-efficient terrain construction method, characterized in that, It includes the following steps: S1: Obtain the original terrain coordinate point data, and preprocess the original terrain coordinate point data to obtain the processed terrain coordinate point data; S2: Obtain the terrain coordinate point set based on the processed terrain coordinate point data; S3: Construct an initial line based on the terrain coordinate point set, and circularly construct a triangular mesh according to the terrain coordinate point set and the initial line to obtain a triangle set; S4: Render the obtained triangle set to obtain an earthwork model; It also includes initializing a line set and a triangle set; the line set is used to store the straight lines generated during the calculation process; the triangle set is used to store the newly generated triangles; The specific steps of step S3 include: S31: Combine the first point in the terrain coordinate point set with another point closest to the first point to form the first straight line, and add it to the line set; S32: Extract the straight lines in the line set, then traverse the terrain coordinate point set, continuously record the interior angle sizes corresponding to the terrain coordinate points in the triangles formed by the straight line and the terrain coordinate points. After the traversal, obtain the terrain coordinate points that can form the largest interior angle. Connect the two endpoints of the straight line to the terrain coordinate points that form the largest interior angle respectively to obtain two straight lines, and store the two straight lines in the line set; S33: Perform intersection and duplication tests on the three straight lines in the line set. When the test passes, generate a triangle and store the triangle in the triangle set; After the test is completed, delete the used straight lines from the line set and add the newly added straight lines, and then judge whether the number of straight lines in the line set is zero. If it is not zero, return to step S32; if it is zero, execute step S4; In step S32, it also includes: when traversing the terrain coordinate point set, narrow the search range of the terrain coordinate points, and the search range is limited to 1.5 - 2 times the average point distance.
2. The ultra-high efficiency terrain construction method according to claim 1, characterized in that In step S1, the specific operation of preprocessing the original terrain coordinate point data to obtain the processed terrain coordinate point data is: remove duplicates and filter the original terrain coordinate point data, then sort the coordinate point data after removing duplicates and filtering in ascending order. After the sorting is completed, number the coordinate points in the sorted order, and finally output each coordinate point in the format of number, X, Y, Z to the coordinate data text. The data in the coordinate data text is the processed terrain coordinate point data.
3. An ultra - efficient terrain construction method according to claim 2, characterized in that, In step S2, the specific operation of obtaining the terrain coordinate point set based on the processed terrain coordinate point data is: read each line of coordinate data in the coordinate data text, and after obtaining each line of data, split it into number, X, Y, Z and store a terrain coordinate point through these data. Loop in sequence until all terrain coordinate points are input into the terrain coordinate point set.
4. An ultra-efficient terrain construction method according to claim 1, characterized in that, In step S4, the specific operation of rendering the obtained triangle set to obtain an earthwork model is: render the obtained triangle set through the DirectX framework or the OpenGL framework to obtain an earthwork model.