A compression method for light-cured 3D printing slice data based on triangulation
By using the triangulation method to compress the slice data of photopolymer 3D printing into triangles, the problem of low compression ratio in photopolymer 3D printing is solved, achieving efficient and lossless compression and rapid decompression, thus improving the precision of parts.
Patent Information
- Application Number
- CN202310184661.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-01
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2043-03-01
AI Technical Summary
Existing methods for compressing bitmap data in photopolymer 3D printing have low compression ratios, which affects part accuracy and forming results.
A triangulation-based method is used to compress the slice data of photopolymer 3D printing. This includes decomposing polygons into monotonic polygons and dividing them into triangles, recording the coordinates of the triangle corners, and determining the pixel position through cross product during the decompression process.
It achieves lossless compression with a high compression ratio, improves the precision of parts, meets the rapid processing requirements of photopolymer 3D printing, and avoids the bottleneck of complex calculations.
Smart Images

Figure CN116277972B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of printing technology, in particular to a compression method of slice data of light-curing 3D printing based on triangulation. BACKGROUND
[0002] With the development of light-curing 3D printing technology, it is necessary to compress the layer bitmap data in the light-curing 3D printing system. In general, the bitmap data compression technology is to convert a large bitmap data file into a smaller bitmap data file with the same nature by using the inherent redundancy of the bitmap data. The size ratio of the two bitmap data files (i.e. compression ratio) determines the degree of compression. According to whether the compressed bitmap data can be accurately restored to the original bitmap data file, the compression encoding technology can be divided into lossless compression technology and lossy compression technology. The forming process of light-curing 3D printing is layer-by-layer accumulation, and finally a three-dimensional entity is formed. The bitmap data of each layer cannot be lost, otherwise it will affect the accuracy of the parts or even cannot be formed. Therefore, the bitmap data compression in light-curing 3D printing can only use lossless compression technology. Common lossless bitmap data compression methods are mainly proposed for ordinary grayscale and color bitmap image data, and the compression ratio is generally not high, which is not suitable for bitmap data compression in light-curing 3D printing.
[0003] Therefore, how to improve the compression ratio in light-curing 3D printing to improve the accuracy of the parts has become a problem to be solved. SUMMARY
[0004] The problem solved by the present application is how to improve the compression ratio in light-curing 3D printing to improve the accuracy of the parts.
[0005] To solve the above problems, the present application provides a compression method of slice data of light-curing 3D printing based on triangulation, which comprises: calculating the layer data of a preset model according to a set of predetermined parameters; dividing each independent polygon; decomposing each polygon into a plurality of monotonic polygons; triangulating the plurality of monotonic polygons into a plurality of triangles while recording the coordinates of the corner points of the triangles; and writing the coordinates of the corner points into a slice file.
[0006] Compared with the prior art, the effects that can be achieved by the present application are as follows: the method in the present embodiment fully utilizes the characteristics of the layer bitmap data in light-curing 3D printing, has a high compression ratio and a relatively ideal compression effect. In the process of compressing and decompressing the layer bitmap data in light-curing 3D printing, complex calculations are not required, the speed is fast, the time consumption is small, and it will not constitute a bottleneck for the processing of hundreds or thousands of layer bitmap data in light-curing 3D printing, which can better meet the requirements of light-curing 3D printing process.
[0007] In one embodiment of the present application, each independent polygon is divided by a flood fill algorithm according to layer data.
[0008] Compared with the prior art, the present application has the following effects: the flood fill algorithm can achieve accurate division of polygons.
[0009] In one embodiment of the present application, each polygon is decomposed into several monotone polygons, including: for each polygon, each polygon is decomposed into several monotone polygons by a scan line algorithm.
[0010] Compared with the prior art, the present application has the following effects: the scan line algorithm can accurately achieve decomposition of multiple polygons.
[0011] In one embodiment of the present application, the several monotone polygons are divided into several triangles, and the coordinates of the corner points of the triangles are recorded, including: for each monotone polygon, each monotone polygon is divided into several triangles by a monotone stack and a scan line algorithm, and the coordinates of the corner points of each triangle are recorded.
[0012] Compared with the prior art, the present application has the following effects: the method in the embodiment can achieve a faster and less time-consuming printing process.
[0013] In one embodiment of the present application, the layer data includes a binary graph of each layer slice.
[0014] Compared with the prior art, the present application has the following effects: by recording the binary graph of each layer slice, more accurate calculation results can be obtained.
[0015] In one embodiment of the present application, the predetermined parameters include a set layer height and resolution.
[0016] Compared with the prior art, the present application has the following effects: multiple parameters work together, and by setting the layer height and resolution, more accurate calculation results can be obtained.
[0017] In one embodiment of the present application, the decompression algorithm of the slice data includes: for each layer data in the slice file, including the coordinates of the corner points of several triangles, first, a blank binary graph of a corresponding size is created according to the resolution set by the slice; for each group of coordinates of the corner points of the triangles, a bounding box is established to determine the pixel region that needs to be sampled; the pixels in the bounding box are traversed, each pixel is judged to be inside or outside the triangle by calculating the cross product of the three edges of the triangle, and the pixel value of the inside point is modified.
[0018] Compared with the prior art, the scheme can achieve the following effects: the plane triangle is judged multiple times, preferably, the three sides of the plane triangle are judged three times, so that the position of the triangle is more accurately judged, whether the triangle is outside or inside. BRIEF DESCRIPTION OF DRAWINGS
[0019] Figure 1 A flowchart for compressing slice data of light-curing 3D printing is shown in the figure.
[0020] Figure 2 A schematic diagram for dividing a scan line into a monotone polygon is shown in the figure.
[0021] Figure 3 A schematic diagram for dividing a scan line into a triangle is shown in the figure.
[0022] Figure 4 A schematic diagram for judging whether a point is inside a triangle by using a cross product is shown in the figure.
[0023] Figure 5 A compression effect diagram is shown in the figure.
[0024] BRIEF DESCRIPTION OF DRAWINGS
[0025] 1, cylindrical nut structure; 2, disc-shaped square structure. DETAILED DESCRIPTION
[0026] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application are described in detail.
[0027] Embodiment one:
[0028] It should be noted that, in light-curing 3D, the layer data adopts a bitmap data format, and compared with vector data, the bitmap data needs more storage space. In order to facilitate solving the support bitmap, in light-curing 3D, the online real-time slicing and layer bitmap data generation mode is not suitable, and an offline data generation mode is adopted, that is, before printing, the bitmap data of each slice layer is generated and saved through a data processing software. Since the layer thickness of light-curing 3D is very thin, in order to improve the forming precision, the slice thickness in light-curing 3D is much smaller than that in other forms of 3D printing, which requires the CAD model to be cut into more layers. In light-curing 3D printing, the model is generally cut into hundreds or thousands of layers, so there are hundreds or thousands of bitmap data to be saved and transmitted, and the data volume is very large. The bitmap data in the standard BMP format sometimes reaches several hundred megabytes, therefore, the compression of the layer bitmap data in the light-curing 3D printing system is very necessary.
[0029] Therefore, in the embodiment, referring to Figures 1 to 5The embodiment provides a compression method of light-curing 3D printing slice data based on triangulation, and the compression method of slice data comprises the following steps: obtaining layer data of a preset model according to preset parameters; dividing each independent polygon; decomposing each polygon into a plurality of monotone polygons; triangulating the plurality of monotone polygons into a plurality of triangles, and recording the coordinates of the vertexes of the triangles; and writing the coordinates of the vertexes into a slice file.
[0030] The method in the embodiment fully utilizes the characteristics of the layer bitmap data in light-curing 3D printing slice, has high compression ratio, and has ideal compression effect. In the process of compressing and decompressing the layer bitmap data in light-curing 3D, complex calculation is not needed, so the speed is high, the time consumption is small, and the method does not constitute a bottleneck in the case of processing hundreds or thousands of layer bitmap data in light-curing 3D printing, and can preferably meet the requirements of the light-curing 3D printing process.
[0031] In the method, each independent polygon is divided by a flood fill algorithm according to the layer data.
[0032] For decomposing each polygon into a plurality of monotone polygons, the method comprises the following steps: for each polygon, the polygon is decomposed into a plurality of monotone polygons by a scan line algorithm.
[0033] The plurality of monotone polygons are triangulated into a plurality of triangles, and the coordinates of the vertexes of the triangles are recorded, which comprises the following steps: for each monotone polygon, the monotone polygon is triangulated into a plurality of triangles by a monotone stack and a scan line algorithm, and the coordinates of the vertexes of each triangle are recorded.
[0034] In the method, the layer data comprises a binary image of each slice, and the predetermined parameters comprise a preset layer height and a resolution.
[0035] Further, the decompression algorithm of slice data comprises the following steps: for each layer data in the slice file, the coordinates of the vertexes of a plurality of triangles are recorded, first, a blank binary image with a corresponding size is created according to the resolution set by the slice; for the coordinates of the vertexes of each group of triangles, a bounding box is established to determine a pixel region that needs to be sampled; the pixels in the bounding box are traversed, each pixel can be judged to be inside or outside the triangle by calculating the cross product of the three edges of the triangle, and the pixel value of the inside point is modified.
[0036] Further, refer to Figure 1, step S10 calculates the layer data of the CAD model according to the set layer height and resolution, wherein the preset model in the embodiment preferably refers to the CAD model, then enters step S20, each binary image is divided by the flood fill algorithm, then enters step S30, each polygon is decomposed into several monotone polygons by the scan line algorithm, then enters step S40, each monotone polygon is triangulated into several triangles by the scan line algorithm, then enters step S50, the slice setting information and the calculated triangle vertex coordinates are written into the slice file.
[0037] Further, specifically, the data compression algorithm in the embodiment is implemented as follows:
[0038] The layer data of the CAD model is calculated according to the set layer height and resolution, that is, the binary image of each slice;
[0039] For each binary image, each independent polygon is divided by the flood fill algorithm. Specifically, each pixel value is traversed, and for a pixel value non-empty pixel, the four points above, below, left and right are marked and recursively traversed until the pixel value is empty, and the marked pixel is directly skipped in the traversal process.
[0040] For each polygon, the scan line algorithm is used to decompose each polygon into several monotone polygons. The definition of monotone polygon is that the leftmost and rightmost points (the largest and smallest x-axis points) of the polygon are found, which divide the polygon into two chains. If each chain is traversed from left to right, the x-coordinate values are non-decreasing, then they are monotone. The scan line strategy is used to divide the monotone polygon, and the vertices are arranged in the event queue in ascending order of y coordinate. Each scan line is on the straight line parallel to the x-axis where the vertex is located. When a scan line cannot continuously pass through the polygon, some necessary cutting needs to be done, which is that the y coordinate of the point is greater than or less than the y coordinates of the two adjacent points. Figure 2 Any polygon is shown to be scanned and divided into several monotone polygons by the scan line.
[0041] For each monotone polygon, each monotone polygon is triangulated into several triangles by the monotone stack and scan line algorithm, and the vertex coordinates of each triangle are recorded. Specifically, similar to the previous scan line algorithm, a horizontal scan line is set from top to bottom, and the highest point is first added to the stack, and then scanning downward, when a point is scanned, three situations in Figure Three may occur:
[0042] Case 1: When the scanned point is opposite to the previous point, the point can be connected with the previous point in turn to triangulate until the opposite point is used up.
[0043] Case 2: When the scanned point is on the same side as the previous two points, and the inner angle formed is, the point can be connected with the previous two points to triangulate a triangle, and the triangulated point is invalid, and if the inner angle formed with the previous two points is, the triangulation is continued.
[0044] Case 3: When the scanned point is on the same side as the previous two points, and the inner angle formed is, a triangle cannot be triangulated.
[0045] Figure 5 The compression ratio of the cylindrical nut structure 1 and the disc-shaped square structure 2 is given.
[0046] The slice setting information and the calculated triangular corner point coordinates are written into a slice file.
[0047] Further, the decompression algorithm in the embodiment is implemented as follows:
[0048] For each layer data in the slice file, including the corner point coordinates of a plurality of triangles, a blank binary image of a corresponding size is created according to the resolution of the slice setting;
[0049] For the corner point coordinates of each group of triangles, a bounding box is established to determine the pixel region that needs to be sampled, specifically, the minimum and maximum values of the triangular corner points in the x-axis direction and the y-axis direction are obtained;
[0050] The pixels in the bounding box are traversed, and each pixel is judged to be inside or outside the triangle by calculating the cross product of the three edges of the triangle, and the pixel value of the inside point is modified; specifically, the three edges of the planar triangle are judged three times, and whether x1y2-x2y1 is the same is calculated, so that whether the point is inside the triangle can be obtained. For example, in FIG. Figure Four determine whether Q is inside the triangle:
[0051] Pointing out of the screen, calculating (x1-x0)(y-y0)-(x-x0)(y1-y0) is greater than 0, Q is on the left side;
[0052] Pointing out of the screen, calculating (x2-x1)(y-y1)-(x-x1(y2-y1) is greater than 0, Q is on the left side;
[0053] Pointing inside the screen, calculating (x0-x1)(y-y1)-(x-x1)(y0-y2) is less than 0, Q is on the right side;
[0054] So Q is outside the triangle.
[0055] Although the present application has been disclosed with reference to the above embodiments, the application is not limited to the above. Any person skilled in the art can make various modifications and changes without departing from the spirit and scope of the application. Therefore, the scope of the present application should be defined by the appended claims.
Claims
1. A method for compressing light-cured 3D printing slice data based on triangulation, characterized in that, The compression method of the slice data comprises: calculating the layer data of the preset model according to the set predetermined parameters; dividing each independent polygon by a flood fill algorithm according to the layer data; for each polygon, decomposing each polygon into several monotone polygons by a scan line algorithm; for each monotone polygon, dividing each monotone polygon into several triangles by a monotone stack and scan line algorithm, and recording the coordinates of the corner points of each triangle; writing the coordinates of the corner points into a slice file.
2. The compression method of the slice data of the light-cured 3D printing based on triangle division according to claim 1, wherein the layer data comprises: a binary image of each slice.
3. The compression method of the slice data of the light-cured 3D printing based on triangle division according to claim 1, wherein the predetermined parameters comprise: a set layer height and resolution.
4. The compression method of the slice data of the light-cured 3D printing based on triangle division according to any one of claims 1-3, wherein the decompression algorithm of the slice data comprises: for each layer data in the slice file, including the coordinates of the corner points of several triangles, first creating a blank binary image of a corresponding size according to the resolution set by the slice; for each group of coordinates of the corner points of the triangles, establishing a bounding box to determine the pixel region that needs to be sampled; traversing the pixels in the bounding box, and determining whether each pixel is inside or outside the triangle by calculating the cross product of the three edges of the triangle, and modifying the pixel value of the inside point.
Citation Information
Patent Citations
Slicing processing method aiming at non-closed STL model with boundaries
CN104331555A
Three-dimensional modeling and profile mapping method for complex rock-soil body
CN112434360A