Cutting simulation method based on voxel division algorithm and incision sampling optimization
Through cutting simulation methods based on voxel division algorithm and cut sampling optimization, the problem of difficult to achieve high-precision and smooth simulation effects in the existing technology is solved, and efficient and accurate cutting simulation is achieved, which is suitable for simulation requirements in complex scenarios.
Patent Information
- Application Number
- CN202411875692.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-02-14
AI Technical Summary
The existing cutting simulation technology is difficult to achieve high-precision and smooth simulation results, and has high requirements for computer performance, making it difficult to maintain smooth simulation results in complex scenarios.
Using a cutting simulation method based on voxel division algorithm and cut sampling optimization, the objects are discrete into small voxel units by voxel division of the cutting object, and the collision detection and redrawing process is optimized through the BVH tree structure and drawing unit. .
It avoids the large amount of resource consumption required for Boolean operations, improves the drawing efficiency and collision detection efficiency, realizes high-precision simulation results and smooth cutting effects, and enhances the accuracy of simulation results and the authenticity of the picture.
Smart Images

Figure CN119442369A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of cutting simulation, and in particular to a cutting simulation method based on voxel partitioning algorithm and incision sampling optimization. Background Art
[0002] The current cutting simulation technology cannot achieve high-precision simulation effects and has high requirements on computer performance. In many scenarios, it is difficult to achieve smooth simulation effects. Researching high-precision and real-time smooth cutting simulation methods has become an urgent problem to be solved in this field.
[0003] In view of this, the Chinese invention patent with publication number CN116796464A discloses a real-time simulation visualization method for cutting processing based on Unreal Engine, which includes three parts: physical modeling module, data acquisition module and cutting visualization module, to achieve real-time visualization monitoring effect of CNC machine tool processing process. The tool and the workpiece to be processed in the virtual machine tool are collided, Boolean operations are performed on the parts where the workpiece to be processed collides, and the nodes of the workpiece model to be processed are dynamically deleted and updated to achieve real-time material removal effect of the workpiece to be processed.
[0004] The above technical solution uses the third-party Unreal Engine as a 3D simulation tool, obtains the collision detection results, and then performs Boolean operations on the colliding parts to achieve the cutting effect. Its limitation is that as a general game engine, the Unreal Engine has complex functions and contains too many modules that are irrelevant to the functions. It has too high performance requirements for the program running machine. The realization of the cutting result depends on Boolean operations, so the entire model needs to be meshed and complex Boolean operations need to be performed on each frame, which consumes a lot of computer resources and is difficult to maintain a smooth simulation effect in complex scenes.
[0005] Therefore, a new technical solution is urgently needed to solve the above technical problems. Summary of the invention
[0006] The purpose of the present invention is to overcome the above-mentioned problems of the prior art and to provide a cutting simulation method based on voxel partitioning algorithm and incision sampling optimization to solve the technical problems in the prior art that the Unreal Engine has complex functions, contains too many modules that are irrelevant to the functions, has too high performance requirements on the machine where the program runs, and the realization of the cutting results relies on Boolean operations. Therefore, it is necessary to grid the entire model and perform complex Boolean operations in each frame, which consumes a large amount of computer resources and is difficult to maintain a smooth simulation effect in complex scenes.
[0007] The above objectives are achieved through the following technical solutions:
[0008] A cutting simulation method based on voxel partitioning algorithm and cut sampling optimization, comprising:
[0009] Step (1) obtaining the topological information of the object to be cut, and dividing it into triangular facets to obtain triangular facet information of the model;
[0010] Step (2) based on the triangular face information of the model in step (1), the outer surface of the model is voxelized by an outer surface voxelization algorithm, and the interior of the model is voxelized by a scanning line algorithm, so as to finally obtain three-dimensional voxel information of the object being cut;
[0011] Step (3) constructing a BVH tree according to the three-dimensional voxel information in step (2), and establishing a plurality of rendering units containing voxel information according to the BVH tree;
[0012] Step (4) obtaining the real-time position of the tool and performing collision detection with the BVH tree in step (3) to obtain a number of cut voxels;
[0013] Step (5) recording the rendering unit to which each of the cut voxels in step (4) belongs into an updated rendering list;
[0014] Step (6) sampling the cut voxel in step (5) at a number of custom sampling points, and determining whether the sampling points are cut, optimizing according to the cutting status, and proceeding to the next step;
[0015] Step (7) traverses each drawing unit in the updated drawing list and redraws.
[0016] Furthermore, the topological information of the object being cut is obtained in step (1) through the Open CASCADE geometry library.
[0017] Furthermore, in step (2), the outer surface of the model is divided into voxels using an outer surface voxelization algorithm, specifically:
[0018] Select the two longest sides L of the triangle ab L ac , divide it into n equal parts with a length m close to the voxel size, then:
[0019] L ab After n equal divisions, we get points p1, p2, p3…;
[0020] L ac After n equal divisions, we get points q1, q2, q3…;
[0021] L ab ,L ac The divided points are connected in sequence to obtain p1q1, p2q2, p3q3;
[0022] For each link p i q i Divide it into equal parts again with length m;
[0023] For each link p i q i Every equally divided point on the triangle, including the endpoints, is found, and the voxelization of the triangular face is completed.
[0024] Furthermore, the determination of n is as follows:
[0025] L=max(L ab ,L ac );
[0026] n = L / m;
[0027] Wherein, n is an integer greater than 0.
[0028] Furthermore, in step (2), the voxel division of the interior of the model is performed by using a scan line algorithm, specifically:
[0029] Establish a scan line queue q;
[0030] Select a starting node s inside the model and store point s in q;
[0031] Traverse the nodes in q, set the current node to b, and mark b as an internal node;
[0032] Find all voxel nodes n1, n2, n3, etc. that are directly above and below the same vertical line as b in order. If a boundary node is encountered, stop searching and record these found nodes as nodes on the same line. If they are not marked as internal nodes, mark them as internal nodes.
[0033] Find the four nodes m1, m2, m3, m4 in front, behind, left and right of the currently traversed node on the same line, and determine whether these four nodes are internal nodes. If not, store them in q;
[0034] After traversing all nodes in q, the voxelization process inside the model is completed.
[0035] Furthermore, the BVH tree in step (3) is a spatially divided data structure, which is divided layer by layer according to the spatial position relationship of the voxel nodes.
[0036] Furthermore, the step (3) of establishing a number of drawing units containing voxel information based on the BVH tree is specifically as follows: selecting a number of voxel nodes as basic drawing units, setting the number of voxels Q of a drawing unit, traversing the BVH tree of voxels, and when the number of voxels contained in all leaf nodes of the node is less than Q, selecting the node as the drawing unit.
[0037] Furthermore, the number of sampling points in step (6) is 4.
[0038] The present invention provides a cutting simulation method based on voxel partitioning algorithm and incision sampling optimization. By performing voxel partitioning on the cut object, the object is discretized into small voxel units, so that the cut area and the uncut area can be easily distinguished, avoiding the large amount of resource consumption required by Boolean operations. It is crucial to optimize the efficiency of cutting simulation by generating a BVH tree structure from the divided voxels and establishing several drawing units based on the structure. This optimization enables high-precision voxel generation of the cut object and greatly improves the drawing efficiency and collision detection efficiency. The accuracy of the final simulation result is improved by optimizing the sampling of the cut voxels, a smooth cutting effect is achieved at the incision, and the authenticity of the picture is greatly improved. This method has excellent performance and reliability in the simulation field, and provides users with comprehensive and accurate simulation services. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flowchart of a cutting simulation method based on a voxel partitioning algorithm and incision sampling optimization according to the present invention;
[0040] Figure 2 A schematic diagram of rapid voxelization of triangular surfaces in a cutting simulation method based on a voxel partitioning algorithm and cut sampling optimization according to the present invention;
[0041] Figure 3 It is a schematic diagram of sampling optimization of collision voxels in a cutting simulation method based on voxel partitioning algorithm and incision sampling optimization described in the present invention. DETAILED DESCRIPTION
[0042] The present invention is further described in detail below based on the accompanying drawings and embodiments. The described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] like Figure 1 and Figure 2As shown, this solution provides a cutting simulation method based on voxel partitioning algorithm and incision sampling optimization, which can meet the simulation needs in complex scenarios in actual business. This technology discretizes the model into a certain number of voxels based on the voxelization method, and at the same time introduces a sampling optimization method to accurately calculate the discretized voxels. The combination of the two ensures that the simulation efficiency can also ensure that the simulation results have high accuracy.
[0044] like Figure 1 As shown, it mainly includes the following steps:
[0045] Step (1) obtaining the topological information of the object to be cut, and dividing it into triangular facets to obtain the triangular facet information of the model; specifically, based on the voxelization of the object to be cut, it is first necessary to obtain the topological information of the object to be cut through a geometric library such as Open CASCADE, and then divide it into triangular facets according to the topological information;
[0046] Step (2) based on the triangular face information of the model in step (1), the outer surface of the model is voxelized by an outer surface voxelization algorithm, and the interior of the model is voxelized by a scanning line algorithm, so as to finally obtain three-dimensional voxel information of the object being cut;
[0047] Step (3) constructs a BVH tree according to the three-dimensional voxel information in step (2), and establishes a number of rendering units containing voxel information according to the BVH tree; the BVH tree is a data structure of spatial division, which is divided layer by layer according to the spatial position relationship of the voxel nodes, which will greatly improve the efficiency of real-time simulation in collision detection and update rendering; in addition, according to the BVH tree, select nodes of appropriate levels as basic rendering units, set the number of voxels Q of a rendering unit, for example, Q=100, traverse the BVH tree of voxels, and when the number of voxels contained in all leaf nodes of the node is less than Q, select the node as the rendering unit;
[0048] Step (4) obtaining the real-time position of the tool and performing collision detection with the BVH tree in step (3) to obtain a number of cut voxels;
[0049] Step (5) recording the rendering unit to which each of the cut voxels in step (4) belongs into an updated rendering list;
[0050] Step (6) sampling the cut voxel in step (5) at a number of custom sampling points, and determining whether the sampling points are cut, optimizing according to the cutting status, and proceeding to the next step;
[0051] Step (7) traverses each of the drawing units in the updated drawing list and redraws. The introduction of the drawing unit in this solution greatly reduces the number of primitives that need to be redrawn, and only the voxels in the cut area need to be redrawn instead of the entire object.
[0052] This method meshes the object to be cut to obtain the triangular face information of the model, and then divides the generated triangular face into voxels to obtain the voxel structure of the model. This avoids a large amount of performance consumption when performing cutting calculations directly through the mesh of the model. Next, the generated voxels are subjected to collision detection with the tool to preliminarily obtain the cut voxels, and then the sampling optimization method is combined to perform sampling calculations on each cut voxel to obtain accurate simulation results.
[0053] like Figure 2 As shown, as a specific description of step (2) in this embodiment:
[0054] The outer surface of the model is divided into voxels by using a voxelization algorithm of the outer surface, specifically:
[0055] Select the two longest sides L of the triangle ab L ac , divide it into n equal parts with a length m close to the voxel size, then:
[0056] L ab After n equal divisions, we get points p1, p2, p3…;
[0057] L ac After n equal divisions, we get points q1, q2, q3…;
[0058] L ab ,L ac The divided points are connected in sequence to obtain p1q1, p2q2, p3q3;
[0059] For each link p i q i Divide it into equal parts again with length m;
[0060] For each link p i q i Every equally divided point on the triangle, including the endpoints, is found, and the voxelization of the triangular face is completed.
[0061] The n is an integer greater than 0, and is determined as follows:
[0062] L=max(L ab ,L ac );
[0063] n = L / m.
[0064] The voxel division of the interior of the model by the scan line algorithm is specifically as follows:
[0065] Establish a scan line queue q;
[0066] Select a starting node s inside the model, usually the center point of the model bounding box, and store point s in q;
[0067] Traverse the nodes in q, set the current node to b, and mark b as an internal node;
[0068] Find all voxel nodes n1, n2, n3, etc. that are directly above and below the same vertical line as b in order. If a boundary node is encountered, stop searching and record these found nodes as nodes on the same line. If they are not marked as internal nodes, mark them as internal nodes.
[0069] Find the four nodes m1, m2, m3, m4 in front, behind, left and right of the currently traversed node on the same line, and determine whether these four nodes are internal nodes. If not, store them in q;
[0070] After traversing all nodes in q, the voxelization process inside the model is completed.
[0071] As a specific description of step (6) in this embodiment:
[0072] like Figure 3 As shown, there are 4 custom sampling points, including C1, C2, C3, and C4, which are the four corners of the voxel. The gray circle in the figure is the outline of the tool.
[0073] Determine whether the four points are in the circle respectively. If so, it means they are cut, otherwise, they are not cut;
[0074] If a certain corner is cut, such as C4 in the figure, the lengths of d1 and d2 can be calculated based on the position and radius R of the tool and the geometric information of the voxel, and then the position of point A can be determined;
[0075] We can further obtain the specific cutting amount of the tool on the voxel in the Y direction. Similarly, we can calculate the cutting amount of the tool on the voxel in the X direction.
[0076] Assume the center of the circle is Q, and the cutting amount of the tool in the X direction is S x , the cutting amount of the tool in the Y direction is S y , then:
[0077] d2=|Q x -C4 x |;
[0078]
[0079] d4=|Q y -C4 y |;
[0080]
[0081] After calculating the cutting volume, the remaining geometry can be approximated by a pentagonal prism and drawn using a mesh.
[0082] Similarly, if two sampling points are cut, a quadrilateral prism is used to approximate the remaining geometry and is drawn through a mesh; if three sampling points are cut, a triangular prism is used to approximate the remaining geometry and is drawn through a mesh.
[0083] The above description is only for illustrating the implementation mode of the present invention and is not intended to limit the present invention. For those skilled in the art, any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A cutting simulation method based on voxel partitioning algorithm and incision sampling optimization, characterized in that: include: Step (1) obtaining the topological information of the object to be cut, and dividing it into triangular facets to obtain triangular facet information of the model; Step (2) based on the triangular face information of the model in step (1), the outer surface of the model is voxelized by an outer surface voxelization algorithm, and the interior of the model is voxelized by a scanning line algorithm, so as to finally obtain three-dimensional voxel information of the object being cut; Step (3) constructing a BVH tree according to the three-dimensional voxel information in step (2), and establishing a plurality of rendering units containing voxel information according to the BVH tree; Step (4) obtaining the real-time position of the tool and performing collision detection with the BVH tree in step (3) to obtain a number of cut voxels; Step (5) recording the rendering unit to which each of the cut voxels in step (4) belongs into an updated rendering list; Step (6) sampling the cut voxel in step (5) at a number of custom sampling points, and determining whether the sampling points are cut, optimizing according to the cutting status, and proceeding to the next step; Step (7) traverses each drawing unit in the updated drawing list and redraws.
2. The cutting simulation method based on voxel partitioning algorithm and incision sampling optimization according to claim 1 is characterized in that: The topological information of the object being cut is obtained in step (1) through the Open CASCADE geometry library.
3. The cutting simulation method based on voxel partitioning algorithm and incision sampling optimization according to claim 1 is characterized in that: In step (2), the outer surface of the model is divided into voxels by using the voxelization algorithm of the outer surface, specifically: Select the two longest sides L of the triangle ab L ac , divide it into n equal parts with a length m close to the voxel size, then: L ab After n equal divisions, we get points p1, p2, p3…; L ac After n equal divisions, we get points q1, q2, q3…; L ab ,L ac The divided points are connected in sequence to obtain p1q1, p2q2, p3q3; For each link p i q i Divide it into equal parts again with length m; For each link p i q i Every equally divided point on the triangle, including the endpoints, is found, and the voxelization of the triangular face is completed.
4. The cutting simulation method based on voxel partitioning algorithm and incision sampling optimization according to claim 3 is characterized in that: The determination of n is as follows: L=max(L ab ,L ac ); n = L / m; Wherein, n is an integer greater than 0.
5. The cutting simulation method based on voxel partitioning algorithm and incision sampling optimization according to claim 1, characterized in that: In step (2), the interior of the model is divided into voxels using a scan line algorithm, specifically: Establish a scan line queue q; Select a starting node s inside the model and store point s in q; Traverse the nodes in q, set the current node to b, and mark b as an internal node; Find all voxel nodes n1, n2, n3, etc. that are directly above and below the same vertical line as b in order. If a boundary node is encountered, stop searching and record these found nodes as nodes on the same line. If they are not marked as internal nodes, mark them as internal nodes. Find the four nodes m1, m2, m3, m4 in front, behind, left and right of the currently traversed node on the same line, and determine whether these four nodes are internal nodes. If not, store them in q; After traversing all nodes in q, the voxelization process inside the model is completed.
6. The cutting simulation method based on voxel partitioning algorithm and incision sampling optimization according to claim 1, characterized in that: The BVH tree in step (3) is a spatial partitioning data structure, which is divided layer by layer according to the spatial position relationship of the voxel nodes.
7. A cutting simulation method based on voxel partitioning algorithm and incision sampling optimization according to claim 1 or 6, characterized in that: The step (3) of establishing a number of drawing units containing voxel information based on the BVH tree is specifically as follows: selecting a number of voxel nodes as basic drawing units, setting the number of voxels Q of a drawing unit, traversing the BVH tree of voxels, and when the number of voxels contained in all leaf nodes of the node is less than Q, selecting the node as the drawing unit.
8. The cutting simulation method based on voxel partitioning algorithm and incision sampling optimization according to claim 1, characterized in that: The number of sampling points in step (6) is 4.
Citation Information
Patent Citations
Cutting machining real-time simulation visualization method based on unreal engine
CN116796464A
Cited By
Five-axis real-time cutting simulation method based on voxels
CN121997492A