Two-dimensional grid model map loading real-time simplification method based on distance square
Through a method based on distance squares, combined with edge collapse and edge flip operations, the problem of poor grid simplification speed and accuracy in the existing technology is solved, efficient two-dimensional grid model simplification is achieved, and storage space and loading time are reduced. , for GIS and mobile devices.
Patent Information
- Application Number
- CN202410998921.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-10-29
AI Technical Summary
Existing mesh simplification methods have challenges in balancing speed and geometric accuracy. It is difficult to obtain a simplified model with high geometric accuracy in a fast time, resulting in large amounts of data storage and long loading time.
A real-time simplification method for map loading of a two-dimensional grid model based on distance square is adopted. The sum of the squares of the distance from a vertex to surrounding vertices is used as the edge collapse cost. A distance matrix is used to store the distance value. The derivative of the distance function is solved to determine the new vertex and the new vertex is added. Vertices are bound to higher geographic levels, combined with edge collapse and edge flipping operations to ensure that geographic area outlines remain unchanged and improve triangle quality.
It achieves high geometric accuracy and improved triangle quality, while significantly reducing time consumption. It can reduce storage space and loading time in real-time simplified map loading, and is suitable for geographic information systems and mobile devices.
Smart Images

Figure CN118861184A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of grid simplification in computer graphics, and in particular to a real-time simplification method for loading a two-dimensional grid model map based on distance square. Background Art
[0002] Mesh simplification technology is a key research direction in the field of computer graphics and computer-aided design. Two-dimensional mesh simplification technology plays a vital role in improving the efficiency of graphics processing, especially in situations where fast rendering or real-time interaction is required. In two-dimensional digital maps, massive amounts of data need to be efficiently displayed and processed, and meshes are crucial as the carrier of these data. Usually, a mesh model is required to display map details in conjunction with a texture photo. When displaying a zoomed-out map, a relatively coarse mesh model can be used, while when displaying an enlarged map, a fine model is used to display more details. When switching between zooming in and out of different scenes, the existing solution stores models of different levels of detail (LOD) to achieve fast loading and calling, but this will increase the amount of data storage and occupy too much memory. The acquisition of the LOD model is also obtained by simplifying the fine mesh model multiple times. The existing map display solution is limited by the difficulty of obtaining a simplified model with high geometric accuracy in a short time, and can only use LOD models that have been simplified in advance.
[0003] However, current mesh simplification methods still face challenges in balancing speed and accuracy.
[0004] In the prior art;
[0005] Although edge collapse methods such as QEM (Surface simplification using quadric error metrics) can maintain good geometric accuracy in a short time, the polygon quality of the mesh is poor, especially in the two-dimensional boundary area; and although re-meshing methods can generate high-quality triangles, their geometric accuracy is often difficult to surpass QEM, and since such methods usually require iterative calculations, the time cost is significantly increased.
[0006] Therefore, if a mesh simplification method can be developed that can ensure high geometric accuracy and triangle quality while achieving breakthroughs in speed, only fine mesh models need to be stored in the map, and when a rough model is needed, it can be obtained through real-time simplification. This not only reduces storage space, but also saves time loading new models. Summary of the invention
[0007] In order to overcome the defects of the above-mentioned prior art, the purpose of the present invention is to provide a real-time simplification method for two-dimensional grid model map loading based on distance square, which can not only surpass the QEM method in geometric accuracy and significantly improve the triangle quality, but also maintain a low time consumption, thereby ensuring the demand for real-time simplification of map loading.
[0008] In order to achieve the above object, the technical solution adopted by the present invention is:
[0009] A real-time simplification method for loading a two-dimensional grid model map based on distance squares. Vertices correspond to geographic locations, faces correspond to geographic areas, and edges correspond to geographic paths. To ensure that the outline of the geographic area remains unchanged after simplification, the sum of the squares of the distances from the vertex to the surrounding vertices is used as the edge collapse cost, and the distance matrix is used to store these distance values. By solving the linear equation of the derivative of the distance function, the coordinate with the minimum distance to the surrounding vertices is obtained as the new vertex, and the new vertex is bound to a higher geographic level.
[0010] The steps include:
[0011] Step 1: Initialize the distance matrix based on the original grid data:
[0012] Get the vertex and face information of the two-dimensional grid model, traverse each edge of the grid, calculate the straight line equation of each edge, and then traverse each vertex of the grid to initialize the distance matrix vertex by vertex; where vertices correspond to geographic locations, faces correspond to geographic areas, and edges correspond to geographic paths;
[0013] Step 2: Construct edge collapse minimum heap:
[0014] Traverse each geographic path of the grid and calculate the optimal collapse point v of the geographic path new , and calculate v new The sum of the squares of the distances to the neighboring geographic paths is used as the collapse cost, and v new The cost and the starting point of the geographical path are stored in a structure, and these structure instances are stored in a minimum heap H arranged according to cost;
[0015] Step 3: Loop to collapse edges and update vertices:
[0016] Select the edge with the smallest cost from the minimum heap H to collapse. Edge collapse is to move the starting points v0 and v1 of the geographic path to the new geographic location v new , connect all geographic locations in the domain of v0 and v1, delete v1 and all geographic areas that cannot form a triangle, then calculate the collapse cost cost of the geographic path formed by the new geographic location and its neighboring points, and update the minimum heap H; repeat the above until the required simplified geographic area is met;
[0017] Step 4: Edge flipping operation:
[0018] Only the edges of non-boundary geographic paths are flipped, and the final triangles are close to regular triangles. The triangle quality is improved, which will make it easier to match the model with the map photo and reduce the possibility of display distortion.
[0019] Preferably, in step 1, the straight line equation of each geographical path is calculated as follows:
[0020] Assume that the starting points of each geographic path e are v0 and v1 respectively, then the direction vector of edge e is
[0021] S=v1-v0
[0022] Then the normal vector of the geographic path e is
[0023]
[0024] Assume that the equation of the line of geographic path e is ax+bync=0, then
[0025] a=n x
[0026] b=n v
[0027] C=-n·v0
[0028] Abbreviated as
[0029] l = [a, b, c] T .
[0030] Preferably, in step 1, the distance matrix is defined and initialized, assuming v = [v x , v y , 1] T The sum of the squares of the geographical path distances to the neighboring areas is D 2 (v)
[0031]
[0032] Where Q l is the basic distance matrix, edges(v) represents the set of all geographical paths in the neighborhood of point v,
[0033]
[0034] Then the distance matrix
[0035]
[0036] Compute the distance matrix from the equation of the line.
[0037] Preferably, in step 2, the point with the smallest sum of squares of distances to surrounding geographical paths is defined as the optimal collapse point, that is:
[0038] v new = arg min D 2 (v)
[0039] Then v new for The solution.
[0040] Assume that the distance matrix of geographic path e is Q. For the convenience of calculation, the following approximation is made:
[0041]
[0042] Then we can get
[0043]
[0044] To facilitate calculation, homogeneous coordinates are used, and the Q matrix and zero point coordinates are expanded as follows:
[0045]
[0046] If Q is reversible, then we can obtain
[0047] v new =Q -1 [0,0,1] T
[0048] If Q is irreversible, we can let v new Take the midpoint of side e, that is
[0049]
[0050] At the same time, it can be obtained
[0051]
[0052] v new and cost are stored in the minimum heap H for use in the simplification process.
[0053] Preferably, the boundary preservation method is very important for simplification of two-dimensional meshes. The boundary directly determines the shape and outline of the model. Of course, the boundary cannot be directly fixed and not simplified. This approach will make the boundary triangles dense and narrow.
[0054] The present invention introduces a penalty weight ω when initializing the straight line equation of the geographic path e, which is as follows:
[0055] If e is a boundary, then
[0056] l=ω*[a,b,c] T
[0057] This will increase Q, which in turn increases cost, and the boundaries will be better preserved during simplification.
[0058] Preferably, the edge flipping operation in step 4;
[0059] Triangle quality is also an important evaluation indicator for 2D mesh simplification. In order to improve triangle quality, the mesh is edge-flipped when simplification is completed.
[0060] Specific operation: Compare the lengths of the two edges before and after the edge flipping. If the length of the edge after flipping is less than the length of the edge before flipping, perform the edge flipping operation.
[0061] The method is used in a geographic information system and can realize real-time simplification of the model, thereby reducing map memory usage and improving map loading speed.
[0062] Beneficial effects of the present invention:
[0063] The two-dimensional mesh simplification of the present invention has high geometric accuracy, fast simplification speed, good versatility, and at the same time, the triangle quality is effectively guaranteed; the point with the smallest sum of square distances to surrounding edges is used as the collapse point, so that the contour around the collapse point is preserved, the model features are well preserved, and the geometric accuracy is high; the edge flipping operation is performed on non-boundary edges, which reduces the occurrence of narrow and long triangles and improves the triangle quality. At the same time, it is dozens of times faster than the iterative re-gridding method.
[0064] In digital maps, the model can be simplified in real time, which reduces the map memory usage and improves the map loading speed. When using mobile devices to obtain map information, it can also reduce the situation where the map loading is very slow due to slow mobile network. At the same time, because this method takes up less computing resources, it can be effectively installed in mobile or embedded devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 Flowchart of the simplified method for mesh projection.
[0066] Figure 2 Schematic diagram of edge collapse operation.
[0067] Figure 3 Schematic diagram of edge flipping operation.
[0068] Figure 4 This is the simplified result of the duck model. (The top is the visual effect comparison between the input model and the simplified model, and the bottom is the triangle quality comparison between the input model and the simplified model).
[0069] Figure 5This is the simplified result of the squirrel model. (The top is the visual effect comparison between the input model and the simplified model, and the bottom is the triangle quality comparison between the input model and the simplified model).
[0070] Figure 6 This is the simplified result of the insect model. (The top is the visual effect comparison between the input model and the simplified model, and the bottom is the triangle quality comparison between the input model and the simplified model).
[0071] Figure 7 This is the simplified result of the butterfly model. (The top is the visual effect comparison between the input model and the simplified model, and the bottom is the triangle quality comparison between the input model and the simplified model).
[0072] Figure 8 The simplified result of the XJTU model. (The top is the visual effect comparison between the input model and the simplified model, and the bottom is the triangle quality comparison between the input model and the simplified model). DETAILED DESCRIPTION
[0073] The present invention is further described in detail below in conjunction with embodiments.
[0074] The present invention provides a real-time simplification method for loading a two-dimensional grid model map based on distance square, and the specific implementation flowchart is as follows: Figure 1 As shown, the steps are as follows:
[0075] Step 1: Initialize the distance matrix;
[0076] Step 2: Construct edge collapse minimum heap;
[0077] Step 3: collapse loop edges and update vertices;
[0078] Step 4: Flip the edge.
[0079] The specific implementation steps of step 1 are:
[0080] First, the geographical location and geographical area information of the two-dimensional grid model are obtained, each edge of the grid is traversed, and the straight line equation of the geographical path is calculated.
[0081] This step finds the equation of the line to calculate the distance matrix.
[0082] The calculation method of the straight line equation of the geographical path is as follows:
[0083] Assume that the starting points of geographic path e are v0 and v1 respectively, then the direction vector of geographic path e is
[0084] S=v1-v0
[0085] Then the normal vector of the geographic path e is
[0086]
[0087] Let the equation of the line be ax+by+c=0, then
[0088] a=n x
[0089] b=n y
[0090] c=-n·v0
[0091] l=[a,b,c] T
[0092] At the same time, check whether e is a boundary. If e is a boundary, then let
[0093] l=ω*[a,b,c] T
[0094] Then traverse each geographic location of the grid and calculate the distance matrix Q for each geographic location v ,
[0095]
[0096] The specific implementation steps of step 2 are:
[0097] First, traverse each geographical path of the grid and calculate the candidate collapse point v new And the corresponding cost; this step is used to build a minimum heap for simplification.
[0098] The specific calculation method is as follows:
[0099] Assume that the two endpoints of geographic path e are v0 and v1, then the distance matrix Q
[0100]
[0101] To facilitate calculation, homogeneous coordinates are used, and the Q matrix and zero point coordinates are expanded as follows:
[0102]
[0103] If Q is reversible, then we can obtain
[0104] v new =Q -1 [0,0,1] T
[0105] If Q is irreversible, we can let v new Take the midpoint of the geographic path e, that is
[0106]
[0107] At the same time, it can be obtained
[0108]
[0109] Finally, v new The cost and the starting point of the edge are stored in a structure struct, and then the struct is stored in a minimum heap H arranged by cost.
[0110] The specific implementation steps of step 3 are:
[0111] After obtaining the minimum heap H of the collapsed geographic path in step 2, select the geographic path with the minimum cost from the minimum heap to collapse, update the vertex coordinates and their neighborhood connection relationship, calculate the collapsed minimum heap of the edge composed of the new geographic location and its neighborhood points, and update the minimum heap; repeat the above until the required simplified geographic area is met. This step is the core step of simplification, deleting vertices and faces, reducing the number of triangles, and achieving lightweight model.
[0112] The specific method is:
[0113] First, select the edge with the smallest cost from the minimum heap and determine whether the geographical path has collapsed. If not, execute the following Figure 2 The edge collapse operation shown is to move the starting points v0 and v1 of the edge to the new geographical location v new , connect all geographical locations in the domain of v0 and v1, delete v1 and all faces that cannot form a triangle. new As the new geographic location, and set both geographic locations of the edge to the deleted state. Then traverse the points in the 1-ring neighborhood of the new geographic location and calculate the differences between these points and v new The distance matrix formed is used to calculate the new v using the method in step 2 new And cost, update the minimum heap. Each edge collapse operation will delete two faces, and exit the loop when the number of deleted faces meets the requirement.
[0114] The specific implementation steps of step 4 are:
[0115] The simplified grid obtained in step 3 is Figure 3 The edge flipping operation is shown, however, it does not necessarily mean that the quality of the triangle will be improved after the edge flipping. Therefore, it is necessary to determine whether the edge flipping operation is beneficial before performing the edge flipping.
[0116] Flipping the boundary edges will affect the model feature contour, so only non-boundary edges are flipped to reduce the appearance of narrow triangles and improve triangle quality.
[0117] First, traverse each geographic path of the grid and compare the lengths of the two sides before and after the geographic path is flipped. If the length of the side after flipping is less than the length of the side before flipping, it means that the operation is beneficial and the edge flipping operation can be performed. This is because if the side length becomes smaller after the edge is flipped, the probability of the appearance of obtuse triangles will be reduced, making most triangles close to regular triangles.
[0118] The size of a mesh model file is directly related to its number of vertices and faces. Mesh simplification can significantly reduce the number of vertices and faces of the model, thereby reducing the file size and achieving lightweight storage of the mesh model. In a two-dimensional map, using this method can significantly reduce the number of triangles to be processed for rendering, reduce display memory usage, and speed up map loading.
[0119] In addition, if Figure 4 , 5 , 7 and 8 show the test results of the method of the present invention in multiple models. From the figures, it can be seen that the triangle quality of the method of the present invention is high, and the boundary and model detail features are kept intact.
[0120] Figure 4 This is the result of simplifying the duck model from 4.5k faces to 2k faces. It can be seen that the model boundary is well preserved. From the statistical histogram of the model triangle angle, it can be seen that the simplified triangles are mostly equilateral triangles.
[0121] Figure 5 The squirrel model is simplified by 71.8%, and the file size is compressed from 260kb to 71kb, but the model details are well preserved, and this only takes 0.013s.
[0122] Figure 6 This is a simplified result of the insect model. It can be seen that the antennae of the insect are also well preserved, which fully demonstrates the shape-preserving ability of the method of the present invention.
[0123] Figure 7 This is the simplified result of the butterfly model, which shows that the method of the present invention can also achieve good results in simplification of the fragmentation model.
[0124] Figure 8 This is the simplified result of the XJTU model. This case fully demonstrates the versatility and robustness of the method of the present invention. When the input model has internal boundaries and the directions of the normal vectors of the triangle faces are inconsistent, a good simplification effect can still be achieved.
[0125] The following table shows the performance of the method of the present invention in terms of geometric error and simplification time in these test models, where the geometric error comparison indicators include chamfer distance (CD) and Hausdorff distance (HD). It can be seen that the method of the present invention obtains excellent simplification results in a very short time.
[0126] Table 1 Model test performance of the method of the present invention
[0127]
[0128] The method of the present invention can realize the rapid lightweighting of two-dimensional models, reduce the computing resource usage, speed up the model rendering speed, and facilitate real-time user interaction. In geographic information systems, it can effectively reduce the map memory usage and increase the map loading speed. In terms of the digitization of games and artworks, it can effectively improve the user experience.
Claims
1. A real-time simplification method for two-dimensional grid model map loading based on distance square, It is characterized in that The steps include: Step 1: Initialize the distance matrix based on the original grid data: Get the vertex and face information of the two-dimensional grid model, traverse each edge of the grid, calculate the straight line equation of each edge, and then traverse each vertex of the grid to initialize the distance matrix vertex by vertex; where vertices correspond to geographic locations, faces correspond to geographic areas, and edges correspond to geographic paths; Step 2: Construct edge collapse minimum heap: Traverse each geographic path of the grid and calculate the optimal collapse point v of the geographic path new , and calculate v new The sum of the squares of the distances to the neighboring geographic paths is used as the collapse cost, and v new The cost and the starting point of the geographical path are stored in a structure, and the structure is stored in a minimum heap H arranged based on the cost; Step 3: Loop to collapse edges and update vertices: Select the edge with the smallest cost from the minimum heap H to collapse. Edge collapse is to collapse the starting point v of the geographic path 0 and v 1 Move to a new geographic location new , v 0 With v 1 All geographical locations in the field are connected, and v is deleted 1 And all geographical areas that cannot form a triangle, then calculate the collapse cost cost of the geographical path formed by the new geographical location and its neighboring points, and update the minimum heap H; repeat the above until the required simplified geographical area is met; Step 4: Edge flipping operation: Only the edges of non-boundary geographic paths are flipped, and finally the triangles are close to regular triangles, and the triangle quality is improved.
2. A real-time simplification method for loading a two-dimensional grid model map based on distance square according to claim 1, It is characterized in that In step 1, the straight line equation of each geographic path is calculated as follows: Assume that the starting point of each geographic path e is v 0 and v 1 , then the direction vector of edge e S=v 1 -v 0 Then the normal vector of the geographic path e is Assume that the linear equation l of the geographical path e is ax+by+c=0, then a=n x b=n y C=-n·v O Abbreviated as l=[a,b,c] T 。 3. A real-time simplification method for loading a two-dimensional grid model map based on distance square according to claim 2, It is characterized in that In step 1, the distance matrix is defined and initialized, and v = [v x ,v y ,1] T The sum of the squares of the geographical path distances to the neighboring areas is D 2 (v) Where Q l is the basic distance matrix, edges(v) represents the set of all geographical paths in the neighborhood of point v, Then the distance matrix Q v =∑ e∈edges(v) Q l 。 4. A real-time simplification method for loading a two-dimensional grid model map based on distance square according to claim 3, It is characterized in that In step 2, the point with the smallest sum of squared distances to the surrounding geographic paths is defined as the optimal collapse point, that is: v new =arg min D 2 (v) Then v new for The solution; Let the distance matrix of geographic path e be Q: Then we can get Using homogeneous coordinates, expand the Q matrix and zero point coordinates as follows: If Q is reversible, then we can obtain v new =Q -1 [0,0,1] T If Q is irreversible, we can let v new Take the midpoint of side e, that is At the same time, it can be obtained v new and cost are stored in the minimum heap H for use in the simplification process.
5. A real-time simplification method for loading a two-dimensional grid model map based on distance square according to claim 4, It is characterized in that When initializing the straight line equation of the geographic path e, the penalty weight ω is introduced as follows: If e is a boundary, then l=ω*[a,b,c] T 。 6. A real-time simplification method for loading a two-dimensional grid model map based on distance square according to claim 1, It is characterized in that The edge flipping operation in step 4 is: Compare the lengths of the two edges before and after the edge flip. If the length of the edge after flipping is less than the length of the edge before flipping, perform the edge flipping operation.
7. Application of the real-time simplification method for loading a two-dimensional grid model map based on distance square according to any one of claims 1 to 6, It is characterized in that The method is used in a geographic information system and can realize real-time simplification of the model, thereby reducing map memory usage and improving map loading speed.
