Efficient three-dimensional model method based on parity counting method and flood filling method and application

By combining the three-dimensional model method with the even counting method and the flood filling method, the problems of low computational efficiency and insufficient accuracy in the prior art are solved, and efficient and accurate three-dimensional model voxelization is achieved, which is especially suitable for the fields of mechanical processing, additive manufacturing and finite element analysis.

CN120374895APending Publication Date: 2025-07-25HARBIN INST OF TECH AT WEIHAI
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510467070.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing three-dimensional model voxelization technology has problems of low computational efficiency and insufficient accuracy when dealing with complex geometric shapes and internal fine structures. Especially in applications such as mechanical manufacturing and finite element analysis that require accurate internal structure representation, it is difficult for traditional methods to accurately capture internal structure information.

Method used

An efficient three-dimensional model method based on parity counting method and flood filling method is adopted, including steps: data extraction, surface voxelization, improved parity counting method to perform partial internal voxelization and flood filling algorithms to generate complete internal voxelization to generate complete 3D voxel data.

Benefits of technology

The calculation efficiency and voxelization accuracy of the three-dimensional model are significantly improved, especially in areas with complex internal structures, which can accurately fill internal voxels, reduce calculation overhead and ensure high accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120374895A_ABST
    Figure CN120374895A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient three-dimensional model method based on an odd-even counting method and a flood filling method and application, and the method comprises the following steps: S1, carrying out data extraction, and carrying out voxel grid division; s2, performing surface voxelization to generate surface voxel data; s3, carrying out partial internal voxelization by adopting an improved parity counting method; s4, performing complete internal voxelization by adopting a flood filling algorithm; and S5, data storage and output: outputting a voxelization model, namely complete 3D voxel data. The entity voxelization algorithm provided by the invention ensures accurate internal voxelization, especially for a high-precision watertight model. The process is optimized by applying an odd-even counting method in a simple-structure area of the watertight three-dimensional model, so that the calculation overhead is remarkably reduced. The flood filling method is effectively propagated in a complex internal space, so that the calculation efficiency and the voxelization precision are improved. The result shows that the FGV is superior to the existing method in the aspects of precision and calculation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an efficient three-dimensional model method, and particularly to an efficient three-dimensional model method and application based on the parity counting method and the flood filling method. Background Art

[0002] The geometric structure of a three-dimensional model is usually composed of basic elements such as lines, triangles, and faces. In order to effectively analyze these complex geometric shapes on a digital computer, the three-dimensional model must be discretized. Voxelization is a widely used discretization method that converts continuous geometric shapes into regular volume pixel grids, thus enabling the efficient storage and operation of complex three-dimensional structures. This technology plays an important role in fields such as machining processes, medical imaging, additive manufacturing, and path planning.

[0003] In recent years, researchers have been working on improving the computational efficiency and accuracy of voxelization algorithms, with a focus on optimizing computational performance and memory usage. To this end, various acceleration techniques have been proposed, including parallel computing and optimized data structures, to enhance real-time application performance and reduce storage requirements. Sparse voxelization methods adopt a hierarchical storage scheme, further reducing memory consumption and making the management of large-scale data sets more efficient.

[0004] Surface voxelization has been widely favored due to its advantages of low memory requirements and computational efficiency. In recent years, advanced surface representation methods have been used to improve the accuracy of voxelized surfaces and enhance their performance quality. In addition, programmable voxelization processing flows have been introduced to enhance computational flexibility and efficiency. However, traditional surface voxelization methods usually rely on triangular mesh representations and are difficult to accurately capture the internal structure information of three-dimensional models.

[0005] In applications such as mechanical manufacturing and finite element analysis that require accurate internal structure representation, solid voxelization is particularly important. To this end, various volume representation methods have been proposed, such as techniques based on the parity counting method and ray intersection detection, to ensure the accurate filling of internal voxels. In addition, distance field-based voxel filling strategies have also been used to optimize the solid voxelization effect of closed polygon models. Although these methods have improved the quality of solid voxelization to a certain extent, there are still many challenges when dealing with complex geometric shapes and fine internal structures. The main problems faced are the computational efficiency and accuracy of solid voxelization.

[0006] Existing voxelization technology research mainly focuses on surface voxelization because of its high processing efficiency. However, for application scenarios that require accurate representation of the internal structure of 3D models, solid voxelization is more suitable. Existing solid voxelization methods generally have problems of low accuracy and poor computational efficiency: traditional parity counting involves intersection detection of each voxel with the surface of the 3D model to determine whether the voxel is internal or external, resulting in a very high computational complexity. At the same time, traditional flood filling methods start from an initial voxel and spread to fill the entire internal space, resulting in a large amount of memory consumption. Summary of the Invention

[0007] In order to solve the deficiencies of the above technologies, the present invention provides an efficient 3D model method and application based on the parity counting method and the flood filling method.

[0008] In order to solve the above technical problems, the technical solution adopted by the present invention is: an efficient 3D model method based on the parity counting method and the flood filling method, and the method includes the following steps: Step S1, data extraction, and voxel grid division; Step S2, perform surface voxelization to generate surface voxel data; Step S3: Use an improved parity counting method for partial internal voxelization; Step S4: Use the flood filling algorithm for complete internal voxelization; Step S5: Data storage and output, output the voxelized model (which is actually a three-dimensional digital matrix with values of 1 and 0), that is, complete 3D voxel data.

[0009] Preferably, in step S1, data extraction includes: reading triangular mesh data in STL, OBJ or OFF format, and extracting the geometric information of the mesh: vertex coordinates, face indices, and normal vectors.

[0010] For the 3D model to be processed, the format of the model is converted into a file in any one of the.STL / .OBJ / .OFF formats through the 3D modeling software used as the data input of the model.

[0011] Preferably, in step S1, voxel grid division includes the following steps: S11. Regularly divide the three-dimensional space according to the preset voxel size, so that the entire 3D model is embedded in the voxel grid, and calculate the minimum bounding box of the model; The preset voxel size refers to, according to actual requirements, for example, setting voxel_size = 0.1 means that the side length of the voxel unit is 0.1 mm. That is, a 3D model of 10 mm × 10 mm × 10 mm requires a 3D digital matrix of 100 × 100 × 100 specifications to represent. Each voxel is actually a number and its coordinates on the 3D boolean matrix.

[0012] S12. Divide the 3D voxel grid according to the preset voxel size; S13. Traverse all triangles to determine the voxel range to be checked.

[0013] Preferably, step S2 includes the following steps: S21. Perform the intersection detection between the triangle and the voxel unit; For example, if voxel_size = 0.1 is set, then a voxel unit is actually a cube of 0.1 mm × 0.1 mm × 0.1 mm. When the triangle representing the surface of the 3D model passes through a certain voxel, the value of the voxel unit is set to 1.

[0014] The intersection detection means that the existing open-source technology used in this article is the create_from_triangle_mesh function in open3d.geometry to generate the surface voxel grid of the 3D model with VoxelGrid.

[0015] S22. Mark all voxels intersecting with the triangle surface to complete the surface voxelization; S23. Generate the surface voxel data.

[0016] Preferably, step S3 includes the following steps: S31. Select the axis with the least morphological change of the 3D model as the scanning axis: the x-axis or the y-axis or the z-axis; S32. Scan layer by layer along this direction, and project rays from the other two orthogonal directions, that is, the two directions perpendicular to the scanning axis, within each layer; S33. Count the number of intersections of each ray with the model boundary: If the number of intersections = 2, mark the voxels penetrated by the ray as internal voxels; If the number of intersections ≠ 2, ignore the ray; S34. Generate partial internal voxel data.

[0017] Preferably, step S4 includes the following steps: S41. Use the internal voxels obtained by the improved parity counting method as the initial seed voxels; S42. Adopt the six-neighborhood expansion principle, and gradually fill the entire closed area in the front, back, left, right, up, and down six directions to ensure that all internal voxels are correctly labeled; S43. During the expansion process, use the model boundary formed by surface voxelization as the boundary for flood filling, and stop expanding when encountering the surface voxel boundary during the filling process.

[0018] Preferably, step S5 includes the following steps: S51. Generate a complete three-dimensional Boolean matrix through step S4; In step S43, when the filling of internal voxels is completed using the flood filling method, that is, the process of the internal voxels of the three-dimensional model changing from 0 to 1, thus completing the process of the voxel values corresponding to all the solid parts of the three-dimensional model changing from 0 to 1. Therefore, the three-dimensional voxel data at this time is a complete three-dimensional Boolean matrix.

[0019] S52. Store the voxel data in the.npy format; S53. Use the generated voxelized data for subsequent applications.

[0020] Preferably, in step S5, in the three-dimensional Boolean matrix, voxels with a value of 1 represent the occupied area, that is, surface or internal voxels, and voxels with a value of 0 represent the blank area.

[0021] An application of an efficient three-dimensional model method based on the parity counting method and the flood filling method, applying this method to the fields of machining, additive manufacturing, finite element analysis FEA, computer-aided design CAD, and medical imaging.

[0022] The free growth voxelization (FGV) algorithm proposed by the present invention (this algorithm is similar to the free growth of plants from branches to leaves, so it is named the free growth voxelization algorithm, and it is actually a solid voxelization algorithm) ensures accurate internal voxelization, especially for high-precision watertight models. The FGV internal filling algorithm combines the advantages of the parity counting method and the flood filling method. In areas with simple internal structures, the parity counting method is adopted. The FGV algorithm proposed by the present invention optimizes this process by applying the parity counting method in areas with simple structures of watertight three-dimensional models, significantly reducing the computational overhead. Subsequently, the flood filling method effectively propagates in complex internal spaces, thereby improving the computational efficiency and voxelization accuracy. Experimental results show that FGV is superior to existing methods in terms of accuracy and computational efficiency.

[0023] The present invention proposes a voxelization algorithm that combines the odd-even counting method and the flood filling method. The algorithm first applies the odd-even counting method to fill some internal voxels in regions with low geometric complexity, thereby significantly improving the accuracy of the odd-even counting method. Then, the internal voxels calculated by the odd-even counting method are used as the starting points for the flood filling method to accurately complete the filling of all internal voxels. Different from traditional voxelization methods, the internal filling process of FGV simulates the natural growth process of plants: starting from the growth of the root and gradually expanding to the natural growth of the leaves. Therefore, FGV has lower computational requirements because it mainly relies on Boolean operations. Experimental results show that compared with mainstream voxelization techniques, FGV has higher accuracy and higher computational efficiency when dealing with complex 3D models. Description of the Drawings

[0024] Figure 1 It is a flow chart of the free growth voxelization (FGV) method of the present invention.

[0025] Figure 2 It is a diagram of voxel division of a 10mm×10mm×5mm blind hole using the axis-aligned bounding box (AABB) of the present invention: (a) blind hole; (b) triangular network data of the blind hole; (c) mesh division.

[0026] Figure 3 It is a schematic diagram of fitting a straight line using full coverage and partial coverage voxelization respectively according to the present invention.

[0027] Figure 4 It is a schematic diagram of fitting a triangle using full coverage and partial coverage voxelization respectively according to the present invention.

[0028] Figure 5 It is a schematic diagram of the voxelization results of 24 machining features of the present invention: (a) 3D model of 24 common machining features; (b) 24 machining features with surface voxelization.

[0029] Figure 6 Demonstration diagram of the odd-even counting method of the present invention.

[0030] Figure 7 It is a demonstration diagram of the 3D model of the improved odd-even counting method: (a) voxelization results on the surface of the 3D model; (b) filling internal voxels by the improved odd-even counting method.

[0031] Figure 8 It is a schematic diagram of internal voxelization using the improved odd-even counting method: (a) cross-section of the marked voxel distribution; (b) range of internal voxels determined by the algorithm; (c) internal voxelization results.

[0032] Figure 9 It is a demonstration diagram of the diffusion process of a single voxel.

[0033] Figure 10 Two-dimensional demonstration diagram of the flood filling algorithm: (a) Flood filling is performed when the surface is completely covered with voxels; (b) Flood filling is performed when the surface is partially covered with voxels.

[0034] Figure 11 Comparison diagram of voxelization of machining features of FGV and Binvox.

[0035] Figure 12 Visible view of voxelization of the 3D model after FGV processing: (a) Blind hole; (b) Rectangular cavity; (c) Annular blind step.

[0036] Figure 13 Visible view of voxelization of the 3D model processed by Binvox: (a) Blind hole; (b) Rectangular cavity; (c) Annular blind step.

[0037] Figure 14 Internal cross-sectional view of voxelization of the 3D model: (a) Cross-section of the 3D model voxelized by the FGV algorithm; (b) Cross-section of the 3D model voxelized by the Binvox algorithm.

[0038] Figure 15 Comparison diagram of the performance of FGV and Binvox.

[0039] Figure 16 Voxelization model of mechanical connectors and voxel results of the bottom surface: (a) Bevel connector; (b) Rotating base; (c) Top seat.

[0040] Figure 17 Voxelization result diagram of the human model: (a) A 3D model of a dragon holding a pearl ball voxelized using FGV; (b) A 3D model of a warrior holding a hammer voxelized using FGV. Specific implementation manner

[0041] The present invention will be further described in detail below with reference to the accompanying drawings and specific implementation manners.

[0042] An efficient 3D model method based on the odd-even counting method and the flood filling method proposed by the present invention, namely the Free Growth Voxelization (FGV) algorithm, aims to achieve efficient and accurate voxelization of 3D models. Its core idea is to use an improved odd-even counting method to judge the internal and external positions of some voxels in the parts with simple geometric structures of the 3D model, and then use the flood filling method to further perform voxelization of the internal voxels of the model. The flow of this method is as Figure 1 shown.

[0043] First, FGV takes triangular mesh data in STL, OBJ, or OFF format as input and extracts geometric information such as vertex coordinates, face indices, and normal vectors of the mesh. Subsequently, the three-dimensional space is regularly divided according to the preset voxel size, so that the entire model is embedded in the voxel grid. On this basis, the algorithm traverses each triangle in the model, calculates its bounding box, and determines the voxel range to be checked accordingly. Through the intersection detection between the triangle and the voxel unit, all voxels intersecting with the triangle surface are marked, thus completing surface voxelization.

[0044] After determining the surface voxels, FGV uses an improved parity counting method to identify some internal voxels. Specifically, this method scans layer by layer along the axis with the least change (x, y, or z axis) to improve the calculation efficiency. For example, when the shape change of the three-dimensional model in the z-axis direction is less, within each data layer of the z-axis, rays are projected along the x-axis and y-axis, and the number of intersections between the rays and the model boundary is counted. To ensure accuracy, only the rays with the number of intersections exactly equal to 2 are retained, and the voxels passed through by these rays are marked as internal voxels. This is because when the number of intersections is 2, the ray only passes through the two surface layers of the model and does not involve complex geometric relationships, so it can reliably determine that the voxels between the two intersections of the ray belong to the interior. In this way, FGV quickly identifies some internal voxels in the region with a relatively simple geometric structure and uses them as seed voxels to provide a starting point for subsequent flood filling, thus laying a foundation for complete solid voxelization.

[0045] On this basis, FGV uses the flood fill algorithm to complete solid voxelization. Using the internal voxels obtained by the parity counting method as the initial seed voxels, the entire enclosed area is gradually filled according to the six-neighborhood expansion principle (i.e., the six directions of front, back, left, right, up, and down) to ensure that all internal voxels are correctly marked. To avoid boundary overflow during the filling process, this method uses the model boundary formed by surface voxelization as the boundary of flood filling during the expansion process to ensure the stability and reliability of the internal filling process.

[0046] Finally, FGV generates a complete three-dimensional Boolean matrix and stores it in the `.npy` format. In this matrix, voxels with a value of '1' represent occupied regions (i.e., surface or internal voxels), and voxels with a value of '0' represent blank regions. The generated voxel data can be widely applied in many fields such as precision manufacturing, additive manufacturing, finite element analysis (FEA), computer-aided design (CAD), and medical imaging.

[0047] Compared with traditional methods, FGV improves the parity counting method, reducing a large amount of computational effort during the internal voxelization process while ensuring its accuracy, enabling the rapid screening of a large number of internal voxels in the simple geometric regions of 3D models. At the same time, by combining the advantages of the flood filling method that can accurately fill the complex geometric regions of 3D models, the high-precision 3D voxelization task with complex internal structures is completed.

[0048] I. Mesh and Voxel Division

[0049] First, load and parse the triangular mesh, and traverse each triangle in the mesh. Each triangle consists of three vertices. By obtaining these vertices, the minimum bounding box (Bounding Box) of the entire mesh can be calculated. Subsequently, according to the side length of each voxel, the 3D space is divided into a voxel grid. When calculating the minimum bounding box, all vertices of all triangles need to be traversed:

[0050] For each vertex : , , , , , , After traversing all the vertices, , , min_orner and max_orner represent the minimum and maximum coordinates of the entire 3D model respectively. These two coordinates together define an axis-aligned bounding box (AABB).

[0051] As Figure 2 shown, according to the selected unit voxel size, such as voxel_size = 0.1mm (indicating that the side length of each voxel is 0.1mm), a cuboid with dimensions of 10mm × 10mm × 5mm is subdivided into a grid of 100 × 100 × 50 voxels, thus completing the voxel division process. (a) Blind hole (b) Triangular network data of the blind hole (c) Mesh division, (a) A blind hole with a size of 10mm × 10mm × 5mm; (b) Triangular mesh data of the blind hole; (c) Voxel unit division of the blind hole.

[0052] II. Surface Voxelization

[0053] Voxelization refers to the process of discretizing geometric data in three-dimensional space into voxels. A voxel is the basic unit in three-dimensional space and can be understood as a 3D pixel, usually represented in the form of regular small cubes to indicate the occupancy in three-dimensional space. For the surface voxelization method of triangular mesh models, it can be mainly divided into two strategies: full-coverage voxelization and partial-coverage voxelization.

[0054] Full-coverage voxelization is a method of strictly dividing the voxel occupancy of a 3D model. In this method, any voxel that intersects with a geometric shape (such as a triangle) is marked as an occupied voxel. This method ensures that every part of the model is covered by voxels, so the generated voxelized model is usually relatively dense. Specifically, this method traverses each edge of the triangular mesh and detects all voxels that intersect with the edge and marks them as occupied. This means that even if a voxel only has a slight contact with the edge or vertex of a triangle, the voxel is still considered occupied. This way can represent the shape of the model completely, but at the same time it will also lead to an increase in the number of voxels, thus increasing the storage requirements and computational overhead.

[0055] Partial-coverage voxelization is a more refined voxelization method. Compared with full-coverage voxelization, it has more strict limitations on the voxel occupancy standard. This method only marks a voxel as an occupied voxel when the volume ratio of the geometric body occupying the voxel exceeds a certain set threshold, thus generating a sparser voxelized model and more accurately reflecting the original geometric shape. Partial-coverage voxelization usually determines the occupancy state of voxels by setting a threshold. For example, when the occupancy ratio of the geometric shape within a voxel exceeds the threshold, the voxel is marked as occupied, otherwise it is considered unoccupied. This method can effectively reduce unnecessary voxels, improve the simplicity of the voxelized model, and at the same time maintain a high accuracy for the original geometric shape.

[0056] In two-dimensional space, voxelization can be analogous to the process of mesh division. For example, as Figure 3 (a) shows, one edge of a triangle may pass through multiple voxel regions. Under the full-coverage strategy, any voxel that intersects with the edge will be marked as occupied, as Figure 3 (b) shows. While under the partial-coverage strategy, the occupancy state of the voxel depends on the occupancy ratio of the geometric body in the voxel, as Figure 3 (c) shows. However, whether it is full-coverage or partial-coverage, the marked voxels will definitely fit this straight line, and at the same time divide the target area into two distinct parts.

[0057] For the three edges of a triangular facet, during the full-coverage voxelization process, any voxel that intersects with the edge will be marked as occupied. As Figure 4 (a) shows, a triangle may pass through multiple voxel units.Figure 4 (b) shows the voxelization result after adopting the full - coverage voxelization method. During the partial - coverage voxelization process, different algorithms can be used to determine which voxels should be marked as occupied. Figure 4 (c) shows the voxel distribution after partial - coverage voxelization.

[0058] By analyzing the performance of lines and triangles in the full - coverage voxelization and partial - coverage voxelization modes above, the adaptability of the FGV voxelization algorithm during the internal voxel filling (flood filling) process will be explored later. Whether the surface voxelization adopts the full - coverage mode or the partial - coverage mode, a complete three - dimensional model surface boundary can be formed, which can fit well with the internal voxelization process, thus ensuring the integrity and accuracy of voxel filling.

[0059] In the present invention, surface voxelization mainly serves as a pre - processing step for internal voxelization. Therefore, the open - source tool Open3D is used for this step. As a widely used 3D processing library, Open3D has efficient and stable voxelization functions. When specifically implemented, the create_from_triangle_mesh function is called, and the VoxelGrid method is used to generate the surface voxel grid of the 3D model. This method can not only ensure the accuracy of voxelization but also improve the calculation efficiency, thus laying a foundation for subsequent solid voxel filling and boundary determination.

[0060] In the algorithm verification stage, 24 typical machining feature models were selected for testing. These features are widely used in the field of machining, so they can effectively verify the applicability of the algorithm under high - precision requirements. Figure 5 Shows 24 machining features with surface voxelization using Open3D. The experimental results show that the surface voxelization method of Open3D meets the requirements of the present invention and provides a stable and reliable foundation for subsequent internal voxelization. The core goal of the FGV voxelization algorithm is to improve the accuracy and calculation efficiency of voxelization, and this experiment further verifies its applicability and advantages in machining features.

[0061] III. Internal Voxelization

[0062] 1. Improved Odd - Even Counting Method

[0063] The basic idea of the odd - even counting method is: emit a ray from the voxel to be detected, calculate the number of intersections of the ray with the triangular mesh, and then determine the attribution of the voxel. Usually, a ray is projected along a fixed direction (such as the positive Z - axis direction), and the number of times the ray passes through the model surface is recorded. If the number of intersections is odd, it means that the ray does not leave the model in pairs after entering, indicating that the voxel is inside. If the number of intersections is even, it means that the number of times the ray enters the model is equal to the number of times it leaves the model, and the voxel is outside. For exampleFigure 6 As shown in (a), the model is composed of a cuboid with a cylinder cut off from its upper part. Figure 6 (b) is a cross-section taken from the upper part including the cylindrical part. Figure 6 (c) demonstrates the counting principle of the odd-even counting method. Point O is a point inside the three-dimensional model. Rays are drawn from point O and the number of intersections with the model is calculated. The number of intersections of ray ① and ray ③ with the boundary of the three-dimensional model is odd, so it can be correctly judged that point O is inside the model. However, there will also be the case of ray ②, that is, when the drawn ray is tangent (intersects) to the boundary line of the model, counting errors or disorders will occur, resulting in incorrect judgments. And in areas with high-curvature surfaces or dense triangular meshes, floating-point errors may occur in the intersection calculation, affecting the accuracy of the results. When the model contains a large number of triangles, each ray needs to traverse all triangular faces to calculate the number of its intersections, resulting in a significant increase in the calculation overhead and affecting the calculation efficiency of voxelization.

[0064] To solve the problems of large calculation overhead and floating-point errors in the traditional odd-even counting method that may lead to incorrect judgments, FGV has been improved on the basis of retaining its core idea, that is, by counting the number of times the ray passes through the model boundary to determine the internal attribution of the voxel.

[0065] Specifically, after the surface voxelization of the three-dimensional model is completed, FGV traverses the x, y, and z directions in turn, evaluates the geometric changes of the model in each direction, and selects the direction with the smallest morphological change as the scanning axis. Then, it scans layer by layer along this direction, and projects rays from the other two orthogonal directions (i.e., the two directions perpendicular to the scanning axis) within each layer. For example, when the geometric change of the model in the z-axis direction is small, within each data layer of the z-axis, rays are projected along the x-axis and y-axis respectively, and the number of intersections of each ray with the surface voxels of the model is counted.

[0066] To improve the accuracy of the determination, FGV only retains the rays with exactly 2 intersections and marks all the voxels they pass through as internal voxels. The rationality of this strategy lies in that when the number of intersections of the ray with the model boundary is 2, it means that the ray only passes through the surface layer of the model and is not interfered by complex geometric topologies. Therefore, it can be reliably judged that all the voxels between the two intersections are inside the model. In addition, this method reduces the dependence on floating-point operations, reduces the possibility of misjudgment, and effectively reduces the calculation amount. Figure 7 It is to perform voxel judgment and filling on the inside of the three-dimensional model after surface voxelization through the improved odd-even counting method. Figure 7 (a) represents the result diagram of the surface voxelization of the three-dimensional model; Figure 7 (b) represents the display diagram of filling internal voxels through the improved odd-even counting method.

[0067] The improved odd-even counting method has significant advantages in terms of the computational efficiency of internal voxel determination. Compared with traditional methods, this algorithm does not need to directly perform intersection detection and floating-point calculations with the surface of the 3D model. Instead, based on the completed surface voxelization result, it uses the position information of the surface voxels for determination. By calculating the number of surface voxels passed through by parallel rays, the internal space with relatively simple geometric structure can be accurately judged, thus greatly reducing the computational complexity and improving the processing efficiency. And by using this method, due to the simple judgment logic, the accuracy of voxelization is also improved. As Figure 8 Shown is the internal voxelization effect of a cross-section of the 3D model using the improved odd-even counting method. Figure 8 (b) The two straight lines are schematic detection lines. During the actual detection process, the detection lines will traverse all voxel regions in the x and y directions. Only when exactly two voxels marked by surface voxelization exist on a certain detection line, all the voxels between these two voxel points passed by the detection line will be marked as internal voxels. Figure (a) shows the cross-section of the marked voxel distribution, (c) shows the internal voxelization result. Figure (a) is the result of the surface voxelization of this cross-section of the 3D model, that is, the result of performing intersection detection between voxel units and the triangles representing the surface of the 3D model; Figure (c) is the internal region of this cross-section obtained after the detection lines have traversed all voxel regions in the x and y directions.

[0068] In the simple regions of the model, the determined internal voxels can be directly filled using the improved odd-even counting method. While in complex regions (such as Figure 2-8 the circular part in), since the circular boundary is a smooth and continuous curve in the CAD model, but after voxelization, it is represented as an irregular boundary formed by fitting discrete points, so how to accurately handle the boundaries of such complex curves has always been one of the difficulties of the voxelization algorithm. For this reason, the FGV algorithm adopts a partition filling strategy: for simple internal structures, it uses the improved odd-even counting method for efficient filling; for complex internal regions, on the basis of the already filled internal voxels, the flood filling method is further applied for supplementation. This strategy can not only quickly complete the internal voxelization, but also ensure the integrity and accuracy of filling, effectively enhancing the adaptability and robustness of the algorithm under different geometric forms.

[0069] 2. Flood filling method

[0070] The Flood Fill Algorithm is a classic algorithm for filling enclosed areas. Its core idea is to start from a starting point (seed point) and spread to adjacent areas around it, filling all eligible positions with the target color or marking. In the present invention, all the internal voxels marked by the improved parity counting method are used as starting points. These seed points are added to the queue to be processed at the initial stage of flood filling, and the filling conditions and boundary restrictions of each position are uniformly checked during the spreading process. The Free Growth Voxelization (FGV) algorithm performs flood filling in a 6-neighborhood manner, as Figure 9 shown, similar to the free growth and reproduction of plants, thus filling the internal area of the entire three-dimensional model to achieve accurate voxelization. (a) shows a single voxel, and a voxel unit represents the internal space of the three-dimensional model at the position of this voxel. (b) shows the process of flood filling spreading outward from a single voxel, that is, retrieving voxels that also exist inside the model in six directions: up, down, left, right, front, and back from the initial voxel. (c) shows the next round of internal voxel retrieval of the process in (b).

[0071] The detailed steps are as follows: Step 1: Locate the initial seed points using the improved parity counting method: Use the internal voxels screened out by the improved parity counting method in the previous step as the initial seed group for the flood fill algorithm.

[0072] Step 2: Multi-start flood filling: Starting from each seed point, perform strict 6-neighborhood (front, back, left, right, up, down) spreading to avoid incorrect filling in the diagonal direction. In each iteration, the algorithm will identify the six adjacent voxels (up, down, left, right, front, back) of the current seed point, ensuring that each newly filled voxel is adjacent to at least one filled voxel, and enabling each batch of seed communities to spread all the adjacent areas around the community. When the voxels around the current round of seeds are filled, these newly filled voxels will become the seeds for the next round of expansion.

[0073] Taking the filling inside the triangle in Figure 4 as an example, the internal voxel filling process of the FGV algorithm is as Figure 10 shown. During the demonstration process, green represents the seeds that are expanding, and gray represents the seeds that have been filled. Through the reproduction and iteration of the seeds, the algorithm can accurately fill all internal voxels. (a) In the instance where the surface voxelization is completely covered, the initial seeds complete the voxelization of the entire internal entity space after six iterations. (b) In the instance where the surface voxelization has partial coverage, the initial seeds complete the voxelization of the entire internal entity space after 7 iterations.

[0074] During the process of filling the internal voxels of a 3D model using the flood filling method, the 3D space is filled in six directions. Since it is the filling of a seed group, for the internal voxels that repeatedly appear adjacent to multiple seed voxels, they will not be repeatedly marked during the marking process. After the voxel is marked by its adjacent seed voxels, its own value becomes "1". Therefore, it does not meet the condition of changing from "0" to "1", and during this iteration process, since it changes from "0" to "1", these voxels will become the seed group for the next iteration. Since the voxels on the surface of the 3D model have been assigned the value "1" during surface voxelization, during subsequent internal voxelization, these voxels will not only not change, but also, since they do not meet the condition of changing from "0" to "1", they form a natural barrier for internal voxelization, and the internal voxelization process will not break through the surface of the 3D model.

[0075] IV. The algorithm flow of Free Growth Voxelization (FGV) is as follows: I. Input Read triangular mesh data in STL, OBJ, or OFF format; Extract the geometric information of the mesh (vertex coordinates, face indices, normal vectors); Step 1: Voxel grid division: 1. Calculate the minimum bounding box (Bounding Box) of the model; 2. Divide the 3D voxel grid according to the preset voxel size; 3. Traverse all triangles to determine the voxel range to be checked.

[0076] Step 2: Surface voxelization: 1. Perform intersection detection between triangles and voxel units; 2. Mark all voxels that intersect with the triangle surface; 3. Generate surface voxel data.

[0077] Step 3: Perform partial internal voxelization using the improved parity counting method: 1. Select the axis (x, y, or z) with the least morphological change of the 3D model; 2. Scan layer by layer along this direction and project rays; 3. Count the number of intersection points between the rays and the model boundary: Number of intersection points = 2, mark the voxels penetrated by the rays as internal voxels; Number of intersection points ≠ 2, ignore this ray; 4. Generate partial internal voxel data.

[0078] Step 4: Perform complete internal voxelization using the flood filling algorithm: 1. Use the internal voxels obtained by the parity counting method as seed voxels; 2. Fill using the six-neighborhood expansion principle (front, back, left, right, up, down). 3. Stop expanding when the surface voxel boundary is encountered during the filling process. 4. Ensure that all internal voxels are correctly labeled.

[0079] Step 5: Data storage and output: 1. Generate a complete three-dimensional Boolean matrix (3D Boolean Matrix). 2. Store the voxel data in the.npy format. 3. The voxelized data is used for subsequent applications (machining, additive manufacturing, FEA, CAD, medical imaging, etc.).

[0080] II. Output the voxelized model, i.e., the complete 3D voxel data.

[0081] V. Experimental comparison and analysis

[0082] In the field of 3D model voxelization, Binvox is widely used due to its rich public resources and continuous updates. This invention mainly conducts a comparative analysis of FGV and Binvox. Binvox uses the odd-even counting method for filling the internal voxels of 3D models, while FGV optimizes the odd-even counting method on this basis, improving the calculation efficiency, and combines the flood filling method to make its voxelization accuracy higher in complex geometric models. The experimental environment is the Windows 10 operating system, and the hardware configuration includes a 13thGen Intel® Core™ i5-13600KF CPU and an NVIDIA GeForce RTX 4060 Ti GPU (16GB video memory). The development environment uses CUDA Toolkit 12.2, and the programming language is Python 3.11.7.

[0083]

Voxelization of 24 common machining features

[0084] To verify the accuracy of the FGV algorithm in voxelizing individual machining features of machine parts, voxelization experiments were conducted on 24 common machining features respectively. In the experiment, both FGV and Binvox were processed at a resolution of 64x64x64. Figure 11Among them, Figure (a) shows the voxelization of 24 common machining features using the free growth voxelization (FGV) method proposed in the present invention. Figure (b) describes the voxelization using the widely used open-source voxelization method Binvox. It can be seen from the comparison that Binvox cannot achieve accurate voxelization when dealing with individual machining features such as O-rings, holes, through slots, pockets, and steps. Usually, voxels outside the geometric model are wrongly defined as true. This error will lead to inaccurate calculation and analysis results in voxelization applications, thus affecting the overall performance and reliability. In contrast, the FGV method proposed in the present invention shows high precision in the voxelization of all common machining features. The experimental results show that FGV can maintain high precision inside and at the boundary of the voxelized geometric model. When dealing with complex and detailed features, it can also well retain geometric properties.

[0085] In terms of assignment accuracy, the Binvox method can usually accurately assign voxel values to 0 or 1 in most cases, and the accuracy rate may exceed 90%. For scenarios that require high precision or scenarios of processing imperfect raw data (such as converting lidar-scanned point cloud data into voxel data), Binvox is sufficient to meet these strict requirements. However, in the mechanical field where computer-aided process planning (CAPP) systems are widely used, mechanical components usually have completely closed geometric shapes. This indicates that the source data is highly accurate and requires the accuracy and speed of voxelization technology applications to ensure the fidelity and efficiency of the modeling and simulation processes.

[0086] Therefore, choosing FGV voxelization is a more appropriate choice, which can ensure perfect precision. Figure 12 and Figure 13 shows Figure 11 Three of the 24 simple machining feature models described in, indicating that the voxelization results produced by the Binvox method usually interpret cavities as solid entities. At the same time, Figure 14 The cross-section shown further confirms that the FGV voxelization algorithm has better effects in terms of accuracy.

[0087] FGV has high precision mainly due to the proposed free growth voxelization (FGV) method, which only performs addition and subtraction operations on a three-dimensional Boolean matrix during internal filling. This algorithm avoids complex floating-point operations during the internal filling process of voxelization, significantly reducing the computational complexity, thus greatly reducing calculation errors. In addition, comparative experiments were also conducted on different algorithms. Voxelization was performed using FGV and Binvox at various resolutions, including 32×32×32, 64×64×64, 128×128×128, and 256×256×256, and the time required for each resolution was measured as a comparison index. The experimental results are as Figure 15As shown. The time required for Binvox to process 32×32×32, 64×64×64, and 128×128×128 grids is almost the same, approximately 5 seconds. However, the processing time of the FGV algorithm for 32×32×32 and 64×64×64 grids is less than 0.5 seconds, which is an order of magnitude faster than Binvox. Nevertheless, it should be noted that as the grid size increases, the time required for the FGV algorithm also increases significantly. Therefore, this algorithm is particularly suitable for voxel grids with a resolution below 256×256×256.

[0088]

Voxelization of Complex Parts

[0089] To verify that the FGV algorithm can not only accurately and quickly voxelize parts with a single feature, but also effectively process complex components, three mechanical connectors with complex features shown in Figure 16 and two human models with complex curved surfaces shown in Figure 17 were selected for voxelization. The input was an STL file, and the output was a three-dimensional boolean digital matrix. Then the three-dimensional boolean matrix was visualized. Figure 16 In the figure, (a), (b), and (c) depict typical mechanical connectors. In each subfigure, the second image presents the voxelized representation of the first solid model, and the third subfigure is the voxel cross-section of the bottom surface.

[0090] In Figure 17 the voxelization of the two complex human models can be observed from multiple perspectives. The color changes in the images are used to distinguish the voxelization of each layer. From the experimental results, it can be concluded that the voxelization accuracy of the FGV algorithm for three-dimensional models meets the application requirements. From (a) and (b), it can be accurately judged that for complex three-dimensional models, the FGV can reproduce the original three-dimensional model using voxel data while ensuring the internal filling degree of the model, and there is no situation where voxel filling overflows the model surface during the process of judging internal voxels.

[0091] The FGV voxelization algorithm consists of four steps: reading the STL file, surface voxelization, calculating and determining the initial internal voxels using an improved parity counting method, and filling the internal voxels using the flood fill method. The present invention uses voxel unit sizes of 1 mm, 0.5 mm, and 0.2 mm to evaluate the performance of these five models. As shown in Table 1, the number of triangles in the STL files of these five models ranges from 103 to 107, and the size is approximately around 100 mm, which is consistent with the typical size range of mechanical parts. The data shows that the total time required for voxelization is mainly affected by the number of voxels. This is because as the number of voxels increases, the number of iterations required for internal filling also increases, thus affecting the overall voxelization time. When the number of voxels approaches 1 million, the total time is about 1 second, showing remarkable performance. Overall, the FGV algorithm prioritizes accuracy during the voxelization process while effectively balancing efficiency, making it suitable for voxelizing 3D models with high accuracy requirements and small voxel scales.

[0092] Table 1 Performance evaluation of the FGV voxelization algorithm on five models with different complexities and voxel sizes

[0093] The free-growing voxelization (FGV) algorithm proposed by the present invention aims to provide an efficient and high-precision solid voxelization method for watertight 3D models. This algorithm fully combines the advantages of the traditional parity counting method and the flood fill method, and by simulating the natural growth process of plants, it realizes the process of gradually expanding and filling from the initial internal voxel seeds, thus ensuring the continuity and integrity of the internal region during the voxelization process.

[0094] A watertight 3D model is a geometric model that is completely enclosed in three-dimensional space without internal or external holes. Its core feature is that the surface of the model forms a continuous closed shell, ensuring that any ray starting from the inside of the model will eventually intersect the surface twice (enter and leave) without the ray "leaking" due to holes or gaps.

[0095] During the algorithm process, first, using triangular mesh data in STL, OBJ, or OFF format, information such as the vertices, face indices, and normal vectors of the model is extracted. And according to the minimum bounding box of the model and the preset voxel size, the three-dimensional space is divided into regular voxel grids. Then, through the intersection detection between triangles and voxel units, the surface voxelization of the model is completed, and a reliable surface boundary is constructed thereby. After that, based on the surface voxelization, the algorithm uses an improved parity counting method to preliminarily judge the internal voxels. Specifically, a scanning axis (x, y, or z axis) with less geometric change is selected for layer-by-layer scanning, rays are projected along the orthogonal direction, and only the rays with exactly 2 intersection points are retained. The voxels on the ray path are marked as internal voxels, so as to efficiently screen out the initial seed voxels.

[0096] After obtaining the initial internal voxel seeds, the FGV algorithm uses the flood filling method to completely fill the entire internal space. This filling process starts from the seed points and expands strictly according to the six neighborhoods of front, back, left, right, up, and down, ensuring that each newly filled voxel is adjacent to at least one filled voxel, thus preventing duplicate marking and error diffusion. Since the surface voxels of the three-dimensional model have been accurately marked as "1" in the previous stage, they naturally form a boundary barrier during the filling process, preventing the internal voxels from expanding into the external area by mistake. The whole process only relies on Boolean operations, avoiding complex floating-point calculations, thus greatly reducing the computational complexity and significantly improving the execution efficiency on the premise of ensuring high precision.

[0097] The FGV algorithm has the following advantages: First, by directly applying the improved parity counting method in simple geometric regions, a large number of internal voxel seeds can be quickly and accurately screened out, reducing the computational burden; Second, the flood filling strategy ensures the integrity and coherence of the internal voxelization, and high precision can be maintained even in complex internal structures; Finally, this method mainly relies on Boolean operations rather than floating-point calculations, which not only improves the computational efficiency but also reduces the judgment errors caused by numerical errors.

[0098] Generally speaking, the FGV voxelization method significantly improves the computational efficiency while maintaining high-precision internal filling of voxels. This algorithm is applicable to fields such as machining, additive manufacturing, finite element analysis, computer-aided design, and medical imaging that require accurate representation of internal structures, providing an effective technical means for the voxelization of high-precision three-dimensional models.

[0099] The above embodiments are not limitations on the present invention, and the present invention is not limited to the above examples either. Changes, modifications, additions, or substitutions made by those skilled in the art within the scope of the technical solution of the present invention also fall within the protection scope of the present invention.

Claims

1. An efficient 3D model method based on the odd-even counting method and the flood filling method, characterized in that: The method includes the following steps: Step S1, data extraction, and voxel grid division; Step S2, perform surface voxelization to generate surface voxel data; Step S3: Use an improved odd-even counting method for partial internal voxelization; Step S4: Use a flood filling algorithm for complete internal voxelization; Step S5, data storage and output, output the voxelization model, that is, complete 3D voxel data.

2. The efficient three-dimensional model method based on the parity counting method and the flood filling method according to claim 1, wherein: In the said step S1, data extraction includes: reading triangular mesh data in STL, OBJ, or OFF format, and extracting the geometric information of the mesh: vertex coordinates, face indices, and normal vectors.

3. The efficient three-dimensional model method based on the parity counting method and the flood filling method according to claim 2, wherein: In the said step S1, voxel grid division includes the following steps: S11, regularly divide the three-dimensional space according to a preset voxel size so that the entire three-dimensional model is embedded in the voxel grid, and calculate the minimum bounding box of the model; S12, divide the 3D voxel grid according to a preset voxel size; S13, traverse all triangles to determine the voxel range to be checked.

4. The efficient three-dimensional model method based on the parity counting method and the flood filling method according to claim 1, characterized in that: The said step S2 includes the following steps: S21, perform intersection detection between the triangle and the voxel unit; S22, mark all voxels that intersect with the triangle surface to complete surface voxelization; S23, generate surface voxel data.

5. The efficient three-dimensional model method based on the parity counting method and the flood filling method according to claim 1, characterized in that: The said step S3 includes the following steps: S31, select the axis with the least morphological change of the three-dimensional model as the scanning axis: the x-axis or the y-axis or the z-axis; S32, scan layer by layer along this direction, and project rays in the other two orthogonal directions within each layer, that is, the two directions perpendicular to the scanning axis; S33, count the number of intersections of each ray with the model boundary: If the number of intersections = 2, mark the voxels passed by the ray as internal voxels; If the number of intersections ≠ 2, ignore this ray; S34, generate partial internal voxel data.

6. The efficient three-dimensional model method based on the parity counting method and the flood filling method according to claim 1, characterized in that: The said step S4 includes the following steps: S41, use the internal voxels obtained by the improved odd-even counting method as the initial seed voxels; S42, adopt the six-neighborhood expansion principle, and gradually fill the entire enclosed area in the front, back, left, right, up, and down six directions to ensure that all internal voxels are correctly marked; S43, use the model boundary formed by surface voxelization as the boundary of flood filling during the expansion process, and stop expanding when encountering the surface voxel boundary during the filling process.

7. The efficient three-dimensional model method based on the parity counting method and the flood filling method according to claim 1, characterized in that: The said step S5 includes the following steps: S51, generate a complete three-dimensional Boolean matrix through step S4; S52, store the voxel data in the.npy format; S53, use the generated voxelized data for subsequent applications.

8. The efficient three-dimensional model method based on the parity counting method and the flood filling method according to claim 7, characterized in that: In the said step S5, in the three-dimensional Boolean matrix, the voxels with a value of 1 represent the occupied areas, that is, the surface or internal voxels, and the voxels with a value of 0 represent the blank areas.

9. Application of an efficient three-dimensional model method based on the parity counting method and the flood filling method according to any one of claims 1-8, characterized in that: Apply this method to the fields of machining, additive manufacturing, finite element analysis FEA, computer-aided design CAD, and medical imaging.

Citation Information

Patent Citations

  • Filling algorithm for rapidly matching pair of left and right boundary point

    CN101201938A

  • Building three-dimensional model simplification algorithm based on linear geometry fitting

    CN113793418A

  • Three-dimensional model voxelization method and device, electronic equipment and storage medium

    CN113850917A

  • Cavity completion method of dental crown three-dimensional model, medium and equipment

    CN118071942A

  • Lightweight conceptual design prototype tunnel-free voxelization method based on boundary mark filling

    CN118691764A