A method for constructing a triangular mesh model based on local optimization of nearest points
By using a local optimization method based on the nearest point, non-Delaunay triangles can be quickly located, which solves the problem of low time efficiency of the point-by-point insertion method and improves the time efficiency of Delaunay triangulation and image processing efficiency.
Patent Information
- Application Number
- CN202411402241.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-10-09
AI Technical Summary
The existing point-by-point interpolation method has low time efficiency in the Delaunay triangulation process. As the dataset expands, the search path becomes longer, resulting in increased time complexity and affecting image processing efficiency.
By using a local optimization method based on the nearest point, the step of searching for the triangle where the inserted data point is located is omitted. By utilizing the adjacent theorem for non-Delaunay triangles and the theorem that the nearest point is a suspect point, non-Delaunay triangles can be quickly located, thus optimizing the Delaunay triangulation process.
It improves the time efficiency of Delaunay triangulation, mitigates the increase in time complexity as the dataset expands, and enhances image processing efficiency.
Smart Images

Figure CN119379949B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer-aided design, and in particular relates to a method for constructing a triangular mesh model based on local optimization of the nearest point for a planar point set. Background Art
[0002] Meshes are often used in computer graphics to simulate the surfaces of complex objects. Compared to polygonal meshes, triangular meshes are more stable, have a simpler structure, and can be generated quickly. When processing real-world graphics, it is often necessary to convert the graphics into triangular meshes.
[0003] The Delaunay triangulation is a companion figure to the Voronoi diagram. The minimum-angle-maximum property of the Delaunay triangle minimizes the appearance of narrow, long triangles in the mesh, making triangular mesh construction more rational and accurate. Point-by-point interpolation is an important method for constructing Delaunay triangulation. It uses dynamic triangle generation, is easy to program, and uses low memory, but suffers from high time complexity.
[0004] To address the low time efficiency of the point-by-point insertion method, existing research optimization ideas usually shorten the search path for the triangle where the data point is located. However, as the data set continues to expand, the search path will inevitably gradually lengthen, so the time efficiency of the method will continue to decline. Summary of the Invention
[0005] The purpose of the present invention is to provide a method for constructing a triangular mesh model based on local optimization of the nearest point. This method optimizes the point-by-point insertion method in Delaunay triangulation, omits the step of searching for triangles where the insertion data points are located, and can quickly locate all non-Delaunay triangles.
[0006] In order to achieve the above purpose, the present invention adopts the following technical solutions:
[0007] 1. A triangular mesh model construction method based on local optimization of the closest point
[0008] The triangular mesh model construction method comprises the following steps:
[0009] 1) Obtain the original image of the target entity and obtain a plane point set based on the original image;
[0010] 2) constructing an initial polygon based on the plane point set, dividing the area where the initial polygon is located into a number of grids, and sorting the grids so that adjacent grids have adjacent numbers;
[0011] 3) Decompose the initial polygon into initial triangles according to the Delaunay triangulation method;
[0012] 4) Insert several data points in grid order; after inserting each data point, obtain the nearest data point corresponding to the current data point, locate all non-Delaunay triangles through the nearest data point, delete the internal boundaries of all non-Delaunay triangles, generate several new triangles based on the current data point, and then complete the insertion of the current data point;
[0013] 5) Delete all initial polygon-related triangles from the initial triangular mesh model to obtain a triangular mesh model of the target entity.
[0014] In step 4), the process of obtaining the nearest data point corresponding to the current data point includes: taking the data points in the grid where the current data point is located and the data points in the adjacent grids of the grid where the current data point is located as surrounding data points, obtaining a set of surrounding data points, and obtaining the surrounding data point with the smallest spacing based on the spacing between each surrounding data point and the current data point and using it as the nearest data point.
[0015] In step 4), all non-Delaunay triangles are obtained by locating the nearest data point. Specifically, any non-Delaunay triangle is obtained from all triangles with the nearest data point as a vertex; and the adjacent triangles of each non-Delaunay triangle are traversed to see if they are non-Delaunay triangles, until all non-Delaunay triangles are found.
[0016] In step 4), the process of obtaining all non-Delaunay triangles by locating the nearest data point includes the following steps:
[0017] B1) obtaining any non-Delaunay triangle from all triangles with the nearest data point as a vertex, marking the non-Delaunay triangle, and constructing a positioning set including only the starting non-Delaunay triangle;
[0018] B2) for each non-Delaunay triangle in the positioning set, screening out all non-Delaunay triangles that do not meet the Delaunay condition and have not been marked from all triangles that touch the edge of the non-Delaunay triangle, obtaining the edge-connected non-Delaunay triangles corresponding to the non-Delaunay triangle, and marking the edge-connected non-Delaunay triangles corresponding to the non-Delaunay triangle;
[0019] Finally, all edge-connected non-Delaunay triangles corresponding to the non-Delaunay triangles in the positioning set are summarized as a new positioning set;
[0020] B3) Repeat step B2) until the new positioning set obtained in step B2) is empty.
[0021] In step B1), the process of obtaining any non-Delaunay triangle from all triangles with the nearest data point as the vertex is specifically as follows: traversing all triangles with the nearest data point as the vertex to see if they meet the Delaunay condition, and stopping the iteration after traversing to the first non-Delaunay triangle edge that does not meet the Delaunay condition.
[0022] In step 3), the process of deleting all non-Delaunay triangle internal boundaries and generating several new triangles based on the current data point includes: after deleting all non-Delaunay triangle internal boundaries, the remaining boundaries enclose a cavity containing the current data point, and connect the current data point and each vertex of the cavity to form several new triangles; the non-Delaunay triangle internal boundaries are the common sides of adjacent non-Delaunay triangles.
[0023] In step 4), the initial polygon-related triangle is a triangle having vertices of the initial polygon as vertices.
[0024] The planar point set of the target entity is composed of a number of coordinate data points. For the initial polygon constructed in step 2), each coordinate data point is located inside the initial polygon or on the boundary of the initial polygon, that is, the coordinate data points located on the boundary of the initial polygon are also considered to be located inside the initial polygon.
[0025] 2. A computer device
[0026] The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0027] 3. A computer-readable storage medium
[0028] A computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0029] The method of the present invention is based on the sequential adjacent theorem of non-Delaunay triangles and the theorem of the nearest point being a suspect point. It quickly locates all non-Delaunay triangles according to the nearest data point, omitting the step of searching for the triangle where the inserted data point is located, and further improving the time efficiency of Delaunay triangulation based on the point-by-point insertion method. Among them, the sequential adjacent theorem of non-Delaunay triangles means that in the Delaunay triangular mesh, every time a node is inserted, all triangles whose circumscribed circles contain the node must be adjacent in sequence. The theorem of the nearest point being a suspect point means that in the Delaunay triangular mesh, the point B closest to the newly inserted data point A is a suspect point, that is, among all triangles with point B as a vertex, there must be at least one triangle that is a non-Delaunay triangle.
[0030] The beneficial effects of the present invention are:
[0031] The present invention quickly locates all generated non-Delaunay triangles by inserting the nearest points of the data points, thereby optimizing the step of searching for triangles where the inserted data points are located in the traditional optimization method, slowing down the speed at which the time complexity increases with the expansion of the data set, and effectively improving the time efficiency of Delaunay triangulation based on the point-by-point insertion method, thereby improving the efficiency of image processing based on Delaunay triangulation. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a flow chart of the method of the present invention;
[0033] Figure 2 Schematic diagram of the triangles that need to be deleted and the triangles actually traversed after inserting the data point P;
[0034] Figure 3 Schematic diagram of triangles with different properties after inserting data point P. DETAILED DESCRIPTION
[0035] Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. In the following description, when referring to the drawings, like numbers in different figures represent like or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present invention, as detailed in the appended claims.
[0036] The specific embodiments of the present invention are as follows:
[0037] The triangular mesh model construction method in this embodiment includes the following steps:
[0038] 1) Acquire an original image of a target entity and obtain a planar point set corresponding to the target entity based on the original image. The original image acquisition method includes, but is not limited to, scanning and photographing. The original image of the target entity includes a two-dimensional image and a three-dimensional image of the target entity surface, preferably a two-dimensional image. The planar point set corresponding to the target entity primarily consists of a plurality of coordinate data points.
[0039] 2) Based on the plane point set of the target entity, an initial polygon that can accommodate all coordinate data points is constructed, and the initial polygon is divided into several grids. The grids are sorted, and the serial numbers of adjacent grids are adjacent. Among them, for the initial polygon, each coordinate data point is located inside the initial polygon or on the boundary of the initial polygon, that is, the coordinate data points located on the boundary of the initial polygon are also considered to be located inside the initial polygon. The process of dividing the initial polygon into several grids is specifically as follows: the area where the coordinate data points are located is divided into grids, all grids are arranged in adjacent order, and the size and capacity of the grids are reasonably allocated according to the size of the data set. The grid size does not necessarily have to be guaranteed to be the same; the number of coordinate data points in the grid does not need to be strictly the same.
[0040] In this embodiment, the process of constructing the initial polygon based on the plane point set of the target entity is as follows: obtaining the maximum x coordinate x of all coordinate data points in the plane point set; max , minimum x coordinate x min , maximum y coordinate y max and the minimum y-coordinate y min , combined with the preset polygon margin d, the coordinates of the initial polygon vertices are obtained. The coordinates of the initial polygon vertices and each vertex are: initial polygon vertex s1(x min -d,y min -d), initial polygon vertex s2(x min -d,y miax +d), initial polygon vertex s3(x max +d,y min -d), initial polygon vertex s4(x max +d,y max + d); the value of d must satisfy the requirement that all coordinate data points lie within the initial polygon. In practice, a data point located on the boundary is considered to be within the polygon. Finally, the initial polygon vertices s1, s2, s3, and s4 are sequentially connected to form the initial polygon.
[0041] 3) Decomposing the initial polygon into a number of initial triangles according to the Delaunay triangulation method; it should be noted that the initial triangles are obtained by connecting the vertices of the initial polygon.
[0042] 4) Insert data points into each grid in grid order. After inserting each data point, obtain the nearest data point corresponding to the current data point, locate all non-Delaunay triangles through the nearest data point, delete the internal boundaries of all non-Delaunay triangles, generate several new triangles based on the current data point, and then complete the insertion of the current data point. It should be noted that the coordinates and number of data points are generated from the coordinates and number of coordinate data points in the corresponding plane point set. Since each grid contains several coordinate data points, the grid order should be followed when inserting data points. When all the data points in a grid are inserted and triangulated, the data points in the next grid are inserted in grid order.
[0043] Specifically, after inserting each data point, triangulation is performed through the following steps:
[0044] A) Obtaining the nearest data point corresponding to the current data point: The data points in the grid containing the current data point and the grids adjacent to the current data point are used as the surrounding data points to obtain a set of surrounding data points. Based on the distance between each surrounding data point and the current data point, the surrounding data point with the smallest distance is obtained and used as the nearest data point. The adjacent grids of the grid containing the current data point include the edge-contact grids of the grid containing the current data point and the point-contact grids of the grid containing the current data point.
[0045] In this embodiment, the process of obtaining any non-Delaunay triangle from all triangles with the nearest data point as the vertex is specifically as follows: traverse all triangles with the nearest data point as the vertex to see whether they meet the Delaunay condition, and stop iterating after traversing to the first non-Delaunay triangle edge that does not meet the Delaunay condition.
[0046] B) Obtain all non-Delaunay triangles by locating the nearest data point. Specifically, the following steps are performed: obtain any non-Delaunay triangle from all triangles with the nearest data point as a vertex; traverse the adjacent triangles of each non-Delaunay triangle to see if they are also non-Delaunay triangles, until all non-Delaunay triangles are found.
[0047] like Figure 1 As shown, in this embodiment, step B2) includes the following steps:
[0048] B1) obtaining any non-Delaunay triangle from all triangles with the nearest data point as a vertex as a starting non-Delaunay triangle, marking the starting non-Delaunay triangle, and constructing a positioning set with the non-Delaunay triangle as the only element;
[0049] B2) Using the first non-Delaunay triangle in the positioning set as the current non-Delaunay triangle, obtain all edge-contacting triangles that touch the edge of the current non-Delaunay triangle to obtain an edge-contacting triangle set. Filter out all unmarked edge-contacting non-Delaunay triangles that do not meet the Delaunay condition from the edge-contacting triangle set, and mark each edge-contacting non-Delaunay triangle obtained by filtering out. Edge-contacting refers to sharing a common edge. Point contact refers to sharing a common vertex. A triangle that does not meet the Delaunay condition refers to a triangle whose circumcircle contains other data points.
[0050] B3) deleting the current non-Delaunay triangle from the positioning set, and adding the edge-connected non-Delaunay triangle marked in step B2) to the positioning set;
[0051] B4) Repeat steps B2) to B3) until the number of non-Delaunay triangles in the positioning set is zero.
[0052] C) After deleting all non-Delaunay triangle internal boundaries and generating several new triangles based on the current data point, the current data point is inserted. In this embodiment, the process of deleting all non-Delaunay triangle internal boundaries and generating several new triangles based on the current data point includes: after deleting all non-Delaunay triangle internal boundaries, the remaining boundaries enclose a cavity containing the current data point, and connecting the current data point with each vertex of the cavity to form several new triangles. The non-Delaunay triangle internal boundaries are the common edges of adjacent non-Delaunay triangles.
[0053] 4) Delete all triangles related to the initial polygon from the initial triangular mesh model to obtain a triangular mesh model of the target entity, wherein the triangles related to the initial polygon are triangles with vertices of the initial polygon as vertices.
[0054] Figure 2 This is a schematic diagram of the triangulation algorithm running process based on the nearest point local optimization after inserting the data point P. Point A is the nearest data point to point P. Figure 2 The triangle 1 on the left side of the figure represents the first non-Delaunay triangle that is traversed among all triangles with point A as a vertex. Figure 2 Triangle 2 and triangle 6 on the right side represent the non-Delaunay triangles that have been traversed among the adjacent triangles of triangle 1. No non-Delaunay triangles have been traversed among the remaining adjacent triangles of triangle 2 and triangle 6, and the traversal process is terminated.
[0055] Figure 3In the figure, triangles 1 to 4 are non-Delaunay triangles generated after inserting data point P. These triangles must be adjacent to each other. For the traditional point-by-point insertion method, it is necessary to traverse all existing triangles to locate all non-Delaunay triangles. The Delaunay triangulation algorithm based on local optimization of the nearest point only needs to traverse triangles 1 to 10 to locate non-Delaunay triangles.
[0056] The terms used in this invention are for the purpose of describing specific embodiments only and are not intended to limit the invention. The singular forms "a," "the," and "the" used in this invention and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0057] It should be understood that although the terms "first," "second," "third," etc. may be used in the present invention to describe various information, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present invention. Depending on the context, the term "if" as used herein may be interpreted as "when," "when," or "in response to determining."
Claims
1. A method for constructing a triangular mesh model based on local optimization of the nearest point, characterized by: The triangular mesh model construction method comprises the following steps: 1) Obtain the original image of the target entity and obtain a plane point set based on the original image; 2) constructing an initial polygon based on the plane point set, dividing the area where the initial polygon is located into a number of grids, and sorting the grids so that adjacent grids have adjacent numbers; 3) Decompose the initial polygon into initial triangles according to the Delaunay triangulation method; 4) Insert several data points in grid order; after inserting each data point, obtain the nearest data point corresponding to the current data point, locate all non-Delaunay triangles through the nearest data point, delete the internal boundaries of all non-Delaunay triangles, generate several new triangles based on the current data point, and then complete the insertion of the current data point; In step 4), the process of obtaining the nearest data point corresponding to the current data point includes: taking the data points in the grid where the current data point is located and the data points in the adjacent grids of the grid where the current data point is located as the surrounding data points to obtain a set of surrounding data points, and according to the distance between each surrounding data point and the current data point, obtaining the surrounding data point with the smallest distance and taking it as the nearest data point; In step 4), the process of obtaining all non-Delaunay triangles by locating the nearest data point includes the following steps: B1) obtaining any non-Delaunay triangle from all triangles with the nearest data point as a vertex, marking the non-Delaunay triangle, and constructing a positioning set including only the starting non-Delaunay triangle; B2) for each non-Delaunay triangle in the positioning set, screening out all non-Delaunay triangles that do not meet the Delaunay condition and have not been marked from all triangles that touch the edge of the non-Delaunay triangle, obtaining the edge-connected non-Delaunay triangles corresponding to the non-Delaunay triangle, and marking the edge-connected non-Delaunay triangles corresponding to the non-Delaunay triangle; Finally, all edge-connected non-Delaunay triangles corresponding to the non-Delaunay triangles in the positioning set are summarized as a new positioning set; B3) repeating step B2) until the new positioning set obtained in step B2) is empty; In step 4), the process of deleting all non-Delaunay triangle internal boundaries and generating several new triangles based on the current data point includes: after deleting all non-Delaunay triangle internal boundaries, the remaining boundaries enclose a cavity containing the current data point, and connect the current data point and each vertex of the cavity to form several new triangles; the non-Delaunay triangle internal boundaries are the common sides of adjacent non-Delaunay triangles; 5) Delete all initial polygon-related triangles from the initial triangular mesh model to obtain a triangular mesh model of the target entity.
2. The method for constructing a triangular mesh model based on nearest point local optimization according to claim 1, characterized in that: In step 4), all non-Delaunay triangles are obtained by locating the nearest data point. Specifically, any non-Delaunay triangle is obtained from all triangles with the nearest data point as a vertex; and the adjacent triangles of each non-Delaunay triangle are traversed to see if they are non-Delaunay triangles, until all non-Delaunay triangles are found.
3. The method for constructing a triangular mesh model based on nearest point local optimization according to claim 1, characterized in that: In step B1), the process of obtaining any non-Delaunay triangle from all triangles with the nearest data point as the vertex is specifically as follows: traverse all triangles with the nearest data point as the vertex to see if they meet the Delaunay condition, and stop iterating after traversing to the first non-Delaunay triangle edge that does not meet the Delaunay condition.
4. The method for constructing a triangular mesh model based on local optimization of the closest point according to claim 1, characterized in that: In step 5), the initial polygon-related triangle is a triangle having vertices of the initial polygon as vertices.
5. The method for constructing a triangular mesh model based on nearest point local optimization according to claim 1, characterized in that: The plane point set of the target entity is composed of a number of coordinate data points. For the initial polygon constructed in step 2), each coordinate data point is located inside the initial polygon or on the boundary of the initial polygon.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Triangular mesh rapid construction method and system based on oblique photography image
CN116109791A
Plane constraint triangular mesh generation method and system
CN118097062A