Curved surface layered slicing method based on projection method intersection detection
Through the surface layered slice method based on projection intersecting detection, the triangular slice intersecting with the surface layer is filtered out and intersected calculation is performed, which solves the problem of excessive intersect calculation time in the surface layered slice algorithm, and improves the algorithm Execution efficiency.
Patent Information
- Application Number
- CN202410922244.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-12-03
AI Technical Summary
In the existing surface hierarchical slicing algorithm, the intersecting calculations between triangle faces are mostly violent intersecting, resulting in too long running time or even memory crashes, and it is difficult to effectively filter out triangle faces that do not require intersecting.
The surface layered slicing method based on projection intersect detection is adopted. By extracting the surface of the three-dimensional model as the initial surface, moving the vertex of the triangle face sheet along the average normal direction to generate the offset surface and the triangle face sheet on the three-dimensional model Projected onto the XOY, XOZ and YOZ planes, intersecting triangle faces are filtered, intersected calculations are performed, and directed splicing is performed to obtain the slice profile.
This method reduces the unnecessary interpolation calculation between the triangular faces intersecting the surface layer, significantly reduces the running time of the algorithm and improves the execution efficiency.
Smart Images

Figure CN119068141A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of additive manufacturing, and in particular to a surface layering and slicing method based on projection method intersection detection. Background Art
[0002] Additive Manufacturing (AM), also known as 3D printing, is a manufacturing technology whose core concept is to manufacture parts by adding materials layer by layer. Additive manufacturing can manufacture complex internal structures, thin-walled structures and geometric shapes without the need for additional process steps, which can improve the performance and function of the product. At the same time, compared with traditional cutting processing, additive manufacturing can reduce material waste and thus improve material utilization.
[0003] All additive manufacturing is based on the principle of "discrete-accumulation", in which layered slicing is required in the discrete stage. Therefore, the layered slicing algorithm is the core of additive manufacturing technology. Layered slicing is divided into plane layered slicing and surface layered slicing. The surface layered slicing algorithm is more complicated than the plane layered slicing algorithm, which is mainly reflected in the intersection calculation between the offset surface and the model. The intersection calculation between the offset surface and the model is the intersection calculation between the triangular facets on the offset surface and the triangular facets on the model. In fact, the offset surface only intersects with a small part of the triangular facets on the model. If these triangular facets intersecting with the offset surface can be found, then the unnecessary intersection between most of the triangular facets can be avoided, thereby reducing the running time of the algorithm and improving the efficiency. For plane layered slicing, the triangular facets on the model that are completely impossible to intersect with the offset surface can be excluded by the spatial position relationship between the offset surface and the triangular facets, but for surface layered slicing, this method of excluding triangular facets that are impossible to intersect with the offset surface by spatial position relationship is not feasible, because the height of each triangular facet on the offset surface is different. Summary of the invention
[0004] The purpose of the present invention is to solve the following technical defects: the intersection calculation between triangular facets in the current surface layered slicing algorithm is mostly brute force intersection, that is, each triangular facet on the surface layer is intersected with each triangular facet on the model. It should be noted that there are usually tens of thousands or even hundreds of thousands of triangular facets on the model, and the layer thickness in the layered slicing is at the millimeter level. If a brute force intersection algorithm is used, the running time of the surface layered slicing algorithm will be too long, and even memory crashes will occur. For this reason, a surface layered slicing algorithm based on projection intersection detection is proposed.
[0005] In order to realize the above technical features, the object of the present invention is achieved as follows: a surface layering and slicing method based on projection method intersection detection comprises the following steps: Step 1, extracting the surface of the three-dimensional model as the initial surface; Step 2, move the vertices of the triangular facets on the initial surface along the average normal direction by the layer thickness, and then generate a series of offset surfaces according to the topological relationship; Step 3, project the offset surface and the triangular facets on the 3D model onto the three planes XOY, XOZ, and YOZ respectively, and then select the triangular facets on the 3D model that intersect with the offset surface according to the intersection of the projections; Step 4: perform intersection calculation on the selected triangular facets and the triangular facets on the offset surface to obtain the intersection line segments of each layer, and then perform directed splicing on the intersection line segments to obtain the slice contour of each layer.
[0006] Preferably, the specific steps of step 1 are: Step 1.1, traverse the triangular face on the 3D model, find the normal vector of the triangular face, and calculate the angle between the normal vector and the Z axis; Step 1.2, save the triangles that meet the conditions into a list.
[0007] Preferably, the three-dimensional model file is in stl format.
[0008] Preferably, the average normal direction is the average value of the sum of normal vectors of triangles sharing the vertex.
[0009] Preferably, the specific steps of step 3 are: Step 3.1, project the offset surface onto the three planes XOY, XOZ, and YOZ respectively, traverse the triangular facets on the three-dimensional model, and project the triangular facets onto the three planes respectively, perform Boolean operations on the two projections on the three planes respectively, and obtain the intersection of the two; Step 3.2, first determine whether the intersection of the two projections on the three planes is empty, and then determine whether the intersection of the two projections is the same as the projection of the triangle.
[0010] Preferably, the specific steps of step 4 are: Step 4.1, find the planes p1 and p2 where the two triangles s1 and s2 are located, and determine whether the three vertices of s1 are on the same side of p2 or whether the three vertices of s2 are on the same side of p1; Step 4.2, find the intersection line of the two planes p1 and p2, and assume that the parametric equation of the intersection line is p = p0 + t * v, where p0 is an arbitrary point on the intersection line L, and v is the direction vector of the intersection line L; respectively find the coordinates of the intersection point between the intersection line and the two triangles s1 and s2, and then obtain its parameter value t according to the coordinates of the intersection point. First, determine whether the two triangles intersect according to the parameter value, and then sort all the parameter values to obtain the intersection line of the two triangles; Step 4.3, perform directed splicing on the intersection lines of each layer to generate the slice contour of each layer.
[0011] The present invention has the following beneficial effects: The algorithm proposed in the present invention firstly selects the triangular facets on the model that intersect with the surface layer by projection method, then performs intersection calculation on the selected triangular facets with the triangular facets on the surface layer, and finally performs directed splicing on the line segments obtained by the intersection calculation to obtain the slice contour. The algorithm avoids unnecessary intersection between most triangular facets during the process of triangular facet intersection calculation, thereby reducing the running time of the algorithm and improving the execution efficiency of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0013] Figure 1 It is a flow chart of the present invention.
[0014] Figure 2 It is a schematic diagram of generating the surface layer.
[0015] Figure 3 (a), (b), and (c) are schematic diagrams for determining the intersection of two triangles.
[0016] Figure 4 (a), (b), and (c) are schematic diagrams for determining whether two triangles do not intersect.
[0017] Figure 5 It is a schematic diagram of filtering out triangular facets that intersect with the surface layer.
[0018] Figure 6 is a schematic diagram of generating slice outlines. DETAILED DESCRIPTION
[0019] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.
[0020] Embodiment 1: See also Figure 1-6 , a surface layered slicing method based on projection intersection detection, comprising the following steps: Step 1, extracting the surface of the three-dimensional model as the initial surface; Step 1.1, traverse the triangular face on the 3D model, find the normal vector of the triangular face, and calculate the angle between the normal vector and the Z axis; Step 1.2, save the triangles that meet the conditions into a list.
[0021] Step 2, move the vertices of the triangular facets on the initial surface along the average normal direction by the layer thickness, and then generate a series of offset surfaces according to the topological relationship; Step 3, project the offset surface and the triangular facets on the 3D model onto the three planes XOY, XOZ, and YOZ respectively, and then select the triangular facets on the 3D model that intersect with the offset surface according to the intersection of the projections; Step 3.1, project the offset surface onto the three planes XOY, XOZ, and YOZ respectively, traverse the triangular facets on the three-dimensional model, and project the triangular facets onto the three planes respectively, perform Boolean operations on the two projections on the three planes respectively, and obtain the intersection of the two; Step 3.2, first determine whether the intersection of the two projections on the three planes is empty, and then determine whether the intersection of the two projections is the same as the projection of the triangle.
[0022] Step 4: perform intersection calculation on the selected triangular facets and the triangular facets on the offset surface to obtain the intersection line segments of each layer, and then perform directed splicing on the intersection line segments to obtain the slice contour of each layer.
[0023] Step 4.1, find the planes p1 and p2 where the two triangles s1 and s2 are located, and determine whether the three vertices of s1 are on the same side of p2 or whether the three vertices of s2 are on the same side of p1; Step 4.2, find the intersection line of the two planes p1 and p2, and assume that the parametric equation of the intersection line is p = p0 + t * v, where p0 is an arbitrary point on the intersection line L, and v is the direction vector of the intersection line L; respectively find the coordinates of the intersection point between the intersection line and the two triangles s1 and s2, and then obtain its parameter value t according to the coordinates of the intersection point. First, determine whether the two triangles intersect according to the parameter value, and then sort all the parameter values to obtain the intersection line of the two triangles; Step 4.3, perform directed splicing on the intersection lines of each layer to generate the slice contour of each layer.
[0024] Furthermore, the three-dimensional model file is in stl format.
[0025] Furthermore, the average normal direction is the average value of the sum of normal vectors of triangles that share this vertex.
[0026] Implementation 2: Reference Figure 1 , a surface layered slicing algorithm based on projection intersection detection, including: Step 1, extracting the surface of the three-dimensional model as the initial surface; Step 2, move the vertices of the triangular facets on the initial surface along the average normal direction, the moving distance is the layer thickness, and then generate a series of offset surfaces according to the topological relationship; Step 3, project the offset surface and the triangular facets on the 3D model onto the three planes XOY, XOZ, and YOZ respectively, and then select the triangular facets on the 3D model that intersect with the offset surface according to the intersection of the projections; Step 4, performing intersection calculation on the selected triangular facets and the triangular facets on the offset surface to obtain a series of intersection line segments, and performing directed splicing on the intersection line segments to obtain a slice contour; Furthermore, the step 1 comprises: Step 1.1, traverse the triangular face on the three-dimensional model, find the normal vector of the triangular face according to the three vertices of the triangular face, calculate the dot product of the normal vector and the Z-axis vector, and thus find the angle between the triangular face and the Z plane; Step 1.2, if the angle is not 0, 90, or 180 degrees, and the angle between its adjacent triangle and the Z plane is not 0, 90, or 180 degrees, then the triangle is saved in a list. After traversing the triangles on the 3D model, the triangles in the list are the triangles on the initial surface. Furthermore, the step 2 comprises: Step 2.1, if the vertices of the triangles on the initial surface are shared by m triangles, calculate the normal vector of each triangle according to the coordinates of the three vertices; Step 2.2, the average normal direction of the vertex is: N = (n1 + n2 + ... + n m ) / m, move the vertices of the triangular facets on the initial surface along the average normal direction, the moving distance is the layer thickness, and then generate the offset surface according to the topological relationship; Furthermore, the step 3 comprises: Step 3.1, traverse the offset surface and project it onto the three planes XOY, XOZ, and YOZ respectively, then traverse the triangular facets on the three-dimensional model and project them onto the three planes, and finally perform Boolean operations on the two projections on the three planes to obtain the intersection of the two; Step 3.2, first eliminate the triangular facets on the 3D model that are completely impossible to intersect with the offset surface. If the intersections of the projections of the offset surface and the triangular facets on the three planes are not empty, then the triangular facet may intersect with the offset surface, otherwise they do not intersect; Then, a second screening is performed. If the intersection of the two projections on the three planes is not empty, and the intersection of the two projections on the three planes is the same as the projection of the triangle, then the triangle does not intersect with the offset surface; otherwise, the triangle intersects with the offset surface. If the projection of the triangle patch and the surface layer on the three planes is as follows Figure 3 As shown, the triangular facet intersects with the surface layer; If the projection of the triangle patch and the surface layer on the three planes is as follows Figure 4 As shown, the triangle patch does not intersect with the surface layer; Through these two screenings, the triangular facets on the three-dimensional model that intersect with the offset surface are found, avoiding unnecessary intersections between a large number of triangular facets in the subsequent intersection calculation process between the offset surface and the three-dimensional model, reducing the running time of the algorithm, and thus improving the execution efficiency of the algorithm.
[0027] Furthermore, the step 4 comprises: Step 4.1, traverse the triangles on the offset surface and the selected triangles, calculate the normal vectors of the two triangles s1 and s2 according to the vertex coordinates of the two triangles, and then define the planes p1 and p2 where the two triangles are located according to the normal vectors and vertex coordinates of the two triangles, and determine whether the three vertices on the triangle s1 are on the same side of the plane p2 or whether the three vertices on the triangle s2 are on the same side of the plane p1. If the three vertices are on the same side of the plane, the two triangles s1 and s2 do not intersect; Step 4.2, if the three vertices of the triangle are not on the same side of the plane, first, find the intersection line L of the two planes p1 and p2, and assume that the parametric equation of the intersection line L is p = p0 + t * v, where p0 is an arbitrary point on the intersection line L, and v is the direction vector of the intersection line L; then find the intersection coordinates m1, m2, m3, m4 between the intersection line L and the two triangles s1 and s2, and substitute the intersection coordinates m1, m2, m3, m4 into the parametric equation of the intersection line L to obtain the parameters t1, t2, t3, t4. If the maximum value of t1 and t2 is less than the minimum value of t3 and t4 or the minimum value of t1 and t2 is greater than the maximum value of t3 and t4, then the triangles s1 and s2 do not intersect. Otherwise, sort t1, t2, t3, and t4 from small to large to obtain ta, tb, tc, and td, where tb and tc are The line segment formed by the corresponding points is the intersection line between triangles s1 and s2; Step 4.3, after obtaining the intersection line of each layer, directed splicing is performed according to whether the first and last coordinates of the intersection line are the same, so as to obtain the slice contour of each layer.
Claims
1. A surface layering and slicing method based on projection intersection detection, characterized in that: The following steps are involved: Step 1, extracting the surface of the three-dimensional model as the initial surface; Step 2, move the vertices of the triangular facets on the initial surface along the average normal direction by the layer thickness, and then generate a series of offset surfaces according to the topological relationship; Step 3, project the offset surface and the triangular facets on the 3D model onto the three planes XOY, XOZ, and YOZ respectively, and then select the triangular facets on the 3D model that intersect with the offset surface according to the intersection of the projections; Step 4: perform intersection calculation on the selected triangular facets and the triangular facets on the offset surface to obtain the intersection line segments of each layer, and then perform directed splicing on the intersection line segments to obtain the slice contour of each layer.
2. According to claim 1, a surface layering and slicing method based on projection intersection detection is characterized in that: The specific steps of step 1 are: Step 1.1, traverse the triangular face on the 3D model, find the normal vector of the triangular face, and calculate the angle between the normal vector and the Z axis; Step 1.2, save the triangles that meet the conditions into a list.
3. According to claim 2, a surface layering and slicing method based on projection intersection detection is characterized in that: The three-dimensional model file is in stl format.
4. According to claim 3, a surface layering and slicing method based on projection intersection detection is characterized in that: The average normal direction is the average value of the sum of the normal vectors of the triangles that share this vertex.
5. According to claim 4, a surface layering and slicing method based on projection intersection detection is characterized in that: The specific steps of step 3 are: Step 3.1, project the offset surface onto the three planes XOY, XOZ, and YOZ respectively, traverse the triangular facets on the three-dimensional model, and project the triangular facets onto the three planes respectively, perform Boolean operations on the two projections on the three planes respectively, and obtain the intersection of the two; Step 3.2, first determine whether the intersection of the two projections on the three planes is empty, and then determine whether the intersection of the two projections is the same as the projection of the triangle.
6. The surface layering and slicing method based on projection intersection detection according to claim 5, characterized in that: The specific steps of step 4 are: Step 4.1, find the planes p1 and p2 where the two triangles s1 and s2 are located, and determine whether the three vertices of s1 are on the same side of p2 or whether the three vertices of s2 are on the same side of p1; Step 4.2, find the intersection line of the two planes p1 and p2, and assume that the parametric equation of the intersection line is p = p0 + t * v, where p0 is any point on the intersection line L, and v is the direction vector of the intersection line L; respectively find the coordinates of the intersection points of the intersection line and the two triangles s1 and s2, and then obtain the parameter value t according to the coordinates of the intersection points. First, determine whether the two triangles intersect according to the parameter value, and then sort all the parameter values to obtain the intersection line of the two triangles; Step 4.3, perform directed splicing on the intersection lines of each layer to generate the slice contour of each layer.
Citation Information
Cited By
Columnar part four-axis rough machining method based on discrete subdivision slicing
CN119937464A
A four-axis rough machining method for columnar parts based on discrete subdivision slices
CN119937464B
