Hybrid tetrahedral mesh generation method based on ray tracing and A15 lattice
By using a hybrid tetrahedral mesh generation method combining ray tracing and A15 lattice, the problems of high computational complexity and large storage overhead in mesh generation in existing technologies are solved, achieving efficient and high-quality mesh generation, especially in surface restoration and sharp feature preservation of complex models.
Patent Information
- Application Number
- CN202511534489.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-10-27
AI Technical Summary
Existing tetrahedral mesh generation algorithms cannot accurately reproduce the geometric features of the model surface during surface reconstruction, and have high computational complexity and storage overhead, making them unsuitable for large-scale complex models.
A hybrid tetrahedral mesh generation method based on ray tracing and A15 lattice is adopted. Through spatial partitioning, region partitioning, octree construction and ray filling, combined with the Delaunay method, efficient and high-quality mesh generation is achieved.
It significantly reduces computational complexity and storage overhead, and improves mesh quality, especially in surface reconstruction and sharp feature preservation of complex models. The generated mesh quality and efficiency are superior to traditional methods.
Smart Images

Figure CN121010731A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, specifically relating to a method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice. Background Technology
[0002] Classic tetrahedral mesh generation algorithms mainly include the Delaunay method and the advance-front method. While the Delaunay method has a sound theoretical foundation, it inevitably produces low-quality tetrahedra, known as "thin-sheet elements," making it difficult to stably generate high-quality meshes. The advance-front method has high time complexity and is prone to advance-front conflicts when dealing with complex models, leading to decreased element quality, convergence problems, and insufficient robustness.
[0003] To overcome the limitations of classical algorithms, researchers have proposed mesh-filling methods in recent years. Among them, the isosurface filling method based on the signed distance field proposed by Labelle and Shewchuk is representative. This method demonstrates significant advantages in mesh quality, generation efficiency, and robustness by filling the model with predefined high-quality tetrahedron sets.
[0004] However, existing mesh filling methods still face two major challenges: First, they heavily rely on the accuracy of the model's symbolic distance field when reconstructing surfaces and cannot preserve sharp edges and corners, making them only suitable for smooth surfaces or scenarios where surface details are not a concern; Second, the construction cost of the symbolic distance field is high, as it requires calculating the distance from each spatial grid point to the surface and determining internal and external attributes, while also storing a large amount of grid information, resulting in huge computational and memory overhead, making it difficult to apply to large-scale problems.
[0005] Therefore, there is an urgent need for a tetrahedral mesh filling method that can accurately reproduce the geometric features of the model surface and has high efficiency and low storage overhead, so as to meet the requirements of high-quality mesh generation. Summary of the Invention
[0006] To address the shortcomings and deficiencies of existing mesh filling methods, this application provides a hybrid tetrahedral mesh generation method based on ray tracing and A15 lattice, the technical solution of which is as follows: A hybrid tetrahedral mesh generation method based on ray tracing and A15 lattice includes the following steps: S1. Spatial Mesh Generation and Intersection Detection: The input target model space is divided into cubic meshes, and the intersection relationship between the surface triangles and the spatial cubic mesh is determined; S2. Region division and object filling: The space is divided into regions based on a hybrid strategy. The internal regions are filled with A15 lattice, and the boundary regions are reduced and sharp features are preserved using the Delaunay method. S3. Octree construction and ray tracing method: Construct an octree accelerated structure, use ray tracing to quickly identify the internal filling region, and generate filling line segments to determine the location where A15 lattice filling is required; S4. Hierarchical mesh generation.
[0007] Preferably, in step S1, the space is divided into cubic meshes, and the specific steps are as follows: After reading the input target model, according to the preset mesh step size The model's 3D space is divided into uniform cubic meshes. The spatial meshing process needs to meet two key constraints: boundary buffer settings and a four-fold alignment requirement. Calculate the basic grid span in each coordinate direction based on the model bounding box: ; in For the model in the first Length in each coordinate direction The grid step size; The number of grid cells is calculated using the formula: ; in The formula for the four-fold alignment compensation term is as follows: .
[0008] Preferably, the intersection detection step in step S1 is as follows: Step 1: Traverse each triangle in the surface triangular mesh. For each of the three vertices of the triangle... Construct its axis-aligned bounding box and expand it by one mesh step in each direction. The distance is determined to ensure that the bounding box can cover all grid cells that may intersect with the triangle; Step 2: Determine the range of mesh cells to be detected based on the expanded bounding box, convert the bounding box coordinates to mesh indices, and calculate the range of mesh indices involved. ; ; in, and These are the minimum and maximum coordinates of the expanded bounding box, respectively. The origin of the grid. The side length of the grid cell; Step 3: Detect each grid cell within the defined range one by one: For cells with grid coordinates (x, y, z), construct their corresponding bounding boxes and employ a two-level detection strategy: The first stage performs fast intersection detection between bounding boxes, including determining geometric relationships such as intersection and containment; The second level uses the separating axis theorem to perform precise intersection detection of triangles and bounding boxes on the mesh cells that have passed the first level of screening; Step 4: Store the detected intersection information in the form of {grid coordinates, triangle index}, and sort it according to the lexicographical order of the grid coordinates for easy querying and access in subsequent processing stages.
[0009] Preferably, step S2, region partitioning, employs a hybrid strategy: the space is divided into boundary regions and internal filling regions based on the relative positional relationship between the mesh elements and the geometric boundaries of the model; for the internal filling regions, A15 lattices are directly used for regular filling, specifically: the coordinates of the 27 vertices of the lattice are translated according to the target mesh position, and then 46 tetrahedral elements are filled into the corresponding positions. The coordination number of all edges of the A15 lattice is 5 or 6, so that the filled tetrahedral elements can approximate the ideal regular tetrahedral configuration to the greatest extent; for the boundary regions, the Delaunay method is used to generate tetrahedral meshes within the region.
[0010] Preferably, step S3 uses an octree data structure to perform spatial hierarchical partitioning of the triangular mesh on the model surface; the octree construction adopts a non-uniform subdivision strategy, and adaptively partitions according to the spatial distribution density of the geometric model, as follows: First, calculate the axis-aligned bounding box of the root node by traversing all triangle vertices; Then, recursive space partitioning is performed, dividing the current node into 8 sub-cubes evenly, and the triangles are assigned to the corresponding sub-nodes according to their centroid positions; Finally, the bounding boxes of the leaf nodes are recalculated to ensure that all triangles within the node are completely contained, and the bounding boxes of all parent nodes are recursively updated upwards to maintain the geometric consistency of the entire octree structure; the recursive segmentation terminates when the number of triangles in a node is less than a preset value or when the maximum depth is reached.
[0011] Preferably, step S3, the ray filling method, involves quickly identifying the internal filling region by constructing a regular ray array, as follows: With the Y-axis as the incident direction of the light ray, in A regular array of rays is constructed on a plane, and the coordinates of the ray origin are represented as follows: ; in Let be the index coordinates of the center point of the XZ plane grid, satisfying , that is to The spacing between the light rays is designed to ensure consistency with the grid size required for subsequent A15 lattice filling.
[0012] Preferably, for each constructed ray, an octree-accelerated ray tracing algorithm is used to perform surface intersection detection. The algorithm uses a recursive strategy to traverse the octree structure, and the steps are as follows: First, perform ray-bounding box intersection tests at internal nodes and use the flat layer intersection method to quickly eliminate non-intersecting spatial regions. Then, in the leaf nodes, the Möller-Trumbore algorithm is used to perform precise ray-triangle intersection detection on the stored surface triangles to obtain the intersection parameters and coordinates. Since the model surface is closed, the number of intersections between each ray and the surface must be even. The coordinate transformation formula is then used... Calculate the grid index corresponding to the intersection point, where Let these be the coordinates of the intersection point. Using the grid origin as the reference point, the grid index corresponding to the intersection point can be calculated. Finally, after pairing adjacent intersections to form filled line segments, the endpoints of the line segments are aligned with the grid. The specific strategy is as follows: based on the relative position of the intersection point and the grid center, the following scenarios apply: For the starting endpoint of the line segment, if the intersection point is before the grid center, the starting endpoint is adjusted to the current grid; if the intersection point is after the grid center, the starting endpoint is adjusted to the next grid. For the ending endpoint of the line segment, if the intersection point is before the grid center, the ending endpoint is adjusted to the previous grid; if the intersection point is after the grid center, the ending endpoint is adjusted to the current grid. If an anomaly occurs where the starting endpoint index is greater than the ending endpoint index, it is marked as invalid and handled by the Delaunay method.
[0013] Preferably, a transitional bridging A15 lattice variant is introduced between adjacent mesh levels to achieve a smooth transition and topological connection between A15 lattices of different scales. To generate a hierarchical tetrahedral mesh based on the A15 lattice, a hierarchical merging strategy is adopted to coarsen the mesh layer by layer. That is, during the merging process, the boundary mesh of the current level needs to be retained as a bridging structure to ensure the continuity and geometric consistency between lower and higher level meshes. This strategy includes two steps: boundary mesh identification and bottom-up hierarchical merging.
[0014] Preferably, based on the characteristics of the ray filling method, a boundary mesh recognition strategy is proposed, as follows: The endpoints of the filled line segments are directly classified into the boundary set to ensure boundary integrity; for the middle part of the line segment, it is checked whether there are adjacent filled line segments in the four directions. If there are no adjacent line segments in any direction, the grid corresponding to the middle part is classified into the boundary set; otherwise, grid-by-grid detection is performed. In grid-by-grid inspection, the neighborhood integrity of each grid is evaluated in six directions: grids with missing directions are assigned to the boundary set, and grids completely surrounded by their neighborhood are assigned to the inner set.
[0015] Preferably, the merging step is as follows: subdivide the internal mesh into potential merging meshes and unused meshes. Potential merging meshes must meet coordinate constraints to ensure that the merged meshes are consistent with the directionality of ray filling and can be further combined into line segments, providing a basis for recursive merging; for each potential merging location, search the surrounding mesh blocks, including the location itself, to verify whether the remaining 7 mesh cells are completely present; if the conditions are met, merge them into a large mesh, and represent and store the connected large meshes at the same ray location as line segments; After merging, boundary identification and potential merging point detection are re-executed on the newly generated level to form a recursive processing flow until one of the following termination conditions is met: there are no mergeable grid blocks or the grid density of the current level meets the preset requirements.
[0016] Compared with the prior art, the beneficial effects of this application are as follows: This method retains the advantages of mesh filling in terms of computational efficiency and mesh quality, effectively solves the problems of existing methods in surface restoration and sharp feature preservation, and significantly reduces the computational complexity and storage overhead of region identification through ray tracing technology, providing a complete technical solution for high-quality mesh discretization of complex 3D models. Attached Figure Description
[0017] Figure 1 A schematic diagram of the spatial partitioning of the Stanford Rabbit model (YZ section); Figure 2 Flowchart for detecting the intersection of surface triangles and mesh cells; Figure 3 This is a schematic diagram of the A15 crystal lattice structure; Figure 4 A schematic diagram of the region division of the Stanford Rabbit model (YZ section); Figure 5 A schematic diagram of the octree space partitioning for the Stanford Rabbit Model; Figure 6 Schematic diagram of the incident light array on the Stanford Rabbit model (YZ section); Figure 7 Schematic diagram of aligning the endpoints of the line segment filled with light rays (YZ section); Figure 8 A partial A15 lattice variant used for transition bonding; Figure 9 A schematic diagram illustrating the detection of adjacent filled line segments; Figure 10 This is a schematic diagram illustrating the detection of adjacent grid cells. Figure 11 This is a schematic diagram of the merging process layer by layer from bottom to top (YZ section); Figure 12 The results are from the "Fandisk" dataset obtained using TetGen and Gmsh; the display includes tetrahedral mesh, dihedral angle distribution (blue), and aspect ratio distribution (green). Figure 13 The "Fandisk" results obtained using TetMesh from this application are shown; the content includes tetrahedral mesh, dihedral angle distribution (blue), and aspect ratio distribution (green). Figure 14 The "Stanford Rabbit" result was obtained using TetGen and Gmsh; the display includes tetrahedral mesh, dihedral angle distribution (blue), and aspect ratio distribution (green). Figure 15 The "Stanford Rabbit" result obtained using TetMesh from this application is shown; the content includes tetrahedral mesh, dihedral angle distribution (blue), and aspect ratio distribution (green). Figure 16 To compare the mesh generation efficiency of this application's TetMesh with Gmsh and TetGen on a simple model; Figure 17 To compare the mesh generation efficiency of this application's TetMesh with Gmsh and TetGen on complex models; Figure 18 This is a flowchart illustrating the process of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] A hybrid tetrahedral mesh generation method based on ray tracing and A15 lattice includes the following steps: S1. Spatial Partitioning and Intersection Detection: After reading the triangular mesh of the surface of the input target model (such as the geometric model of a cube, sphere, etc.), the mesh is then processed according to the set mesh step size. The space containing the model is divided into cubic meshes. To ensure that the computational domain has sufficient boundary buffers and meets the four-fold alignment requirement for A15 lattice filling, the computational domain size is calculated using the following formula.
[0020] First, calculate the basic mesh span in each direction based on the model bounding box: ; In the formula, For the model in the first Length in each coordinate direction This represents the grid step size.
[0021] Considering the requirement of a four-fold alignment of the fill mesh and the need for setting boundary buffers in this application, the formula for calculating the final mesh count in each direction is as follows: ; in, The compensation term is four times its original value. .
[0022] To facilitate understanding of the cubic mesh generation strategy, we will use the Stanford Bunny model with a span of 1cm as an example, with the mesh step size... Set to 0.1cm. For example... Figure 1 As shown, the yellow area represents the boundary buffer grid set to ensure the stability of the values when dealing with boundary conditions; the purple area is the quadruple alignment compensation grid to meet the alignment constraints on the number of grids in this application; and the green area is the effective grid cell actually occupied by the model.
[0023] It should be noted that although the spatial partitioning uses a step size of... The small cubic units are discretized, but considering that the A15 lattice structure occupies 4 small cubic units in each of the x, y, and z directions, the 4×4×4 small cubic units are combined into a large cubic unit to improve detection efficiency and meet the filling requirements of the A15 lattice.
[0024] Intersection detection: To accurately identify the intersection relationship between the model surface and spatial mesh elements, we employ a bounding box-based triangle-mesh intersection detection algorithm. This algorithm establishes a mapping relationship between surface geometry and discrete mesh by detecting the intersection of each triangle on the model surface with a mesh element.
[0025] The specific process of intersection detection is as follows: Figure 2 As shown. First, each triangle in the surface triangular mesh is traversed. For the three vertices of the triangle... Construct its axis-aligned bounding box and expand it by one mesh step in each direction. The distance is determined to ensure that the bounding box can cover all grid cells that may intersect with the triangle.
[0026] Next, the range of mesh cells to be detected is determined based on the expanded bounding box. This is because... As the basic scale of the grid cell, the bounding box coordinates need to be converted into grid indices, and the range of grid indices involved needs to be calculated: ; in, and These are the minimum and maximum coordinates of the expanded bounding box, respectively. The origin of the grid. is the side length of the grid cell.
[0027] Then, each mesh cell within the defined range is individually inspected. For cells with mesh coordinates (x, y, z), their corresponding bounding boxes are constructed, and a two-level inspection strategy is employed: the first level performs fast intersection detection between bounding boxes, including determining geometric relationships such as intersection and containment; the second level uses the Separating Axis Theorem (SAT) to perform precise intersection detection between triangles and bounding boxes on mesh cells that pass the first level's screening. SAT determines the intersection relationship by detecting whether the projections of the triangle and the bounding box overlap on each coordinate axis, ensuring the accuracy of the inspection results.
[0028] Finally, the detected intersection information is stored in the form of {grid coordinates, triangle index} and sorted according to the lexicographical order of the grid coordinates to facilitate quick querying and access in subsequent processing stages.
[0029] S2. Region Division and Object Filling: Regional division: Based on the relative positional relationship between the mesh elements and the geometric boundary of the model, the solution domain is divided into two different regions: the boundary mesh region and the internal filling region. Figure 4 The Stanford Bunny model's YZ section is used as an example for illustration. The orange grid represents the boundary grid region that intersects with the model surface, while the purple grid represents the filled region that is completely inside the model.
[0030] The core of this region partitioning strategy lies in employing appropriate mesh generation algorithms for different regions. For the internal filling region, since the mesh cells are entirely located inside the model and far from the geometric boundaries, A15 lattices are directly used for regular filling. Specifically, the coordinates of the 27 vertices of the lattice are translated according to the target mesh position, and then 46 tetrahedral cells are filled into the corresponding positions. For the boundary mesh region, in order to accurately restore the model surface and maintain sharp features, the Delaunay method is used to generate tetrahedral meshes in this region.
[0031] The Delaunay method (also known as Delaunay triangulation) is a method for generating triangulations using geometric criteria. Its core principle is to ensure that the circumcircle of each triangle does not contain any other input points, thereby improving numerical stability and computational accuracy.
[0032] Fill the object: The internal filling region uses an A15 lattice structure for space filling. For example... Figure 3 As shown, the structure consists of 27 vertices and 46 tetrahedra, belonging to the close-packed tetrahedral coordination (TCP) structure, which can achieve efficient tetrahedral tiling of the model's internal regions. All edges of the A15 lattice have a coordination number of 5 or 6, which allows the filled tetrahedral units to approximate the ideal regular tetrahedral configuration as closely as possible, ensuring mesh quality.
[0033] S3. Octree construction and light filling method.
[0034] Octree construction: Since traditional ray tracing requires a large number of ray-triangle intersection tests, an octree data structure is used to spatially hierarchically divide the triangular mesh on the model surface to improve intersection detection efficiency. The octree construction adopts a non-uniform subdivision strategy, which adaptively divides the model according to the spatial distribution density of the geometric model: dense areas of the model are subdivided into smaller spatial units to improve query accuracy, while sparse areas are kept in larger spatial units to reduce storage overhead.
[0035] The construction process comprises three key steps: First, the axis-aligned bounding box of the root node is calculated by traversing all triangle vertices; then, recursive spatial partitioning is performed, uniformly dividing the current node into eight sub-cubes, with triangles assigned to their respective child nodes based on their centroid positions; finally, the bounding boxes of leaf nodes are recalculated to ensure they completely contain all triangles within the node, and the bounding boxes of all parent nodes are recursively updated upwards to maintain the geometric consistency of the entire octree structure. The recursive partitioning terminates when the number of triangles in a node is less than a preset value or when the maximum depth is reached. This spatial organization method based on model distribution significantly reduces the computational complexity of intersection testing and optimizes memory usage efficiency. Figure 5 A schematic diagram of the octree space partitioning of the Stanford Bunny model is shown.
[0036] Light filling method: Based on the relative positional relationship between the mesh elements and the model's geometric boundaries, the solution domain is divided into a boundary mesh region and an internal filling region. The boundary mesh region is obtained through intersection detection, while the internal mesh region is efficiently determined using ray tracing. By constructing an array of incident rays on a specified plane, the internal filling region is directly determined using the intersection information of the rays with the model surface. In terms of storage overhead, this method only needs to store the coordinates of the endpoints of the line segments representing the filling region, significantly reducing memory consumption compared to methods based on signed distance fields, which require storing distance values for each mesh point.
[0037] like Figure 6 As shown, we take the Y-axis as the incident direction of the light ray, in Construct a regular array of rays on a plane. The coordinates of a ray on a plane can be represented as: .
[0038] in Let be the index coordinates of the center point of the XZ plane grid, satisfying That is to say, To ensure the spacing between light rays is consistent with the grid size required for subsequent A15 lattice filling, The negative value is small enough to ensure that the light source is located outside the model.
[0039] For each constructed ray, we employ a ray tracing method accelerated by an octree structure for ray-surface intersection detection. The method uses a recursive strategy to traverse the octree structure: first, a ray-bounding box intersection test is performed at each internal node to quickly eliminate spatial regions that do not intersect with the ray; then, intersecting child nodes are recursively visited until a leaf node is reached. In the leaf node, accurate ray-triangle intersection detection is performed on the stored surface triangles, and the parameter values of valid intersection points are recorded. The coordinates of the intersection point and the corresponding triangle index.
[0040] In the ray-bounding box intersection test, the Slab Method is used. This method treats the axis-aligned bounding box as the intersection of three pairs of parallel plates. By calculating the entry and exit parameters of the ray with each pair of plates, it determines whether the ray intersects the bounding box. The Möller-Trumbore algorithm is used for ray-triangle intersection detection.
[0041] Ray tracing allows us to obtain all the intersection points of light rays with the model's surface during their propagation. Since the model is a closed surface, the number of intersection points must be even. Using the coordinate transformation formula: .
[0042] in Let these be the coordinates of the intersection point. The origin is the grid point. The grid index corresponding to the intersection point can be calculated.
[0043] After pairing adjacent intersections to form filled line segments, the endpoints of the line segments need to be aligned with the grid to ensure the accuracy of the fill position. For example... Figure 7 As shown in (1) and (2), depending on the relative position of the intersection point and the grid center, there are several processing scenarios: For the starting endpoint of the line segment, when the intersection point is before the grid center, the starting endpoint is adjusted to the current grid; when the intersection point is after the grid center, the starting endpoint is adjusted to the next grid. For the ending endpoint of the line segment, when the intersection point is before the grid center, the ending endpoint is adjusted to the previous grid; when the intersection point is after the grid center, the ending endpoint is adjusted to the current grid.
[0044] After endpoint adjustment, an anomaly may occur where the starting endpoint index is greater than the ending endpoint index, such as... Figure 7 As shown in (3) and (4). This phenomenon usually occurs in narrow regions of the model where the feature size is smaller than the mesh resolution, causing the filling mesh to not be completely inside the model. For such degenerate line segments, they are marked as invalid and discarded, and the corresponding regions will be handled by the Delaunay method. Finally, all valid line segments are sorted in ascending order according to the index value of their starting endpoints to ensure the orderliness of the subsequent filling process.
[0045] S4. Hierarchical mesh generation.
[0046] This invention proposes a hierarchical mesh generation method based on A15 lattice. By using A15 lattice variant design and hierarchical region merging strategy, hierarchical mesh generation of internal filling regions is achieved, effectively controlling the mesh size while maintaining mesh quality.
[0047] A15 lattice variant: Due to the geometric complexity and irregularity of the A15 lattice structure, direct connections between grids of different scales cannot be achieved through simple scaling operations. To address this issue, the concept of bridging lattices is proposed, which introduces transitional bridging A15 lattice variants between adjacent grid levels to achieve smooth transitions and topological connections between A15 lattices of different scales.
[0048] During the hierarchical mesh generation process, each bridging A15 lattice variant needs to be connected to six adjacent A15 lattices (back, front, right, left, down, up). Since adjacent positions may contain A15 lattices of the same or next lower level, meaning each direction has two connection states, there are a total of [number missing] connections. Sixty-four different adjacency configurations were designed as bridging structures to achieve efficient connections under different configurations. For example... Figure 9As shown, by refining the mesh and adjusting the vertex positions of the original A15 lattice connection interface, variant structures adapted to different adjacency situations are generated. To facilitate identification and application, these variants are identified using 6-bit binary codes, arranged in the order of back, front, right, left, bottom, and top. During the actual mesh filling process, this application automatically determines and selects the corresponding variant type by detecting the lattice distribution in six directions at the current position.
[0049] Boundary identification and hierarchy merging: To generate a hierarchical tetrahedral mesh based on the A15 lattice, a layer-by-layer merging strategy is employed to coarsen the mesh layer by layer. Since there are scale differences between meshes at different levels, direct merging would lead to topological discontinuities. Therefore, during the merging process, the boundary mesh of the current level needs to be preserved as a bridging structure to ensure continuity and geometric consistency between lower and higher-level meshes. This strategy includes two steps: boundary mesh identification and bottom-up layer-by-layer merging.
[0050] (1) Boundary mesh identification strategy: like Figure 10 As shown, a boundary grid identification strategy is proposed based on the characteristics of the ray filling method. First, the endpoints of the filled line segments are directly classified into the boundary set to ensure boundary integrity. For the middle part of the line segment, it is checked whether there are adjacent filled line segments in the four directions (right, left, down, and up). If there are no adjacent line segments in any direction, the grid corresponding to the middle part is classified into the boundary set; otherwise, grid-by-grid detection is performed.
[0051] like Figure 11 As shown, in grid-by-grid detection, this application evaluates the neighborhood integrity of each grid in six directions: grids with missing directions are assigned to the boundary set, and grids completely surrounded by their neighborhoods are assigned to the inner set. This neighborhood integrity-based classification method ensures the accuracy of boundary identification.
[0052] (2) Bottom-up layer-by-layer merging strategy: To achieve efficient merging, the internal mesh is subdivided into potentially merged meshes and unused meshes. The potentially merged meshes must satisfy coordinate constraints. This constraint ensures that the merged mesh maintains the same directionality as the ray filling, allowing it to be further combined into line segments, providing a basis for recursive merging. For each potential merge location, a 2×2×2 mesh block surrounding it (including the location itself) is searched to verify that the remaining 7 mesh cells are fully present. If the condition is met, they are merged into one large mesh, and connected large meshes at the same ray location are represented and stored as line segments.
[0053] After merging, this application re-executes boundary identification and potential merging point detection on the newly generated level to form a recursive processing flow until one of the following termination conditions is met: there are no mergeable mesh blocks or the mesh density of the current level meets the preset requirements. Figure 11 A schematic diagram illustrating a bottom-up, layer-by-layer merging strategy is shown.
[0054] To verify the effectiveness of this invention, surface triangular patches were used as input, and the method of this invention (named TetMesh) was compared and analyzed with mainstream tetrahedral mesh generation software (Gmsh, TetGen). The comparison and verification included two aspects: mesh quality assessment and generation efficiency analysis.
[0055] This invention is implemented in C++ with optimized compilation enabled. All results demonstrated by the invention were obtained on a desktop computer equipped with a 12th-generation Intel i5-12400F 4.4GHz processor and 32GB of DDR4 memory to ensure consistent hardware settings for fair comparison.
[0056] Regarding the quality of tetrahedral mesh generation: Compared with mainstream mesh generation software, this invention exhibits significant advantages in mesh quality. Mesh quality evaluation uses two key parameters: the tetrahedron aspect ratio (the ratio of the longest side to the shortest side) and the dihedral angle. Specific quality comparison data is shown in Table 1, and the generated tetrahedral mesh is as follows: Figures 12 to 15 As shown.
[0057] Table 1. Comparison of tetrahedral mesh quality .
[0058] Table 1 The number of tetrahedral meshes. It is the smallest dihedral angle in the grid. It is the largest dihedral angle in the grid. The average value of all dihedral angles. The dihedral angle is less than percentage, This represents the percentage of dihedral angles within the acceptable range. The dihedral angle is greater than percentage, The average aspect ratio of all tetrahedrons. The aspect ratio of all tetrahedrons is given.
[0059] Experimental results show that, under the condition of generating a similar number of tetrahedral meshes, the TetMesh of this invention significantly outperforms the comparison software in terms of mesh quality. (In high-quality dihedral angles...) In terms of distribution, the average proportion of TetMesh in this invention is 71.72%, which is about twice that of TetGen (36.31%) and 2.3 times that of Gmsh (30.54%), respectively, and the mesh quality is significantly improved.
[0060] In terms of aspect ratio, TetMesh not only has the smallest average aspect ratio, but also boasts an average proportion of over 74% of tetrahedra with a high-quality aspect ratio (1.0-2.0), a significant advantage compared to TetGen's 28.37% and Gmsh's 13.59%, effectively improving element shape quality. TetMesh also performs exceptionally well in controlling critical extreme angles, consistently maintaining a minimum dihedral angle above 2°. Compared to TetGen's 0.364° and Gmsh's 0.777°, which are close to singular values, TetMesh effectively avoids the generation of severely degenerate tetrahedra, improving numerical computational stability.
[0061] Furthermore, TetMesh, employing a layer-by-layer merging strategy, significantly reduces mesh size while maintaining mesh quality, averaging a reduction of approximately 35% (Box: 26%, Sphere: 32%, Fandisk: 44%, Bunny: 27%), achieving a good balance between quality and efficiency. These results clearly demonstrate that the hybrid tetrahedral mesh generation method based on ray tracing and A15 lattices comprehensively outperforms traditional methods in key quality indicators, producing high-quality tetrahedral meshes more suitable for finite element analysis and engineering simulation.
[0062] Regarding the speed of tetrahedral mesh generation: To objectively evaluate the mesh generation efficiency of TetMesh, we generated eight sets of tetrahedral meshes of different sizes for each test model and recorded the corresponding generation times. Due to differences in algorithm implementation between different programs, we generated as many tetrahedral meshes as possible to conduct a fair time comparison analysis. Figures 12 to 17 The time consumption of each model at different scales is shown, as well as the time ratio of other software relative to TetMesh.
[0063] Experimental results show that TetMesh, based on a hybrid strategy, performs exceptionally well in mesh generation efficiency, comparable to TetGen overall, and its advantage gradually increases with mesh size. Furthermore, across all test models, TetMesh's average generation speed is approximately 4.65 times that of Gmsh.
[0064] Specifically, compared to TetGen: for simple geometric models, the cube model is... Efficiency improvement at tetrahedral scale ;Sphere model in Efficiency improvement at tetrahedral scale TetMesh's advantages are even more pronounced in complex geometric models: Fandisk models (where the surface of the model object is composed of triangles) are more efficient at handling complex geometric models. Efficiency improvement at tetrahedral scale Stanford Rabbit Model Efficiency improvement at tetrahedral scale .
[0065] Compared to Gmsh, TetMesh demonstrates a significant efficiency advantage. Simple models like the cube and sphere achieve average speed improvements of 4.48x and 4.22x respectively, while complex models like Fandisk and Stanford Rabbit achieve average speed improvements of 5.29x and 4.63x respectively. A maximum efficiency improvement of 6.85x is achieved across all test scenarios, fully demonstrating the efficiency advantages of hybrid methods.
[0066] These results demonstrate that TetMesh, while maintaining high-quality mesh generation, is more suitable for handling large-scale mesh generation tasks with complex models. Combined with the quality evaluation results, TetMesh achieves a good balance between mesh quality and generation efficiency.
[0067] Through the coordinated operation of the above four steps, this invention achieves high-quality and high-efficiency tetrahedral mesh generation. This method retains the advantages of mesh filling in terms of computational efficiency and mesh quality, while effectively solving the problems of surface reconstruction and sharp feature preservation in existing methods. Furthermore, it significantly reduces the computational complexity and storage overhead of region identification through ray tracing technology, providing a complete technical solution for high-quality mesh discretization of complex 3D models.
Claims
1. A method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice, characterized in that, Includes the following steps: S1. Spatial Partitioning and Intersection Detection: The input target model space is divided into cubic meshes, and the intersection relationship between the surface triangles and the spatial cubic mesh is determined; S2. Region division and object filling: The space is divided into regions based on a hybrid strategy. The internal regions are filled with A15 lattice, and the boundary regions are reduced and sharp features are preserved using the Delaunay method. S3. Octree construction and ray tracing method: Construct an octree accelerated structure, use ray tracing to quickly identify the internal filling region, and generate filling line segments to determine the location where A15 lattice filling is required; S4. Hierarchical mesh generation.
2. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 1, characterized in that, Step S1 involves dividing the space into cubic meshes, and the specific steps are as follows: After reading the input target model, according to the preset mesh step size The model's 3D space is divided into uniform cubic meshes. The spatial meshing process needs to meet two key constraints: boundary buffer settings and a four-fold alignment requirement. Calculate the basic grid span in each coordinate direction based on the model bounding box: ; in For the model in the first Length in each coordinate direction The grid step size; The number of grid cells is calculated using the formula: ; in The formula for the four-fold alignment compensation term is as follows: 。 3. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 1, characterized in that, The intersection detection steps in step S1 are as follows: Step 1: Traverse each triangle in the surface triangular mesh. For each of the three vertices of the triangle... Construct its axis-aligned bounding box and expand it by one mesh step in each direction. The distance is determined to ensure that the bounding box can cover all grid cells that may intersect with the triangle; Step 2: Determine the range of mesh cells to be detected based on the expanded bounding box, convert the bounding box coordinates to mesh indices, and calculate the range of mesh indices involved. ; ; in, and These are the minimum and maximum coordinates of the expanded bounding box, respectively. The origin of the grid. The side length of the grid cell; Step 3: Detect each grid cell within the defined range one by one: For cells with grid coordinates (x, y, z), construct their corresponding bounding boxes and employ a two-level detection strategy: The first stage performs fast intersection detection between bounding boxes, including determining geometric relationships such as intersection and containment; The second level uses the separating axis theorem to perform precise intersection detection of triangles and bounding boxes on the mesh cells that have passed the first level of screening; Step 4: Store the detected intersection information in the form of {grid coordinates, triangle index}, and sort it according to the lexicographical order of the grid coordinates for easy querying and access in subsequent processing stages.
4. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 1, characterized in that, Step S2, region partitioning, employs a hybrid strategy: the space is divided into boundary regions and internal filling regions based on the relative positional relationship between the mesh elements and the geometric boundaries of the model. For the internal filling regions, A15 lattices are directly used for regular filling. Specifically, the coordinates of the 27 vertices of the lattice are translated according to the target mesh position, and then 46 tetrahedral elements are filled into the corresponding positions. The coordination number of all edges of the A15 lattice is 5 or 6, so that the filled tetrahedral elements can approximate the ideal regular tetrahedral configuration as closely as possible. For the boundary regions, the Delaunay method is used to generate tetrahedral meshes within the region.
5. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 1, characterized in that, Step S3 uses an octree data structure to perform spatial hierarchical partitioning of the triangular mesh on the model surface; the octree construction adopts a non-uniform subdivision strategy, adaptively partitioning according to the spatial distribution density of the geometric model, as follows: First, calculate the axis-aligned bounding box of the root node by traversing all triangle vertices; Then, recursive space partitioning is performed, dividing the current node into 8 sub-cubes evenly, and the triangles are assigned to the corresponding sub-nodes according to their centroid positions; Finally, the bounding boxes of the leaf nodes are recalculated to ensure that all triangles within the node are completely contained, and the bounding boxes of all parent nodes are recursively updated upwards to maintain the geometric consistency of the entire octree structure; the recursive segmentation terminates when the number of triangles in a node is less than a preset value or when the maximum depth is reached.
6. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 5, characterized in that, Step S3, the ray filling method, involves constructing a regular ray array to quickly identify the internal filling region. The steps are as follows: With the Y-axis as the incident direction of the light ray, in A regular array of rays is constructed on a plane, and the coordinates of the ray origin are represented as follows: ; in Let be the index coordinates of the center point of the XZ plane grid, satisfying , that is to The spacing between the light rays is designed to ensure consistency with the grid size required for subsequent A15 lattice filling.
7. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 6, characterized in that, For each constructed ray, an octree-accelerated ray tracing algorithm is used to detect surface intersections. The algorithm employs a recursive strategy to traverse the octree structure, with the following steps: First, perform ray-bounding box intersection tests at internal nodes and use the flat layer intersection method to quickly eliminate non-intersecting spatial regions. Then, in the leaf nodes, the Möller-Trumbore algorithm is used to perform precise ray-triangle intersection detection on the stored surface triangles to obtain the intersection parameters and coordinates. Since the model surface is closed, the number of intersections between each ray and the surface must be even. The coordinate transformation formula is then used... Calculate the grid index corresponding to the intersection point, where Let these be the coordinates of the intersection point. Using the grid origin as the reference point, the grid index corresponding to the intersection point can be calculated. Finally, after pairing adjacent intersections to form filled line segments, the endpoints of the line segments are aligned with the grid. The specific processing strategy is as follows: depending on the relative position of the intersection point and the grid center, there are several processing scenarios: for the starting endpoint of the line segment, if the intersection point is before the grid center, the starting endpoint is adjusted to the current grid; if the intersection point is after the grid center, the starting endpoint is adjusted to the next grid. For the ending endpoint of the line segment, if the intersection point is before the grid center, the ending endpoint is adjusted to the previous grid; if the intersection point is after the grid center, the ending endpoint is adjusted to the current grid. If an anomaly occurs where the starting endpoint index is greater than the ending endpoint index, it is marked as invalid and handled by the Delaunay method.
8. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 1, characterized in that, Transitional bridging A15 lattice variants are introduced between adjacent mesh levels to achieve smooth transitions and topological connections between A15 lattices of different scales. To generate hierarchical tetrahedral meshes based on A15 lattices, a hierarchical merging strategy is adopted to coarsen the mesh layer by layer. That is, during the merging process, the boundary mesh of the current level needs to be retained as a bridging structure to ensure the continuity and geometric consistency between lower and higher level meshes. This strategy includes two steps: boundary mesh identification and bottom-up hierarchical merging.
9. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 8, characterized in that, Based on the characteristics of the ray filling method, a boundary mesh identification strategy is proposed, as follows: The endpoints of the filled line segments are directly classified into the boundary set to ensure boundary integrity; for the middle part of the line segment, it is checked whether there are adjacent filled line segments in the four directions. If there are no adjacent line segments in any direction, the grid corresponding to the middle part is classified into the boundary set; otherwise, grid-by-grid detection is performed. In grid-by-grid inspection, the neighborhood integrity of each grid is evaluated in six directions: grids with missing directions are assigned to the boundary set, and grids completely surrounded by their neighborhood are assigned to the inner set.
10. The method for generating hybrid tetrahedral meshes based on ray tracing and A15 lattice according to claim 8, characterized in that, The merging process is as follows: The internal mesh is subdivided into potential merging meshes and unused meshes. Potential merging meshes must satisfy coordinate constraints to ensure that the merged mesh maintains the same directionality as the ray filling. They can be further combined into line segments, providing a basis for recursive merging. For each potential merging location, the surrounding mesh blocks, including the location itself, are searched to verify whether the remaining 7 mesh cells are fully present. If the conditions are met, they are merged into a large mesh, and connected large meshes at the same ray location are represented and stored as line segments. After merging, boundary identification and potential merging point detection are re-executed on the newly generated level to form a recursive processing flow until one of the following termination conditions is met: there are no mergeable grid blocks or the grid density of the current level meets the preset requirements.
Citation Information
Patent Citations
FDTD mesh generation method and system based on ray tracing
CN115935673A
Semiconductor numerical simulation-oriented hybrid unit grid generation method
CN117708904A
STL model Monte Carlo particle transport simulation method based on octree neighborhood search
CN118313014A
WebGL-based cloud collaborative three-dimensional building modeling rendering method and system
CN120047595A
Rapid local repair method for self-intersecting triangular mesh
CN120163954A