A method and system for optimizing the quality of a triangular mesh based on local reconstruction

By employing a triangular mesh quality optimization method based on local reconstruction, and utilizing regularity filtering, topology adjustment, and local neighborhood mesh reconstruction, the computational accuracy and iterative convergence problems caused by distorted elements in 3D geometric modeling are solved, achieving efficient mesh optimization and accurate geometric feature preservation.

CN122176232APending Publication Date: 2026-06-09HANGZHOU TIANJI HUIHAI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610176590.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing 3D geometric modeling techniques, the initial triangular mesh contains a large number of distorted elements, which leads to decreased computational accuracy and difficulty in iterative convergence. Existing local remeshing methods are computationally expensive and rely on robust hole boundary handling.

Method used

The triangular mesh quality optimization method based on local reconstruction employs regularity filtering, basic topology adjustment, local neighborhood mesh movement, and projection plane reconstruction, combined with the spring-mass model and Delaunay triangulation, to optimize the triangular mesh quality.

Benefits of technology

It achieves a precise improvement in the quality of triangular meshes, while maintaining the original geometric features, significantly improving computational accuracy and visualization effects, and reducing computational costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122176232A_ABST
    Figure CN122176232A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of CAD model processing, in particular to a triangular mesh quality optimization method and system based on local reconstruction, which comprises the following steps: acquiring a triangular mesh, and screening a first triangular mesh to be optimized based on a preset regularity; performing basic topological adjustment on the first triangular mesh to be optimized, and obtaining a second triangular mesh to be optimized; acquiring a first local neighborhood mesh of the second triangular mesh to be optimized, moving the vertexes of the triangular mesh in the first local neighborhood mesh, and obtaining a third triangular mesh to be optimized; acquiring a second local neighborhood mesh of the third triangular mesh to be optimized and a projection plane of the second local neighborhood mesh, determining a layout triangle according to the area of the projection plane and a target side length, and mapping the layout triangle to the second local neighborhood mesh. The application can optimize the quality of the triangular mesh on the basis of retaining the original geometric characteristics of the triangular mesh, and greatly improve the calculation efficiency of the triangular mesh optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of CAD model processing technology, and in particular to a method and system for optimizing the quality of triangular meshes based on local reconstruction. Background Technology

[0002] Triangular meshes, as a core representation method for 3D geometric modeling, are widely used in computer graphics, scientific computing, and engineering simulation. Whether reconstructing surfaces using 3D scanning equipment or automatically meshing CAD models in CAE software, the generated initial triangular mesh often contains a large number of distorted elements. These elements often exhibit shapes such as elongated triangles and sharp interior angles, directly affecting computational accuracy and visualization effects. Especially in fields such as computational fluid dynamics, during dynamic processes such as free surface flow and large deformation motions in the fluid domain, the mesh will further distort and stretch, spontaneously generating new distorted elements, leading to problems such as decreased numerical format accuracy and difficulty in iterative convergence. Therefore, establishing a scientific quality evaluation system and developing efficient mesh optimization methods are of great significance for improving simulation reliability.

[0003] Existing strategies for local remeshing involve identifying continuous low-quality regions containing multiple malformed cells, deleting their internal meshes, and then re-triangulating the local area under the preserved boundary constraints. This method is particularly suitable for handling dense, thin triangles or severely distorted cell clusters, fundamentally reconstructing local geometry and connectivity, and significantly improving the quality of large areas. However, its implementation relies on robust hole boundary handling and remeshing algorithms to ensure a smooth transition between the old and new meshes, and it incurs high computational costs. Summary of the Invention

[0004] To optimize the quality of triangular meshes, preserve their original geometric features, and improve the computational efficiency of triangular mesh optimization, this application provides a method and system for optimizing the quality of triangular meshes based on local reconstruction.

[0005] Firstly, this application provides a triangular mesh quality optimization method based on local reconstruction, employing the following technical solution:

[0006] A triangular mesh quality optimization method based on local reconstruction, the method comprising:

[0007] Obtain a triangular mesh and filter the first triangular mesh to be optimized based on a preset regularity, wherein the regularity is used to indicate the quality of the triangular mesh, and the regularity includes side length ratio, side length scale, and interior angle constraint.

[0008] A basic topology adjustment is performed on the first triangular mesh to be optimized to obtain a second triangular mesh to be optimized. The basic topology adjustment includes performing edge splitting, edge collapse, and edge swapping based on the quality of the first triangular mesh to be optimized.

[0009] Obtain the first local neighborhood mesh of the second triangular mesh to be optimized. Using the first local neighborhood mesh as the boundary, move the vertices of the triangular mesh within the first local neighborhood mesh to obtain the third triangular mesh to be optimized.

[0010] Obtain the second local neighborhood mesh of the third triangular mesh to be optimized and the projection plane of the second local neighborhood mesh. Determine the placement triangle based on the area of ​​the projection plane and the target side length, and map the placement triangle to the second local neighborhood mesh.

[0011] In one possible implementation, the basic topology adjustment of the first triangular mesh to be optimized includes:

[0012] Obtain the side length and interior angle of the first triangular mesh to be optimized;

[0013] Select the first target side length that is larger than the side length scale, and add split points on the first target side length corresponding to the first target side length to form multiple sub-side lengths smaller than the side length scale;

[0014] Filter out the second target side length that is smaller than the relevant side length, and merge the two endpoints of the second target side length corresponding to the second target side length to form a merged endpoint. The relevant side length is determined according to the side length ratio and side length scale.

[0015] Filter the target interior angles that are smaller than the interior angle constraint, obtain the convex quadrilateral formed by the triangular mesh containing the target interior angle and the adjacent triangular meshes, determine whether swapping the diagonals increases the minimum interior angle, if so, swap the diagonals of the quadrilateral to obtain two replacement triangular meshes.

[0016] In one possible implementation, the split point is the midpoint of the first target side length.

[0017] In one possible implementation, moving the vertices of the triangular mesh within the first local neighborhood mesh includes:

[0018] Obtain the internal edge length and internal vertices of the triangular mesh in the first local neighborhood mesh;

[0019] Calculate the resultant force at each internal vertex, which is obtained from the elastic force of the internal edge associated with that internal vertex;

[0020] Based on the resultant force, determine the movement direction of each internal vertex and iteratively update the internal vertices.

[0021] In one possible implementation, determining the movement direction of each internal vertex and iteratively updating the internal vertices based on the mean of the internal side lengths and the resultant force includes:

[0022] Obtain the coordinates of each internal vertex to be moved and its adjacent internal vertices, and fit the local plane.

[0023] Project the internal vertices to be moved and the surrounding triangular mesh onto the local plane to obtain the projected vertices and projected triangles;

[0024] Project the temporary vertex onto the local plane to obtain the temporary projection point;

[0025] The moving vertex in the original space is obtained by mapping the coordinates of the centroid of the projection triangle where the temporary projection point is located.

[0026] In one possible implementation, determining temporary vertices includes:

[0027] Determine the temporary vertex based on the internal vertex to be moved and the movement step size;

[0028] Update the movement step size and temporary vertices within a set number of iterations;

[0029] The movement step size is obtained based on the initial step size and the attenuation coefficient. The initial step size is obtained based on the resultant force of the internal vertex to be moved and the distance between the internal vertex to be moved and its adjacent internal vertex.

[0030] In one possible implementation, determining the arrangement of triangles based on the area of ​​the projection plane and the target side length includes:

[0031] The expected number of points to be sprinkled in the projection plane is determined based on the equilateral triangle formed by the area of ​​the projection plane and the side length of the target.

[0032] Random vertices are randomly placed in the projection plane according to the expected number of points to be scattered;

[0033] Generate multiple new regular triangles based on random vertices;

[0034] By mapping multiple new regular triangles back to the original space, multiple layout triangles are obtained.

[0035] In one possible implementation, after determining the expected number of points to be scattered within the projection plane, the process includes:

[0036] Get the fluctuating neighbor number containing the expected number of sprinkles;

[0037] Based on each fluctuation neighbor number and sampling number, random vertices are randomly placed in the projection plane;

[0038] Generate multiple new regular triangles based on random vertices;

[0039] The optimal point-scattering scheme is determined based on regularity, and the multiple new regular triangles generated by the optimal point-scattering scheme are mapped back to the original space to obtain the layout triangles.

[0040] Secondly, this application provides a triangular mesh quality optimization system based on local reconstruction, employing the following technical solution:

[0041] A triangular mesh quality optimization system based on local reconstruction, the system comprising:

[0042] A triangular mesh acquisition module is used to acquire triangular meshes and filter the first triangular mesh to be optimized based on a preset regularity. The regularity is used to indicate the quality of the triangular mesh, and the regularity includes side length ratio, side length scale, and interior angle constraints.

[0043] A basic topology adjustment module is used to perform basic topology adjustment on a first triangular mesh to be optimized and obtain a second triangular mesh to be optimized. The basic topology adjustment includes performing edge splitting, edge collapse, and edge swapping based on the quality of the first triangular mesh to be optimized.

[0044] The vertex movement and adjustment module is used to obtain the first local neighborhood mesh of the second triangular mesh to be optimized, and move the vertices of the triangular mesh within the first local neighborhood mesh with the first local neighborhood mesh as the boundary to obtain the third triangular mesh to be optimized.

[0045] The local mesh reconstruction module is used to obtain the second local neighborhood mesh of the third triangular mesh to be optimized and the projection plane of the second local neighborhood mesh. Based on the area of ​​the projection plane and the target side length, the layout triangle is determined and mapped to the second local neighborhood mesh.

[0046] Thirdly, this application provides an electronic device that adopts the following technical solution:

[0047] An electronic device includes: a memory and a processor;

[0048] The memory is used to store computer programs / instructions;

[0049] The processor is configured to execute the computer program / instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0050] This application provides a method and system for optimizing the quality of triangular meshes based on local reconstruction. It filters low-quality triangular meshes by using regularization to select the first triangular mesh to be optimized. Then, it performs basic topological adjustments on the first triangular mesh to be optimized, including edge splitting, edge collapse, and edge swapping, to quickly correct edge length and interior angle defects, achieving initial mesh structure optimization while reducing unnecessary computation. Next, it calculates the resultant force of internal vertices, fits a local plane, and moves vertices using centroid coordinate mapping to achieve precise vertex adjustment. Finally, it determines the expected number of points to be sprinkled by the area of ​​the projected plane and the target edge length, and generates an optimal new regular triangle by combining the fluctuating neighbor number and the number of samplings, mapping it back to the original space to achieve deep local mesh reconstruction. This optimizes quality while maintaining geometric features, improving overall optimization efficiency. Attached Figure Description

[0051] Figure 1 This is a flowchart illustrating a triangular mesh quality optimization method based on local reconstruction, provided as an embodiment of this application.

[0052] Figure 2 This is a flowchart illustrating a triangular mesh quality optimization method based on local reconstruction, provided as an embodiment of this application.

[0053] Figure 2a This is a schematic diagram of vertex movement in a triangular mesh quality optimization method based on local reconstruction, provided in one embodiment of this application.

[0054] Figure 2b This is a schematic diagram of local mesh reconstruction in a triangular mesh quality optimization method based on local reconstruction provided in an embodiment of this application.

[0055] Figure 2c This is a schematic diagram illustrating the effect of a triangular mesh quality optimization method based on local reconstruction, provided in one embodiment of this application.

[0056] Figure 3 This is a schematic diagram of a triangular mesh quality optimization system based on local reconstruction, provided as an embodiment of this application.

[0057] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0058] To better understand the purpose, technical solutions, and advantages of this application, it has been described and illustrated below with reference to the accompanying drawings and embodiments. However, those skilled in the art should understand that this application can be implemented without these details. In some cases, to avoid obscuring various aspects of this application due to unnecessary description, well-known methods, processes, systems, components, and / or circuits already described at a higher level will not be elaborated upon. It will be apparent to those skilled in the art that various modifications can be made to the embodiments disclosed in this application, and the general principles defined in this application can be applied to other embodiments and application scenarios without departing from the principles and scope of this application. Therefore, this application is not limited to the illustrated embodiments, but conforms to the broadest scope consistent with the scope of protection claimed in this application.

[0059] It should be noted that the descriptions of these embodiments are for the purpose of aiding understanding the present invention, but do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0060] It should be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For hardware implementations, the processor may be implemented as one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, other electronic units designed to perform the functions described herein, or combinations thereof.

[0061] When an embodiment is implemented as software, firmware, middleware, or microcode, program code, or code segments, it may be stored in a machine-readable medium, such as a storage component. A code segment may represent a procedure, function, subroutine, program, routine, subroutine, module, software package, class, or any combination of instructions, data structures, or program statements. One code segment can be coupled to another code segment or hardware circuitry by passing and / or receiving information, data, arguments, parameters, or memory contents. Information, arguments, parameters, data, etc., can be passed, forwarded, or transmitted using any suitable means, including memory sharing, messaging, token passing, network transmission, etc.

[0062] For software implementations, the techniques described herein can be implemented using modules (e.g., programs, functions, etc.) that perform the functions described herein. The software code can be stored in memory units and executed by a processor. The memory units can be implemented within or outside the processor; in the latter case, the memory units can be communicatively coupled to the processor via various methods known in this art.

[0063] In the description of this application, "several" means one or more, "more than" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.

[0064] In the description of this application, the terms "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples.

[0065] Currently, the main technical approaches for optimizing the quality of triangular meshes include point refinement, point shifting optimization, and local remeshing.

[0066] Vertex refinement improves cell shape by inserting new vertices near malformed cells and using local reconnection. While this method is direct and effective, its effectiveness depends on the vertex addition strategy and is prone to over-refinement of the mesh due to vertex redundancy, potentially leading to convergence issues.

[0067] Vertex shifting optimization focuses on adjusting the geometric positions of existing vertices to improve quality while maintaining mesh topology and overall density. Laplacian smoothing is simple and efficient, achieving smoothness through local averaging, but it often cannot precisely control the unit shape and is prone to shrinkage or distortion at boundaries. Energy optimization constructs a differentiable energy function, transforming quality indicators such as angles and side lengths into optimization objectives, driving vertex position updates. This method can flexibly introduce geometric constraints to achieve balanced optimization across multiple objectives, but it typically comes with high computational complexity.

[0068] The implementation of local remeshing relies on robust hole boundary handling and remeshing algorithms to ensure a smooth transition between the old and new meshes, but it is computationally expensive.

[0069] To optimize the quality of triangular meshes, preserve their original geometric features, and improve the computational efficiency of triangular mesh optimization, this application provides a method and system for optimizing the quality of triangular meshes based on local reconstruction.

[0070] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0071] Figure 1 A flowchart illustrating a triangular mesh quality optimization method based on local reconstruction, provided in an embodiment of this application; as shown. Figure 1 As shown in the figure, this application discloses a method for optimizing the quality of triangular meshes based on local reconstruction. The method includes:

[0072] S101. Obtain the triangular mesh and filter the first triangular mesh to be optimized based on the preset regularity.

[0073] First, define the regularity criteria for triangular mesh quality, including side length ratio, side length scale, and interior angle constraints, i.e. .

[0074] The quality criterion for a regularized triangular mesh is:

[0075] The interior angles of the triangular mesh must be ≥θ (θ>0, to avoid sharp angles);

[0076] The side length of the triangular mesh ∈ [ * , ]( ∈(0,1], >0, avoid sides that are too short / long).

[0077] By traversing all the original triangular meshes and verifying whether each triangular mesh satisfies the above regularity, meshes that violate any constraint are selected as the first triangular meshes to be optimized, thus achieving targeted optimization.

[0078] For example, let's assume =0.5, =2, θ=30°, then the side length of a qualified triangular mesh must be between [1,2], and all interior angles must be no less than 30°.

[0079] If triangle T1 in the original mesh has vertices A(0,0,0), B(3,0,0), and C(1,1,0), side length AB=3 (>2, violating the side length scale constraint), and interior angle ∠B≈27° (<30°, violating the interior angle constraint), it is selected as the first triangle to be optimized.

[0080] If triangle T2 in the original grid has vertices D(1,1,0), E(2,1,0), and F(1,2,0), side lengths DE=1, EF≈1.414, and DF=1 (all ∈ [1,2]), and all interior angles ≥45°, it satisfies the regularity and is not selected.

[0081] S102. Perform basic topology adjustments on the first triangular mesh to be optimized, and obtain the second triangular mesh to be optimized.

[0082] The basic topology adjustment includes performing edge splitting, edge collapse, and edge swapping based on the quality of the first triangular mesh to be optimized.

[0083] For different defects in the first triangular mesh to be optimized, three types of basic topology operations are performed:

[0084] Side splitting: If the length of a side of a triangle is greater than h, then take a point on the side to split the side and reconstruct it into multiple smaller triangles to solve the problem of long sides.

[0085] Side collapse: If the length of a side of a triangle is less than... * If the two endpoints on the edge collapse to one endpoint, the original triangular mesh is deleted and the adjacent mesh is reconstructed to eliminate the excessively short edge.

[0086] Swap sides: Find a convex quadrilateral consisting of a triangle with an interior angle less than θ and its adjacent triangles. All four interior angles of the convex quadrilateral are less than 180°. Check if swapping the diagonals can increase the smallest interior angle. If so, perform a swap. By swapping the diagonals of the convex quadrilateral, it is reconstructed into two triangles with more balanced interior angles, thus improving the sharp angle defect.

[0087] After making basic topology adjustments to the first triangular mesh to be optimized, the regularity of all meshes is checked again, and the meshes that still violate the regularity constraints are selected as the second triangular mesh to be optimized.

[0088] Typically, the number of second triangular meshes to be optimized is less than the number of first triangular meshes to be optimized.

[0089] S103. Obtain the first local neighborhood mesh of the second triangular mesh to be optimized. Using the first local neighborhood mesh as the boundary, move the vertices of the triangular mesh within the first local neighborhood mesh to obtain the third triangular mesh to be optimized.

[0090] Using each second triangular mesh to be optimized as the core, its neighboring meshes are obtained through breadth-first search (BFS) to form the first local neighborhood mesh. The first local neighborhood mesh is set as a fixed constraint to avoid topological disorder.

[0091] By establishing a spring-mass dynamics model within the first local neighborhood grid, and minimizing the total potential energy of the grid system, the vertex positions of the triangular grids within the first local neighborhood grid are moved to achieve structural adjustment of the second triangular grid to be optimized. The adjusted portion of the second triangular grid to be optimized will conform to regularity. At this point, the grids that violate any constraint of regularity are selected as the third triangular grid to be optimized.

[0092] S104. Obtain the second local neighborhood mesh of the third triangular mesh to be optimized, project the second local neighborhood mesh to obtain the projection plane, determine the placement triangle according to the area of ​​the projection plane and the target side length, and map the placement triangle to the second local neighborhood mesh.

[0093] The third triangular mesh to be optimized may be an extremely distorted mesh region. By obtaining the second local neighborhood mesh of the third triangular mesh to be optimized and reconstructing the triangular mesh within the second local neighborhood mesh, the local reconstruction and optimization of all third triangular meshes to be optimized can be achieved.

[0094] This application provides a triangular mesh quality optimization method based on local reconstruction. It first performs basic topology adjustments on the first mesh to be optimized, achieving rapid correction of defects such as long sides, short sides, and sharp corners, thus initially optimizing the mesh structure and reducing subsequent computational load. Then, by constructing a first local neighborhood and setting it as a fixed constraint, and combining this with a spring-mass model to move vertices, it minimizes the total potential energy while avoiding topological distortion, achieving refined mesh quality optimization. Finally, it generates a neighborhood mesh projection plane through breadth-first search, determines the placement of triangles based on the area and target side length, and maps them back to the original space, achieving deep reconstruction of the extremely distorted mesh. This optimizes the quality while preserving the original geometric features, significantly improving computational efficiency.

[0095] Figure 2 A flowchart illustrating a triangular mesh quality optimization method based on local reconstruction, as provided in an embodiment of this application, is shown below. Figure 2 As shown, based on the above embodiments, this embodiment includes the following method:

[0096] S201. Obtain the triangular mesh and filter the first triangular mesh to be optimized based on the preset regularity.

[0097] Step S201 can be referred to in the detailed description of step S101.

[0098] S202. Obtain the side length and interior angle of the first triangular mesh to be optimized.

[0099] For the first triangular mesh to be optimized, the side length can be calculated using coordinates, which is the straight-line distance between two points; and each interior angle can be calculated using trigonometric functions.

[0100] S203. Select the first target side length that is greater than the side length scale, and add split points on the first target side length corresponding to the first target side length to form multiple sub-side lengths that are smaller than the side length scale.

[0101] Select the first target edge with a side length greater than h, and take the split point on each first target edge, prioritizing the midpoint, which is simple to calculate and has a uniform effect. Then, use the split point and the vertex of the original triangle to reconstruct two small triangles.

[0102] For example, with r=0.5, h=2, and θ=30°;

[0103] The first triangular mesh to be optimized, T1, has vertices A(0,0,0), B(3,0,0), and C(1.6,1.2,0).

[0104] Original side lengths: AB=3 (>2, violating the side length scale constraint), AC=2 (∈[1,2]), BC≈1.84 (∈[1,2]);

[0105] Take the midpoint M(1.5,0,0) of AB, that is, the coordinates of the midpoint = the average of the coordinates of the two endpoints;

[0106] Decompose the original triangle T1 (ABC) into two smaller triangles: T1a (AMC) and T1b (MBC); AM = 1.5 and MB = 1.5 (both are between 1 and 2, which meets the side length requirements);

[0107] T1a(AMC): AM=1.5 (∈[1,2]), MC≈1.20, AC=2 (both ∈[1,2]);

[0108] T1b(MBC): MB=1.5, BC≈1.84, MC≈1.20 (all ∈ [1,2]);

[0109] After splitting, the side lengths of the two triangles are both ∈ [1,2], and the interior angles are both ≥35°, which fully satisfies the regularity requirement.

[0110] S204. Filter the second target side length that is smaller than the relevant side length, and merge the two endpoints of the second target side length to form a merged endpoint.

[0111] The relevant side length is determined based on the side length ratio and side length scale, that is... * .

[0112] Calculate the relevant side length = * Filter out the second target edge whose side length is less than the relevant side length, merge the two endpoints of the second target edge, take the average of the coordinates or keep one of them, delete the original triangle, and reconnect the adjacent vertices to form a new triangle.

[0113] For example, continuing the above regularity requirement, a malformed triangle T3 has vertices P(0,0,0), Q(0.8,0,0), and R(0,1,0), with side length PQ = 0.8 < 1;

[0114] Merge P and Q into a single point P'(0.4,0,0), delete the original T3, and use P', R, and the vertices of the adjacent triangle, such as S(1,0,0), to form a new triangle T3'(P'-RS).

[0115] S205. Filter the target interior angles that are smaller than the interior angle constraint, obtain the convex quadrilateral formed by the triangular mesh containing the target interior angle and the adjacent triangular meshes, determine whether swapping the diagonals increases the minimum interior angle, if so, swap the diagonals of the quadrilateral to obtain two replacement triangular meshes.

[0116] Filter out target interior angles with interior angles < θ, find the triangle (T1a) containing the target interior angle and the adjacent triangle, and determine whether the two form a convex quadrilateral, that is, all four angles of the convex quadrilateral are < 180°. If they form a convex quadrilateral, calculate the smallest interior angle after swapping the diagonals. If the new smallest interior angle is ≥ θ, swap the diagonals.

[0117] S206, The second triangular mesh to be optimized is obtained.

[0118] Verify the regularity of all meshes, and filter out the meshes that still violate the regularity constraints, which are the second triangular meshes to be optimized.

[0119] S207. Obtain the first local neighborhood mesh of the second triangular mesh to be optimized.

[0120] Starting with each second triangular mesh to be optimized, a breadth-first search (BFS) is used to expand the search area, identifying the core distorted triangle and the surrounding triangles connected in 1-2 layers, forming the first local neighborhood mesh. The boundary vertices of this neighborhood are set as fixed points to prevent the mesh shape from deviating during optimization.

[0121] S208. Using the first local neighborhood grid as the boundary, obtain the internal side length and internal vertices of the triangular mesh in the first local neighborhood grid.

[0122] In the first local neighborhood grid, vertices that are not boundary vertices are internal vertices. The edge connecting two internal vertices, or connecting an internal vertex to a boundary vertex, is the internal edge length. Record the coordinates of all internal vertices and the length of the internal edge.

[0123] S209. Calculate the resultant force at each internal vertex.

[0124] S210. Determine the direction of movement of each internal vertex based on the resultant force.

[0125] Treat the inner side lengths as springs, the inner vertices as small balls, and the boundary vertices as fixed. Calculate the net force on each ball based on the spring's tension / pushing force; the direction of this net force is the direction the vertex should move.

[0126] The resultant force is obtained from the elastic force of the internal side length associated with the internal vertex.

[0127] The first local neighborhood grid is considered as a physical system. The vertices on the boundary of the first local neighborhood grid are fixed points, and the internal vertices of the first local neighborhood grid are freely moving particles. The internal edge length is (the edge whose two endpoints are not both fixed points). Consider it as a linear spring. According to Hooke's Law, for any internal side length... its opposite endpoint Applying elastic force The definition is as follows:

[0128] ;

[0129] in, Let be the position vector of the i-th vertex. For the edge European length, This is the resting length of the spring.

[0130] In this example, in order to achieve mesh uniformity, It is uniformly set to the average length of all internal edges in the first local neighborhood grid. According to the above definition, when the edge length is greater than... When the side length is less than 1, gravitational force is generated between the vertices; when the side length is less than At this time, a repulsive force is generated between the vertices.

[0131] Based on the principle of energy, the aforementioned elastic field is a conserved field. For the entire triangular mesh system, its total potential energy... Defined as the sum of all internal edge potential energies:

[0132] ;

[0133] in, Represents the set of internal edges. Total potential energy. Non-negative, and only if all internal edge lengths are equal to the resting length. The time is zero. Therefore, the goal of mesh optimization is to solve the problem of minimizing the total potential energy. To solve this minimization problem, this invention calculates the net force acting on the i-th vertex. This force is the negative gradient of the total potential energy with respect to the position of that vertex:

[0134] ;

[0135] combined efforts It indicates the direction of movement that minimizes the variance of the grid side length.

[0136] To ensure that the mesh surface remains in close contact with the geometric boundaries of the original model during internal vertex movement, a local projection operator is constructed. Local projection operator The construction steps include S211-S214.

[0137] S211. Obtain the coordinates of each internal vertex to be moved and its adjacent internal vertices, and fit the local plane.

[0138] Get each internal vertex to be moved Given the coordinates of adjacent internal vertices, a local plane is fitted using the least squares method. .

[0139] S212. Project the internal vertices to be moved and the surrounding triangular mesh onto the local plane to obtain the projected vertices and projected triangles.

[0140] S213. Project the temporary vertex onto the local plane to obtain the temporary projection point.

[0141] For temporary vertices Calculate its local plane Temporary projection points on the surface.

[0142] S214. Obtain the moving vertex in the original space by mapping the coordinates of the centroid of the projection triangle where the temporary projection point is located.

[0143] When determining temporary vertices, the following are included:

[0144] Determine the temporary vertex based on the internal vertex to be moved and the movement step size;

[0145] Update the movement step size and temporary vertices within a set number of iterations;

[0146] The movement step size is obtained based on the initial step size and the decay coefficient. The initial step size is obtained based on the resultant force of the internal vertex to be moved and the distance between the internal vertex to be moved and its adjacent internal vertices.

[0147] Specifically, in determining the resultant force Then, perform at most [number] operations on the first local neighborhood grid. The next iteration.

[0148] In the In the next iteration, the internal vertices The position update formula is:

[0149] ;

[0150] in, This is a local projection operator used to handle geometric constraints; The moving step size. The selection adopts a backtracking search strategy:

[0151] First, the initial step size ,in, As vertices The minimum distance to its link.

[0152] Subsequently, through iterative reduction Determine the step size until the following Armijo energy descent condition is met: ,in, To account for the actual displacement vector direction after considering the influence of the projection operator. When the triangular mesh satisfies... - Regularity or reaching the maximum number of iterations The iteration terminates.

[0153] according to Figure 2a As shown, the first local neighborhood grid is 1- 2- 3- 4- 5- 6, 1. 2. 3. 4. 5. 6 is the boundary vertex. For the internal vertices to be moved, The combined force is affected - 1. - 2. - 3. - 4. - 5. - The elastic force of 6 is determined;

[0154] Assumption The direction of the resultant force is towards the distance. 4. Close to 3. Direction;

[0155] First, based on the initial step size, perform one position iteration, and then project the iterated internal vertices and surrounding triangles onto the local plane. The moving vertex in the original space is obtained by mapping the coordinates of the centroid of the projection triangle where the temporary projection point is located.

[0156] Furthermore, based on the step size at each iteration, at most [number] operations are performed. Iterate through the secondary vertex positions, project them, and map them back to the original space. Eventually moves to the direction of the resultant force. , For the internal vertices after iterative update, To be Mapped to the original space A diagram showing the time.

[0157] S215, the third triangular mesh to be optimized is obtained.

[0158] Verify the regularity of all meshes, and filter out the meshes that still violate the regularity constraints, which are the third triangular meshes to be optimized.

[0159] S216. Obtain the second local neighborhood mesh of the third triangular mesh to be optimized, and project the second local neighborhood mesh to obtain the projection plane.

[0160] The second local neighborhood mesh of the third triangular mesh to be optimized is obtained through Breadth-First Search (BFS). The approximate plane of this region is then fitted using the least squares method, and the boundary polygons of the second local neighborhood mesh are projected onto this plane to obtain the projection plane. .

[0161] S217. Determine the expected number of points to be sprinkled in the projection plane based on the equilateral triangle formed by the area of ​​the projection plane and the side length of the target.

[0162] Assume the target side length of the projection plane is perfectly subdivided. An equilateral triangle, the expected number of points to be sprinkled is The boundary points of the projection plane are The theoretical area of ​​the projection plane for:

[0163] ;

[0164] in, Take the average value of the side length of the projection plane boundary.

[0165] Calculate the projection plane using Green's formula actual geometric area :

[0166] ;

[0167] make The inverse solution yields the expected number of sprinkle points. :

[0168] ;

[0169] S218. Obtain the fluctuating neighbor number containing the expected number of sprinkle points.

[0170] Since random point distribution has uncertainty, this scheme adopts a range search + multiple sampling strategy.

[0171] Range search: within the expected number of points to be scattered Within the neighborhood, for example [ -2, +2], to obtain the fluctuation neighbor number .

[0172] For example, if the expected number of spots is... =3, fluctuating neighbor number =1, 2, 3, 4, 5, a total of 5 candidate numbers.

[0173] S219. Based on the number of neighbors and the number of samplings for each fluctuation, randomly place random vertices in the projection plane.

[0174] Multiple sampling: for each Value, repeat execution Next, place random vertices in the projection plane.

[0175] For example, if the number of fluctuating neighbors = 1, 2, 3, the number of sampling times... =5, then

[0176] When the number of fluctuating neighbors is 1, 5 sets of point-spreading schemes are obtained;

[0177] When the number of fluctuating neighbors is 2, 5 sets of point-spreading schemes are obtained;

[0178] When the number of fluctuating neighbors is 3, 5 sets of point-spreading schemes are obtained;

[0179] A total of 15 spot-spreading plans were obtained.

[0180] S220. Generate multiple new regular triangles based on random vertices.

[0181] For each set of point-scattering schemes, Delaunay triangulation is performed to automatically connect vertices and generate multiple uniform triangles, ensuring that the side lengths and interior angles of the new triangles are close to the regularity requirements.

[0182] S221. Determine the optimal point-scattering scheme based on regularity, and map the multiple new regular triangles generated by the optimal point-scattering scheme back to the original space to obtain the layout triangles.

[0183] For all point-scattering schemes, score them according to regularity, such as the pass rate of side length and the size of the minimum interior angle, and select the optimal point-scattering scheme. The new regular triangle of the optimal point-scattering scheme is mapped back to the surface of the original model through the inverse projection operation to obtain the placement triangle. The placement triangle is used to replace the original deformed area.

[0184] like Figure 2b As shown in the left figure, p i p j p k The vertices of the original triangular mesh are used to obtain the layout triangles shown in the right figure through the optimal point-scattering scheme.

[0185] like Figure 2c As shown, (a) and (c) are the original structure diagram of patch1 and the schematic diagram after steps S201-S221, respectively; (b) and (d) are the original structure diagram of patch2 and the schematic diagram after steps S201-S221, respectively.

[0186] This application provides a triangular mesh quality optimization method based on local reconstruction. It quickly corrects triangles with obvious defects such as excessively long or short sides and excessively small interior angles by adjusting the basic topology. Then, it calculates the resultant force of vertices by constructing a spring-mass model and combines it with a local projection operator to achieve precise movement of internal vertices while maintaining the original geometric characteristics of the mesh, thus refining and optimizing the mesh quality. Finally, it employs a local reconstruction strategy using fluctuating neighbor counts and multiple sampling. Through point scattering on the projection plane and Delaunay triangulation, it maps the generated new regular triangles back to the original space, completely solving the persistent distortion problem. Through a progressive optimization logic, it achieves precise improvement and efficient optimization of triangular mesh quality.

[0187] Figure 3 A schematic diagram of a triangular mesh quality optimization system based on local reconstruction, provided in an embodiment of this application, is shown below. Figure 3 As shown, the triangular mesh quality optimization method system 30 based on local reconstruction provided in this embodiment includes:

[0188] The triangular mesh acquisition module 301 is used to acquire triangular meshes and filter the first triangular mesh to be optimized based on a preset regularity. The regularity is used to indicate the quality of the triangular mesh, and the regularity includes side length ratio, side length scale, and interior angle constraint.

[0189] The basic topology adjustment module 302 is used to perform basic topology adjustment on the first triangular mesh to be optimized and obtain a second triangular mesh to be optimized. The basic topology adjustment includes performing edge splitting, edge collapse, and edge swapping based on the quality of the first triangular mesh to be optimized.

[0190] The vertex movement adjustment module 303 is used to obtain the first local neighborhood mesh of the second triangular mesh to be optimized, and move the vertices of the triangular mesh within the first local neighborhood mesh with the first local neighborhood mesh as the boundary to obtain the third triangular mesh to be optimized.

[0191] The local mesh reconstruction module 304 is used to obtain the second local neighborhood mesh of the third triangular mesh to be optimized and the projection plane of the second local neighborhood mesh, determine the placement triangle according to the area of ​​the projection plane and the target side length, and map the placement triangle to the second local neighborhood mesh.

[0192] This embodiment provides a triangular mesh quality optimization system based on local reconstruction, which can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0193] Figure 4 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application, such as... Figure 4 As shown, the electronic device 40 provided in this embodiment includes:

[0194] The device 40 includes at least one processor 401 and a memory 402. Optionally, the device 40 also includes a communication component 403. The processor 401, memory 402, and communication component 403 are connected via a bus 404.

[0195] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.

[0196] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0197] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0198] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0199] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0200] This application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the above-described method.

[0201] This application also provides a computer-readable storage medium storing a computer program / instructions, which, when executed by a processor, implements the above-described method.

[0202] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0203] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0204] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0205] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0206] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0207] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0208] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0209] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for optimizing the quality of triangular meshes based on local reconstruction, characterized in that, The method includes: Obtain a triangular mesh and filter the first triangular mesh to be optimized based on a preset regularity, wherein the regularity is used to indicate the quality of the triangular mesh, and the regularity includes side length ratio, side length scale, and interior angle constraint. A basic topology adjustment is performed on the first triangular mesh to be optimized to obtain a second triangular mesh to be optimized. The basic topology adjustment includes performing edge splitting, edge collapse, and edge swapping based on the quality of the first triangular mesh to be optimized. Obtain the first local neighborhood mesh of the second triangular mesh to be optimized. Using the first local neighborhood mesh as the boundary, move the vertices of the triangular mesh within the first local neighborhood mesh to obtain the third triangular mesh to be optimized. Obtain the second local neighborhood mesh of the third triangular mesh to be optimized and the projection plane of the second local neighborhood mesh. Determine the placement triangle based on the area of ​​the projection plane and the target side length, and map the placement triangle to the second local neighborhood mesh.

2. The method according to claim 1, characterized in that, The basic topology adjustment of the first triangular mesh to be optimized includes: Obtain the side length and interior angle of the first triangular mesh to be optimized; Select the first target side length that is larger than the side length scale, and add split points on the first target side length corresponding to the first target side length to form multiple sub-side lengths smaller than the side length scale; Filter out the second target side length that is smaller than the relevant side length, and merge the two endpoints of the second target side length corresponding to the second target side length to form a merged endpoint. The relevant side length is determined according to the side length ratio and side length scale. Filter the target interior angles that are smaller than the interior angle constraint, obtain the convex quadrilateral formed by the triangular mesh containing the target interior angle and the adjacent triangular meshes, determine whether swapping the diagonals increases the minimum interior angle, if so, swap the diagonals of the quadrilateral to obtain two replacement triangular meshes.

3. The method according to claim 2, characterized in that, The split point is the midpoint of the first target side length.

4. The method according to claim 1, characterized in that, The vertices of the triangular mesh within the first local neighborhood mesh being moved include: Obtain the internal edge length and internal vertices of the triangular mesh in the first local neighborhood mesh; Calculate the resultant force at each internal vertex, which is obtained from the elastic force of the internal edge associated with that internal vertex; Based on the resultant force, determine the movement direction of each internal vertex and iteratively update the internal vertices.

5. The method according to claim 4, characterized in that, The step of determining the movement direction of each internal vertex and iteratively updating the internal vertices based on the resultant force includes: Obtain the coordinates of each internal vertex to be moved and its adjacent internal vertices, and fit the local plane. Project the internal vertices to be moved and the surrounding triangular mesh onto the local plane to obtain the projected vertices and projected triangles; Project the temporary vertex onto the local plane to obtain the temporary projection point; The moving vertex in the original space is obtained by mapping the coordinates of the centroid of the projection triangle where the temporary projection point is located.

6. The method according to claim 5, characterized in that, When determining temporary vertices, the following are included: Determine the temporary vertex based on the internal vertex to be moved and the movement step size; Update the movement step size and temporary vertices within a set number of iterations; The movement step size is obtained based on the initial step size and the attenuation coefficient. The initial step size is obtained based on the resultant force of the internal vertex to be moved and the distance between the internal vertex to be moved and its adjacent internal vertex.

7. The method according to claim 1, characterized in that, The step of determining the arrangement of triangles based on the area of ​​the projection plane and the target side length includes: The expected number of points to be sprinkled in the projection plane is determined based on the equilateral triangle formed by the area of ​​the projection plane and the side length of the target. Random vertices are randomly placed in the projection plane according to the expected number of points to be scattered; Generate multiple new regular triangles based on random vertices; By mapping multiple new regular triangles back to the original space, multiple layout triangles are obtained.

8. The method according to claim 7, characterized in that, After determining the expected number of points to be sprinkled within the projection plane, the process includes: Get the fluctuating neighbor number containing the expected number of sprinkles; Based on each fluctuation neighbor number and sampling number, random vertices are randomly placed in the projection plane; Generate multiple new regular triangles based on random vertices; The optimal point-scattering scheme is determined based on regularity, and the multiple new regular triangles generated by the optimal point-scattering scheme are mapped back to the original space to obtain the layout triangles.

9. A triangular mesh quality optimization system based on local reconstruction, characterized in that, The system includes: A triangular mesh acquisition module is used to acquire triangular meshes and filter the first triangular mesh to be optimized based on a preset regularity. The regularity is used to indicate the quality of the triangular mesh, and the regularity includes side length ratio, side length scale, and interior angle constraints. A basic topology adjustment module is used to perform basic topology adjustment on a first triangular mesh to be optimized and obtain a second triangular mesh to be optimized. The basic topology adjustment includes performing edge splitting, edge collapse, and edge swapping based on the quality of the first triangular mesh to be optimized. The vertex movement and adjustment module is used to obtain the first local neighborhood mesh of the second triangular mesh to be optimized, and move the vertices of the triangular mesh within the first local neighborhood mesh with the first local neighborhood mesh as the boundary to obtain the third triangular mesh to be optimized. The local mesh reconstruction module is used to obtain the second local neighborhood mesh of the third triangular mesh to be optimized and the projection plane of the second local neighborhood mesh. Based on the area of ​​the projection plane and the target side length, the layout triangle is determined and mapped to the second local neighborhood mesh.

10. An electronic device, characterized in that, include: Memory, processor; The memory is used to store computer programs / instructions; The processor is configured to execute the computer program / instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-8.