An optimization method and device of an initial grid, electronic equipment and storage medium

By optimizing the initial mesh, marking the target filling cells, and adding filling points, the problem of insufficient water tightness of the initial mesh was solved, and the robustness and accuracy of Cartesian mesh generation were improved.

CN115935760BActive Publication Date: 2026-04-28BEIJING YUNDAO ZHIZAO TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING YUNDAO ZHIZAO TECH CO LTD
Filing Date
2023-01-10
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing technologies often fail to generate Cartesian meshes due to insufficient water tightness of the initial mesh. Furthermore, existing repair methods are prone to intersecting ambiguities in complex geometric models, which are difficult to control.

Method used

By optimizing the initial mesh, using an envelope surface generation algorithm, marking target filling units, determining vertex feature types, and adding filling points to construct an optimized set of triangular patches, an initial mesh with better water tightness is generated.

Benefits of technology

It improves the robustness of Cartesian mesh generation, avoids the ambiguity of intersection, and ensures the controllability and accuracy of mesh generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115935760B_ABST
    Figure CN115935760B_ABST
Patent Text Reader

Abstract

The application provides an optimization method and device of an initial grid, electronic equipment and a storage medium, relates to the technical field of simulation, and obtains an initial grid of the three-dimensional model; a preset number of filling units are uniformly divided based on the maximum bounding box of the three-dimensional model, and the filling units located outside the three-dimensional model are removed; for each remaining filling unit, if the filling unit intersects with the bounding box of the triangular patch, the filling unit is marked as a target filling unit; for all vertices of each target filling unit, the feature type of each vertex is determined as one of an edge feature point or a corner feature point; the sum of the first type of optimized triangular patch set, the second type of optimized triangular patch set and the third type of optimized triangular patch set is used as the optimized initial grid, the initial grid of the three-dimensional geometric model is repaired and optimized, the water tightness of the initial grid is improved, and the Cartesian grid is accurately generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of simulation technology, and more specifically, to a method, apparatus, electronic device, and storage medium for optimizing an initial mesh. Background Technology

[0002] Fast adaptive mesh generation methods play a crucial role in CFD (Computational Fluid Dynamics) simulations, and efficient, adaptive, and robust Cartesian mesh generation algorithms are favored by most researchers. In generating a Cartesian mesh, it is generally necessary to calculate the intersection between the Cartesian mesh elements and the initial mesh. Based on the intersection result, the mesh elements are classified into internal elements, external elements, and surface elements. If the initial mesh contains small holes or gaps, the intersection calculation is prone to failure, leading to Cartesian mesh generation failure. Therefore, a prerequisite for generating a Cartesian mesh is that the initial triangular facets must meet the watertightness requirement, i.e., the initial mesh elements must be free of gaps and isolated triangular facets.

[0003] While existing technologies exist for repairing poorly watertight meshes, these methods typically involve enlarging triangular meshes proportionally using a "fat triangle" approach to fill gaps and repair the mesh. However, this approach becomes problematic when dealing with complex geometric models. The enlargement of the triangular mesh is memory-intensive, so floating-point numbers are generally represented using `float`, which has an effective precision of 5 decimal places. Therefore, approximations are often used in intersection calculations. This leads to ambiguity in intersection finding (actual vertices can only belong to one triangle, but a tolerance-based approach might allow a point to belong to two triangles simultaneously), making the problem unpredictable. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide an initial mesh optimization method, apparatus, electronic device and storage medium to repair and optimize the initial mesh of a three-dimensional geometric model, improve the water tightness of the initial mesh, and accurately generate a Cartesian mesh.

[0005] In a first aspect, this application provides a method for optimizing an initial mesh. The method includes obtaining an initial mesh for a 3D model created in modeling software, wherein the initial mesh is a plurality of triangular patches divided based on the surface of the 3D model; uniformly dividing a preset number of filling units based on the maximum bounding box of the 3D model, and removing filling units located outside the 3D model; for each remaining filling unit, if the filling unit intersects with the bounding box of a triangular patch, marking the filling unit as a target filling unit; for all vertices of each target filling unit, determining the feature type of each vertex as either an edge feature point or a corner feature point; for other unmarked filling units, constructing a first-type optimized triangular patch set based on all vertices determined in all other filling units; for all edge feature points, adding two filling points to each edge feature point to construct a second-type optimized triangular patch set, and for all corner feature points, adding one filling point to each corner feature point to construct a third-type optimized triangular patch set; and using the sum of the first-type optimized triangular patch set, the second-type optimized triangular patch set, and the third-type optimized triangular patch set as the optimized initial mesh.

[0006] Preferably, it also includes combining the initial mesh and the optimized initial mesh to generate a Cartesian mesh for the 3D model.

[0007] Preferably, the initial mesh and the optimized initial mesh are combined in the following way: for each edge of each optimized triangular facet in the optimized initial mesh, determine whether the edge intersects with the triangular facet in the initial mesh; if they intersect, calculate the intersection point; based on all the calculated intersection points and all the vertices in the optimized initial mesh, a new triangular mesh is re-divided.

[0008] Preferably, for each vertex of each identified target filling unit, the feature type of the vertex is determined as follows: a vertex set is constructed based on the vertex and its adjacent vertices; multiple component matrices are constructed based on the components of the vertex's normal vector along the three axes of the coordinate system, and the components of the normal vector of each target vertex in the vertex set along the three axes of the coordinate system; all component matrices are weighted and summed to generate the tensor matrix corresponding to the vertex, and at least one eigenvalue and eigenvector of the tensor matrix are calculated, wherein the eigenvector is used to determine the corresponding filling point; based on the magnitude of all calculated eigenvalues, the feature type of the vertex is determined to be either an edge feature point or a corner feature point.

[0009] Preferably, all feature values ​​are arranged in ascending order as first feature value, second feature value, and third feature value. The step of determining whether a vertex is an edge feature point or a corner feature point based on the magnitude of all calculated feature values ​​specifically includes: calculating a first difference between the second feature value and the first feature value, and calculating a second difference between the third feature value and the first feature value; if both the first and second differences are greater than a preset value, the feature type of the vertex is determined to be an edge feature point; if both the first and second differences are less than the preset value, a third difference between the second and third feature values ​​is calculated; if the third difference is also less than the preset value, the feature type of the vertex is determined to be a corner feature point.

[0010] Preferably, for each vertex of the target filling unit and a target vertex in the vertex set, a corresponding component matrix is ​​constructed in the following manner: The components of the vertex's normal vector along the three axes of the coordinate system are determined, namely, the first component along the first axis, the first component along the second axis, and the first component along the third axis; the components of the target vertex's normal vector along the three axes of the coordinate system are determined, namely, the second component along the first axis, the second component along the second axis, and the second component along the third axis; the products of the first and second components of the first and second axes, the first and second components of the first and third axes, are used as the three values ​​in the first row of the component matrix; the products of the first and second components of the second and third axes, the first and second components of the second and third axes, are used as the three values ​​in the second row of the component matrix; the products of the first and second components of the third axis, the second and second components of the third axis, and the second and second components of the third axis are used as the three values ​​in the third row of the component matrix.

[0011] Preferably, for each vertex of the target filling unit and a target vertex in the vertex set, the weight value corresponding to the component matrix is ​​determined in the following way: the distance between the vertex and the target vertex is calculated, and the standardized distance value is used as the corresponding weight value.

[0012] Secondly, this application provides an optimization apparatus for an initial mesh, the apparatus comprising:

[0013] The extraction module is used to obtain the initial mesh of a 3D model created in the modeling software. The initial mesh is a set of multiple triangular facets based on the surface division of the 3D model.

[0014] The fill module is used to uniformly divide a preset number of fill units based on the maximum bounding box of the 3D model, and remove fill units located outside the 3D model.

[0015] The marking module is used to mark each remaining fill cell as a target fill cell if it intersects with the bounding box of the triangle facet.

[0016] The judgment module is used to determine whether the feature type of each vertex in each target filling unit is either an edge feature point or a corner feature point.

[0017] The first building module is used to construct a first-class optimized triangle patch set based on all vertices determined in all other unlabeled fill units;

[0018] The second construction module is used to add two fill points to each edge feature point to construct a second type of optimized triangular patch set, and to add one fill point to each corner feature point to construct a third type of optimized triangular patch set.

[0019] The output module is used to take the sum of the sets of the first type of optimized triangular facets, the second type of optimized triangular facets, and the third type of optimized triangular facets as the optimized initial mesh.

[0020] Thirdly, this application also provides an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the initial grid optimization method described above are performed.

[0021] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the initial grid optimization method described above.

[0022] The initial mesh optimization method, apparatus, electronic device, and storage medium provided in this application obtain an initial mesh for a 3D model created in modeling software. The initial mesh consists of multiple triangular facets divided based on the surface of the 3D model. Based on the maximum bounding box of the 3D model, a predetermined number of fill units are uniformly divided, and fill units located outside the 3D model are removed. For each remaining fill unit, if it intersects with the bounding box of a triangular facet, it is marked as a target fill unit. For all vertices of each target fill unit, the feature type of each vertex is determined to be either an edge feature point or a corner feature point. For other unmarked fill units, a first-class optimized triangular facet set is constructed based on all vertices determined in all other fill units. For all edge feature points, two fill points are added to each edge feature point to construct a second-class optimized triangular facet set, and for all corner feature points, one fill point is added to each corner feature point to construct a third-class optimized triangular facet set. The sum of the first set of optimized triangular facets, the second set of optimized triangular facets, and the third set of optimized triangular facets is used as the optimized initial mesh. This process repairs and optimizes the initial mesh with the envelope surface, resulting in an initial mesh with better water tightness, thereby improving the robustness of Cartesian mesh generation.

[0023] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 A flowchart illustrating an initial mesh optimization method provided in an embodiment of this application;

[0026] Figure 2 A flowchart illustrating the steps for determining the feature type of a vertex, as provided in an embodiment of this application;

[0027] Figure 3 A flowchart illustrating a method for generating a Cartesian grid as provided in an embodiment of this application;

[0028] Figure 4 A schematic diagram illustrating the calculation principle of unsigned distance provided in an embodiment of this application;

[0029] Figure 5 A schematic diagram of the structure of an initial mesh optimization device provided in an embodiment of this application;

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

[0031] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.

[0032] First, the applicable scenarios for this application are introduced. This application can be applied to the repair of the initial triangular mesh on which Cartesian mesh generation depends.

[0033] Fast adaptive mesh generation methods play an important role in CFD simulation calculations, and efficient, adaptive, and robust Cartesian mesh generation algorithms are favored by most researchers.

[0034] In Cartesian mesh generation, the initial input geometric model is typically a discrete surface triangular mesh. The generation process generally involves calculating the intersection of the Cartesian mesh elements with the initial surface triangular mesh. Based on the intersection result, the mesh elements are categorized into internal elements (Cartesian mesh elements located inside the surface triangular mesh), external elements (Cartesian mesh elements located outside the surface triangular mesh), and object surface elements (Cartesian mesh elements intersecting with the surface triangular mesh). If the background mesh contains small holes or gaps, the intersection calculation is prone to failure, leading to Cartesian mesh generation failure. Therefore, a prerequisite for generating a Cartesian mesh is that the initial triangular mesh must meet the watertightness requirement, meaning the initial triangular mesh elements must be free of gaps and isolated triangular faces.

[0035] In practical engineering applications, when generating initial triangular meshes from 3D geometric models, the complexity of the structural features of the 3D geometric models themselves, as well as errors caused by data conversion between geometric models, often results in initial triangular meshes that do not meet watertightness requirements. This leads to Cartesian mesh generation failure and affects subsequent simulation calculations. To address this issue, an envelope surface generation algorithm is presented here, which can quickly generate watertight triangular meshes. These meshes are then combined with the original mesh to serve as the initial triangular mesh for Cartesian mesh generation.

[0036] While existing technologies exist for mesh repair, they typically involve enlarging triangular meshes proportionally using a "fat triangle" approach to fill gaps and repair the mesh. This method is problematic when dealing with complex geometric models. While enlarging the triangular mesh is memory-intensive (Cartesian mesh generation uses float, which has 5 decimal places, leading to approximations in intersection calculations), it introduces ambiguity. A vertex can only belong to one triangle, but using tolerances might result in a point belonging to two triangles simultaneously, making the problem unpredictable.

[0037] Based on this, embodiments of this application provide an initial mesh optimization method, apparatus, electronic device, and storage medium to provide a robust envelope surface generation algorithm for various hole conditions.

[0038] Please see Figure 1 , Figure 1 This is a flowchart illustrating an initial mesh optimization method provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the method for optimizing the initial mesh includes:

[0039] S101. For a 3D model created in the modeling software, obtain the initial mesh of the 3D model. The initial mesh is a plurality of triangular facets based on the surface division of the 3D model.

[0040] In this step, the initial triangular mesh (i.e., the initial grid) is a series of triangular patches based on the surface of the 3D model. This mesh can be obtained by outputting a corresponding STL (stereolithography) file from the established 3D geometric model using 3D software (such as CAD). The STL file consists of the definitions of multiple triangular patches, each including the 3D coordinates of the triangle's vertices and the normal vector of the triangular patch.

[0041] S102. Based on the maximum bounding box of the 3D model, uniformly divide the model into a preset number of fill units and remove fill units located outside the 3D model.

[0042] In this step, a grid tree of surface meshes can be created, with the tree resolution determined by its sensitivity to small holes. A grid tree can be understood as filling a 3D geometric model with neatly arranged cubes or cuboids. The grid tree format is used for quickly locating infill cells. This means that the remaining infill cells include those located inside the 3D model and those intersecting with the surface of the 3D model.

[0043] S103. For each remaining fill cell, if the fill cell intersects with the bounding box of the triangular facet, then mark the fill cell as the target fill cell.

[0044] In step S103, the bounding box used here is an AABB bounding box. For each remaining fill cell, the fill cell is marked as long as it intersects with the bounding boxes of one or more triangular faces.

[0045] S104. For all vertices of each target filling unit, determine the feature type of each vertex as either an edge feature point or a corner feature point.

[0046] It is understandable that each target filling unit has eight vertices, and the type of each determined vertex needs to be determined separately.

[0047] Please see Figure 2 , Figure 2 This is a flowchart illustrating a step for determining the feature type of a vertex according to an embodiment of this application. In step S104, specifically, for each vertex of each determined target filling unit, the feature type of the vertex is determined in the following manner:

[0048] S1040. Construct a vertex set based on the vertex and the other vertices adjacent to it.

[0049] For any vertex P(s0, n0) and the neighborhood set O = {P1, P2, P3, ..., Pn0} of its surrounding points... n Here, s0 indicates the signed distance of the vertex, and n0 indicates the orientation field of the vertex.

[0050] This requires calculating the unsigned distance and orientation field from the marked cells in the Grid tree to the object surface. The direction of the unsigned distance is determined by the normal vector of the triangular mesh, and the orientation field is the direction of the normal vector of the triangular facet closest to the target filling cell. The normal vector is a vector determined by the order of the three points of the triangle (generally using the right-hand screw rule). The normal vector is perpendicular to the surface of the triangle, and according to the right-hand screw rule, the vector size is the area of ​​the triangle.

[0051] The steps for determining the correspondence between each element and the surface element are as follows:

[0052] Set the initial distance value of the Grid to infinity. Iterate through each triangle and calculate its AABB bounding box to quickly determine the vertices of the surrounding bounding boxes. Calculate the precise unsigned distance from the vertex inside the bounding box to the triangle. If this distance is less than the current distance value of the Grid vertex, then modify the corresponding triangle to the current triangle (here, it is necessary to record whether the nearest point is a face point, edge point, or corner point. If it is a face point, take the face's normal vector; if it is an edge point, take the weighted average of the normal vectors of two adjacent triangles; corner points are treated the same as edge points).

[0053] Please see Figure 4 , Figure 4 This is a schematic diagram illustrating the calculation principle of unsigned distance provided in an embodiment of this application. For calculating the signed distance from a point to a surface element, if traversal is used, the computational complexity is O(n^2). 2 Alternatively, a background mesh BVH tree can be created, with a computational complexity of O(log(n)). This can be done by inverse calculation, i.e., finding the distances to points in the surrounding bounding box from the object surface.

[0054] S1042. Based on the components of the normal vector of the vertex in the three axes of the coordinate system, and the components of the normal vector of each target vertex in the vertex set in the three axes of the coordinate system, construct multiple component matrices.

[0055] Specifically, the feature type of the vertices is determined using tensor voting. For each vertex of the target filling unit and a target vertex in the vertex set, a corresponding component matrix is ​​constructed as follows:

[0056] The components of the normal vector of the vertex along the three axes of the coordinate system are determined, namely the first component along the first axis, the first component along the second axis, and the first component along the third axis. The components of the normal vector of the target vertex along the three axes of the coordinate system are determined, namely the second component along the first axis, the second component along the second axis, and the second component along the third axis.

[0057] The products of the first component of the first axis and the second component of the first axis, the first component of the first axis and the second component of the second axis, and the first component of the first axis and the second component of the third axis are taken as the three values ​​in the first row of the component matrix; the products of the first component of the second axis and the second component of the first axis, the first component of the second axis and the second component of the second axis, and the first component of the second axis and the second component of the third axis are taken as the three values ​​in the second row of the component matrix; the products of the first component of the third axis and the second component of the first axis, the second component of the third axis and the second component of the second axis, and the second component of the third axis and the second component of the third axis are taken as the three values ​​in the third row of the component matrix.

[0058] For any component matrix, it can be represented as:

[0059]

[0060] Where i = 1, 2, 3…n, indicating the label of the target vertex. 0x Let n be the component of the normal vector of this vertex on the X-axis. 0y Let n be the component of the normal vector of the vertex on the Y-axis. 0z The components of the vertex's normal vector on the Z-axis, n ix Let n be the component of the normal vector of the target vertex on the X-axis. iy Let n be the component of the normal vector of the target vertex on the Y-axis. iz The component of the normal vector of the target vertex on the Z-axis.

[0061] S1044. Perform a weighted summation on all component matrices to generate the tensor matrix corresponding to the vertex, and calculate at least one eigenvalue and eigenvector of the tensor matrix, wherein the eigenvector is used to determine the corresponding filling point.

[0062] Calculate the tensor matrix M = ∑wM 0i , and the eigenvalues ​​and eigenvectors of the tensor matrix. Here, w is the weight value corresponding to each component matrix.

[0063] Specifically, for each vertex of the target filling unit and a target vertex in the vertex set, the weight value corresponding to the component matrix is ​​determined in the following way:

[0064] Calculate the distance between the current vertex and the target vertex, and use the standardized distance as the corresponding weight value.

[0065] The weight of each component matrix can be determined by the distance between the corresponding vertex and the target vertex. Normalization here refers to taking the reciprocal of the distance value.

[0066] S1046. Based on the magnitude of all calculated feature values, determine whether the feature type of the vertex is either an edge feature point or a corner feature point.

[0067] The eigenvalues ​​of the tensor matrix are used to determine the type of the vertex, while the eigenvectors are used to calculate the corresponding fill points.

[0068] Specifically, the steps of determining whether a vertex is an edge feature point or a corner feature point based on the magnitude of all calculated feature values, in ascending order, are as follows:

[0069] Calculate the first difference between the second eigenvalue and the first eigenvalue, and calculate the second difference between the third eigenvalue and the first eigenvalue. If both the first and second differences are greater than preset values, the vertex is determined to be an edge feature point. If both the first and second differences are less than preset values, calculate the third difference between the second and third eigenvalues. If the third difference is also less than the preset value, the vertex is determined to be a corner feature point.

[0070] Here, the eigenvalues ​​are sorted from smallest to largest: the first eigenvalue V1, the second eigenvalue V2, and the third eigenvalue V3. If V2 and V3 are relatively close, and V1 is much smaller than V2 and V3, then the point is an edge feature point. If V1, V2, and V3 are relatively close, then the point is a corner feature point.

[0071] Specifically, for each edge feature point, the two corresponding fill points are obtained by weighted summation of the eigenvectors corresponding to V2 and V1, and for each corner feature point, by weighted summation of the eigenvectors corresponding to V3 and V1. For each corner feature point, the fill point is added by weighted summation of the eigenvectors corresponding to V1, V2, V3, and their respective features. The principle for adding fill points is to ensure that the change in the normal vector obtained after segmenting the original point set by the newly added fill point is minimized.

[0072] S105. For other unlabeled filling units, construct a set of optimized triangle patches of the first type based on all vertices determined in all other filling units.

[0073] S106. For all edge feature points, add two fill points to each edge feature point to construct a second type of optimized triangular patch set; and for all corner feature points, add one fill point to each corner feature point to construct a third type of optimized triangular patch set.

[0074] S107. The sum of the sets of the first type of optimized triangular facets, the second type of optimized triangular facets, and the third type of optimized triangular facets is used as the optimized initial mesh.

[0075] In steps S105 to S107, for non-feature point meshes, faces are directly generated using the marching cube method. For edge feature points, two fill points are added before generating faces. For corner feature points, one fill point is calculated and added before generating faces. Generally, adding two points to edge feature points to determine new feature edges is sufficient; the case for corner points is slightly more complex. Because the mesh itself is an approximate representation, it is sufficient to control the maximum error between the mesh and the original mesh surface to be within an acceptable range. Here, the flip-edge method can be used to add points; flip-edge is a commonly used meshing algorithm.

[0076] Please see Figure 3 , Figure 3 This is a flowchart illustrating a method for generating a Cartesian mesh according to an embodiment of this application. Further, it includes step S108, combining the initial mesh and the optimized initial mesh to generate a Cartesian mesh for a 3D model.

[0077] Specifically, the initial mesh and the optimized initial mesh are combined in the following way:

[0078] For each edge of each optimized triangular facet in the optimized initial mesh, determine whether the edge intersects with a triangular facet in the initial mesh. If they intersect, calculate the intersection point. Based on all calculated intersection points and all vertices in the optimized initial mesh, re-divide the mesh into a new triangular mesh.

[0079] First, the intersection points of the grid edges and the original grid cells need to be calculated. These intersection points directly participate in the generation of the new grid. Next, the curvature and other information of the original grid are calculated. Based on the curvature, the newly generated grid undergoes adaptive remesh (referring to mesh re-division). After remesh, it needs to be projected back onto the original surface. During projection, it is necessary to check for self-intersections. If self-intersections occur, no projection is performed; instead, the surrounding non-self-intersecting points are projected. Self-intersections can be handled using methods such as smoothing. The error between the original grid and the new grid is calculated. If the error is not within the accuracy range, the curvature calculation steps are repeated until the requirements are met. The step of re-dividing the triangular mesh can be implemented in many existing technologies and will not be elaborated further. The surface extraction process can be performed using the marching cube algorithm.

[0080] This application provides an initial mesh optimization method applicable to the repair of initial triangular facet meshes upon which Cartesian mesh generation depends, thereby improving the robustness of Cartesian mesh generation. Compared to the prior art method of using fat triangles to repair the initial mesh, this method avoids ambiguity during the Cartesian mesh generation process.

[0081] Based on the same inventive concept, this application also provides an initial mesh optimization device corresponding to the initial mesh optimization method. Since the principle of the device in this application is similar to the initial mesh optimization method described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0082] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an initial mesh optimization device provided in an embodiment of this application, as shown below. Figure 5 As shown, the initial mesh optimization device 500 includes:

[0083] The extraction module 510 is used to obtain the initial mesh of the three-dimensional model created in the modeling software. The initial mesh is a plurality of triangular facets based on the surface division of the three-dimensional model.

[0084] The filling module 520 is used to uniformly divide a preset number of filling units based on the maximum bounding box of the 3D model and remove filling units located outside the 3D model.

[0085] The marking module 530 is used to mark each remaining fill cell as a target fill cell if the fill cell intersects with the bounding box of the triangular facet.

[0086] The judgment module 540 is used to determine the feature type of each vertex as either an edge feature point or a corner feature point for all vertices of each target filling unit.

[0087] The first building module 550 is used to construct a first-class optimized triangle patch set based on all vertices determined in all other filling units that are not labeled.

[0088] The second construction module 560 is used to add two fill points to each edge feature point to construct a second type of optimized triangular patch set, and to add one fill point to each corner feature point to construct a third type of optimized triangular patch set.

[0089] Output module 570 is used to take the sum of the set of the first type of optimized triangular facets, the set of the second type of optimized triangular facets, and the set of the third type of optimized triangular facets as the optimized initial mesh.

[0090] In a preferred embodiment, a processing module (not shown) is further included for combining the initial mesh and the optimized initial mesh to generate a Cartesian mesh for the 3D model.

[0091] In a preferred embodiment, the processing module combines the initial mesh and the optimized initial mesh in the following manner: for each edge of each optimized triangular facet in the optimized initial mesh, it determines whether the edge intersects with the triangular facet in the initial mesh; if they intersect, the intersection point is calculated; based on all the calculated intersection points and all the vertices in the optimized initial mesh, a new triangular mesh is re-divided.

[0092] In a preferred embodiment, for each vertex of each determined target filling unit, the determination module 540 determines the feature type of the vertex in the following manner: constructing a vertex set based on the vertex and other adjacent vertices; constructing multiple component matrices based on the components of the vertex's normal vector along the three axes of the coordinate system, and the components of the normal vector of each target vertex in the vertex set along the three axes of the coordinate system; performing a weighted summation on all component matrices to generate a tensor matrix corresponding to the vertex, and calculating at least one eigenvalue and eigenvector of the tensor matrix, wherein the eigenvector is used to determine the corresponding filling point; and determining the feature type of the vertex as either an edge feature point or a corner feature point based on the magnitude of all calculated eigenvalues.

[0093] In a preferred embodiment, all feature values ​​are arranged in ascending order as first feature value, second feature value, and third feature value. The judgment module 540 is specifically used to calculate the first difference between the second feature value and the first feature value, and to calculate the second difference between the third feature value and the first feature value. If both the first difference and the second difference are greater than a preset value, the feature type of the vertex is determined to be an edge feature point. If both the first difference and the second difference are less than the preset value, the third difference between the second feature value and the third feature value is calculated. If the third difference is also less than the preset value, the feature type of the vertex is determined to be a corner feature point.

[0094] In a preferred embodiment, for each vertex of the target filling unit and a target vertex in the vertex set, the determination module 540 constructs a corresponding component matrix in the following manner: The components of the normal vector of the vertex along the three axes of the coordinate system are determined, namely, the first component along the first axis, the first component along the second axis, and the first component along the third axis; the components of the normal vector of the target vertex along the three axes of the coordinate system are determined, namely, the second component along the first axis, the second component along the second axis, and the second component along the third axis; the product of the first component and the second component along the first axis, the product of the first component and the second component along the second axis, and the product of the first component and the second component along the third axis are used as the three values ​​in the first row of the component matrix; the product of the first component and the second component along the second axis, the product of the first component and the second component along the second axis, and the product of the first component and the second component along the third axis are used as the three values ​​in the second row of the component matrix; the product of the first component and the second component along the third axis, the product of the second component and the second component along the second axis, and the product of the second component and the second component along the third axis are used as the three values ​​in the third row of the component matrix.

[0095] In a preferred embodiment, for each vertex of the target filling unit and a target vertex in the vertex set, the determination module 540 determines the weight value corresponding to the corresponding component matrix in the following way: calculates the distance value between the vertex and the target vertex, and uses the standardized distance value as the corresponding weight value.

[0096] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 600 includes a processor 610, a memory 620, and a bus 630.

[0097] The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 is running, the processor 610 and the memory 620 communicate via the bus 630. When the machine-readable instructions are executed by the processor 610, they can perform the operations described above. Figure 1 The steps of the initial mesh optimization method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0098] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1The steps of the initial mesh optimization method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0099] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0100] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0101] 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.

[0102] In addition, the functional units in the various embodiments of this application 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.

[0103] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion 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 described in the various embodiments of this application. 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.

[0104] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for optimizing an initial mesh, characterized in that, The method includes: For a 3D model created in modeling software, obtain the initial mesh of the 3D model. The initial mesh is a plurality of triangular facets based on the surface division of the 3D model. Based on the maximum bounding box of the 3D model, a predetermined number of filling units are uniformly divided, and filling units located outside the 3D model are removed. For each remaining fill cell, if the fill cell intersects with the bounding box of the triangle, then the fill cell is marked as the target fill cell; For all vertices of each target filling unit, determine the feature type of each vertex as either an edge feature point or a corner feature point; For the other unlabeled filling units, construct a first-class optimized triangle patch set based on all vertices determined in all other filling units; For all edge feature points, two fill points are added to each edge feature point to construct a second type of optimized triangular patch set; and for all corner feature points, one fill point is added to each corner feature point to construct a third type of optimized triangular patch set. The sum of the set of the first type of optimized triangular facets, the set of the second type of optimized triangular facets, and the set of the third type of optimized triangular facets is used as the optimized initial mesh; The initial mesh and the optimized initial mesh are combined to generate the Cartesian mesh of the 3D model; the initial mesh and the optimized initial mesh are combined in the following way: For each edge of each optimized triangular facet in the optimized initial mesh, determine whether the edge intersects with a triangular facet in the initial mesh; If they intersect, calculate the intersection point; Based on all calculated intersections and all vertices in the optimized initial mesh, a new triangular mesh is redefined; for each vertex of each identified target fill cell, the feature type of that vertex is determined as follows: Construct a set of vertices based on the given vertex and its adjacent vertices; Based on the components of the normal vector of the vertex along the three axes of the coordinate system, and the components of the normal vector of each target vertex in the vertex set along the three axes of the coordinate system, multiple component matrices are constructed. The component matrices are weighted and summed to generate the tensor matrix corresponding to the vertex, and at least one eigenvalue and eigenvector of the tensor matrix are calculated, wherein the eigenvector is used to determine the corresponding filling point; Based on the magnitude of all calculated feature values, the feature type of the vertex is determined to be either an edge feature point or a corner feature point.

2. The method according to claim 1, characterized in that, All eigenvalues, ranked from smallest to largest, are the first eigenvalue, the second eigenvalue, and the third eigenvalue. The step of determining whether a vertex is an edge feature point or a corner feature point based on the magnitude of all calculated eigenvalues ​​specifically includes: Calculate the first difference between the second feature value and the first feature value, and calculate the second difference between the third feature value and the first feature value; If both the first difference and the second difference are greater than a preset value, then the feature type of the vertex is determined to be an edge feature point; If both the first difference and the second difference are less than the preset value, then the third difference between the second feature value and the third feature value is calculated. If the third difference is also less than the preset value, then the feature type of the vertex is determined to be a corner feature point.

3. The method according to claim 1, characterized in that, For each vertex of the target filling unit and a target vertex in the vertex set, a corresponding component matrix is ​​constructed in the following way: The components of the normal vector of the vertex along the three axes of the coordinate system are determined, namely the first component of the first axis, the first component of the second axis, and the first component of the third axis. The components of the normal vector of the target vertex along the three axes of the coordinate system are determined, namely the second component of the first axis, the second component of the second axis, and the second component of the third axis. The product of the first component of the first axis and the second component of the first axis, the product of the first component of the first axis and the second component of the second axis, and the product of the first component of the first axis and the second component of the third axis are used as the three values ​​of the first row of the component matrix. The product of the first component of the second axis and the second component of the first axis, the product of the first component of the second axis and the second component of the second axis, and the product of the first component of the second axis and the second component of the third axis are taken as the three values ​​of the second row of the component matrix. The product of the first component of the third axis and the second component of the first axis, the product of the second component of the third axis and the second component of the second axis, and the product of the second component of the third axis and the second component of the third axis are taken as the three values ​​of the third row of the component matrix.

4. The method according to claim 3, characterized in that, For each vertex of the target filling unit and a target vertex in the vertex set, the weight value corresponding to the component matrix is ​​determined in the following way: Calculate the distance between the current vertex and the target vertex, and use the standardized distance as the corresponding weight value.

5. An initial mesh optimization apparatus, applicable to the initial mesh optimization method according to any one of claims 1-4, characterized in that, The device includes: The extraction module is used to obtain the initial mesh of a 3D model created in the modeling software. The initial mesh is a plurality of triangular facets based on the surface division of the 3D model. The filling module is used to uniformly divide a preset number of filling units based on the maximum bounding box of the 3D model, and remove filling units located outside the 3D model. The marking module is used to mark each remaining fill cell as a target fill cell if it intersects with the bounding box of the triangle facet. The judgment module is used to determine whether the feature type of each vertex in each target filling unit is either an edge feature point or a corner feature point. The first building module is used to construct a first-class optimized triangle patch set based on all vertices determined in all other unlabeled fill units; The second construction module is used to add two fill points to each edge feature point to construct a second type of optimized triangular patch set, and to add one fill point to each corner feature point to construct a third type of optimized triangular patch set. The output module is used to take the sum of the set of the first type of optimized triangular facets, the set of the second type of optimized triangular facets, and the set of the third type of optimized triangular facets as the optimized initial mesh.

6. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the optimization method for the initial grid as described in any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the optimization method for the initial mesh as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Three-dimensional model simplification method and device, computer equipment and computer storage medium

    CN114241151A