A triangle mesh model reconstruction method and device based on slice layer data, electronic equipment and storage medium

CN123015822APending Publication Date: 2026-10-30SUZHOU FLASHFORGE 3D TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611107174.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

由于SLC格式的切片层数据只保存了设计模型各层的切片轮廓,无法渲染出表面连续的实体,也无法获得表面法向信息,但打印处理过程中的一些优化操作往往只能用于三角网格模型,不能用于SLC格式的切片层数据

Benefits of technology

[0009]上述发明内容仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其他目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123015822A_ABST
    Figure CN123015822A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on slice layer data's triangular mesh model reconstruction method, device, electronic equipment and storage medium, the method includes: obtaining the slice layer data corresponding to multiple layered slices respectively;Respectively to the original boundary profile in each layered slice is offset processing, determine the offset profile data corresponding to each layered slice;Based on offset profile data respectively determine the voxel distance value of multiple active voxels associated with each layered slice;Based on offset profile data from multiple layered slices determine the layered slice to be corrected, and the voxel distance value of active voxel to be corrected associated with layered slice to be corrected is corrected;Based on active voxel and active voxel to be corrected, to voxel model is flood filling, obtain voxel model;To voxel model is zero isal surface extraction, and triangular mesh model reconstruction is carried out.This scheme can be based on slice layer data extraction accurate zero isal surface, and then based on zero isal surface realizes the reconstruction of triangular mesh model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of 3D printing technology, and in particular to a method, apparatus, electronic device, and storage medium for reconstructing triangular mesh models based on slice layer data. Background Technology

[0002] Designers typically save their designs in SLC (slice layer data) format, which can then be loaded into printing software, processed, and sent for printing. However, SLC format slice layer data only preserves the slice outlines of each layer of the design model, making it impossible to render continuous solid surfaces or obtain surface normal information. Furthermore, many optimization operations during printing are often only applicable to triangular mesh models, not SLC format slice layer data. Therefore, when the original model is unavailable in the printing software, reconstructing a triangular mesh model based on SLC format slice layer data becomes crucial. Summary of the Invention

[0003] This invention provides a method, apparatus, electronic device, and storage medium for reconstructing a triangular mesh model based on slice layer data. It can extract accurate zero isosurfaces based on slice layer data, and then reconstruct the triangular mesh model based on the zero isosurfaces.

[0004] In a first aspect, the present invention provides a method for reconstructing a triangular mesh model based on slice layer data, comprising: Obtain slice layer data corresponding to multiple layered slices, each slice layer data including slice layer number, slice layer height and original boundary contour of the slice; The original boundary contours in each of the layered slices are offset to determine the offset contour data corresponding to each of the layered slices; wherein, the offset contour data includes an offset inner contour and an offset outer contour. Based on the offset contour data, the voxel distance values ​​of multiple active voxels associated with each of the layered slices are determined respectively; wherein, the voxel size of the active voxel is an integer multiple of the slice height of the layered slice; Based on the offset contour data, a layer slice to be corrected is determined from multiple layer slices, and the voxel distance value of the activation voxel associated with the layer slice to be corrected is adjusted to obtain the corrected voxel distance value of the activation voxel to be corrected; wherein, the layer slice to be corrected is the adjacent upper slice closest to the local peak point. Based on the activated voxels and the activated voxels to be corrected, the voxel model is flooded to fill the voxel model so that the voxel distance values ​​inside the voxel model are all negative and the voxel distance values ​​outside the voxel model are all positive, so as to obtain the voxel model. The zero isosurface is extracted from the voxel model to obtain the zero isosurface, and the triangular mesh model is reconstructed based on the zero isosurface.

[0005] Secondly, the present invention also provides a triangular mesh model reconstruction device based on slice layer data, comprising: The slice layer data acquisition module is used to acquire slice layer data corresponding to multiple layered slices. Each slice layer data includes a slice layer number, a slice layer height, and the original boundary contour of the slice. The offset processing module is used to perform offset processing on the original boundary contours in each of the layered slices to determine the offset contour data corresponding to each of the layered slices; wherein, the offset contour data includes an offset inner contour and an offset outer contour. The voxel distance value determination module is used to determine the voxel distance value of multiple active voxels associated with each of the layered slices based on the offset contour data; wherein the voxel size of the active voxel is an integer multiple of the slice height of the layered slice. The voxel distance correction module is used to determine the layer slice to be corrected from multiple layer slices based on the offset contour data, and to correct and adjust the voxel distance value of the active voxel to be corrected associated with the layer slice to be corrected, so as to obtain the corrected voxel distance value of the active voxel to be corrected; wherein, the layer slice to be corrected is the adjacent upper layer slice closest to the local peak point. The flooding filling module is used to flood the voxel model based on the activated voxels and the activated voxels to be corrected, so that the voxel distance values ​​inside the voxel model are all negative and the voxel distances outside are all positive, so as to obtain the voxel model. The triangular mesh model reconstruction module is used to extract the zero isosurface from the voxel model to obtain the zero isosurface, and to reconstruct the triangular mesh model based on the zero isosurface.

[0006] Thirdly, this invention also provides an electronic device, comprising: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the triangular mesh model reconstruction method based on slice layer data as provided in any embodiment of the present invention.

[0007] Fourthly, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the triangular mesh model reconstruction method based on slice layer data as provided in any embodiment of the present invention.

[0008] The technical solution of this invention involves acquiring slice layer data corresponding to multiple layered slices, each slice layer data including a slice layer number, slice layer height, and the original boundary contour of the slice; performing offset processing on the original boundary contours in each layered slice to determine the offset contour data corresponding to each layered slice; wherein, the offset contour data includes an offset inner contour and an offset outer contour; then, based on the offset contour data, determining the voxel distance values ​​of multiple active voxels associated with each layered slice; wherein, the voxel size of the active voxel is an integer multiple of the slice layer height of the layered slice, thereby determining the voxel distance values ​​in the inner and outer regions closely related to the model surface; subsequently, based on the offset contour data... The method involves identifying the layer slice to be corrected from multiple layer slices, and adjusting the voxel distance values ​​of the active voxels associated with this layer slice to obtain the corrected voxel distance values. The layer slice to be corrected is the adjacent upper-layer slice closest to the local spike, allowing for the correction of voxel distance values ​​at specific locations with local spikes. Next, based on the active voxels and the active voxels to be corrected, the voxel model is flooded to ensure that all voxel distance values ​​inside the model are negative and all voxel distance values ​​outside are positive, thus obtaining the voxel model. Finally, zero-isosurface extraction is performed on the voxel model to obtain zero-isosurfaces, and triangular mesh model reconstruction is performed based on these zero-isosurfaces. Using this method, signed voxel distances near the surface of a 3D solid design model can be selectively calculated based on slice layer data, and accurate zero-isosurfaces can be extracted from them. This allows for the accurate reconstruction of the original 3D solid design model based on the zero-isosurfaces, achieving the reconstruction of the triangular mesh model.

[0009] The above description of the invention is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0010] The above and other features, advantages, and aspects of the various embodiments of the present invention will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0011] Figure 1 This is a flowchart illustrating a method for reconstructing a triangular mesh model based on slice layer data, provided in an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the principle of determining the offset inner contour and offset outer contour of a target layer slice according to an embodiment of the present invention. Figure 3This is a schematic diagram illustrating the principle of local peak point smoothing provided in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the effect of flattening local peaks in a reconstructed model, as provided in an embodiment of the present invention. Figure 5 This is a flowchart illustrating another method for reconstructing a triangular mesh model based on slice layer data provided in an embodiment of the present invention. Figure 6 This is a schematic diagram of the processing logic for determining a target point provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the processing logic for iteratively segmenting a list of line segments to be segmented, provided by an embodiment of the present invention. Figure 8 This is a schematic diagram illustrating the effect before voxel distance value correction is performed on the activated voxel to be corrected, as provided in an embodiment of the present invention. Figure 9 This is a schematic diagram illustrating the effect of correcting the voxel distance value of the activated voxel to be corrected, as provided in an embodiment of the present invention. Figure 10 This is a schematic diagram illustrating the effect of a reconstructed triangular mesh model provided in an embodiment of the present invention. Figure 11 This is a schematic diagram of the structure of a triangular mesh model reconstruction device based on slice layer data provided in an embodiment of the present invention; Figure 12 This is a schematic diagram of an electronic device that implements a method for reconstructing a triangular mesh model based on slice layer data, as provided in an embodiment of the present invention. Detailed Implementation

[0012] Embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While some embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the invention. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the invention.

[0013] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0014] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0015] It should be noted that the concepts of "first" and "second" mentioned in this invention are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0016] It should be noted that the terms "a" and "a plurality of" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0017] The names of the messages or information exchanged between the multiple devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0018] Figure 1 This is a flowchart illustrating a method for reconstructing a triangular mesh model based on slice layer data, provided in an embodiment of the present invention. This embodiment is applicable to the reconstruction of triangular mesh models based on slice layer data in SLC format. The method can be executed by a triangular mesh model reconstruction device based on slice layer data. This device can be implemented in software and / or hardware and is generally integrated into any electronic device with network communication capabilities, such as a mobile terminal, PC, or server. Figure 1 As shown, the triangular mesh model reconstruction method based on slice layer data in this embodiment of the invention may include the following process: S101. Obtain the slice layer data corresponding to multiple layered slices. Each slice layer data includes the slice layer number, slice layer height, and the original boundary contour of the slice.

[0019] In this context, a layered slice refers to a slice obtained by sequentially dividing a 3D solid design model along the Z-axis with a certain thickness. Correspondingly, the slice layer data is a set of vector contour data associated with each layered slice; one layered slice corresponds to one slice layer data set. For example, the slice layer data can be in SLC format. In this embodiment, each slice layer data set includes the slice layer number, slice layer height, and the original boundary contour of the slice.

[0020] The slice layer number refers to the layer number of the slice within all slice layers. The slice layer height is the layer height of the slice layer in the Z-axis direction, and the slice layer heights of all slice layers are equal. The original boundary contour is the boundary contour / boundary shape retained in the slice layer after the 3D solid design model is segmented. This original boundary contour can also be understood as the cross-sectional contour obtained in the slice layer. In this embodiment, the boundary contour can define a closed region, that is, the corresponding polygonal region can be determined by the boundary contour. In addition, since the shape of the 3D solid design model may be diverse, for example, a 3D solid design model may be composed of multiple models placed on a panel, and these models may have gaps in the Z-axis direction. Therefore, when slicing the 3D solid design model, it may be possible that some models cannot be sliced ​​in certain layers, and the slice data of these layers can be empty.

[0021] Specifically, the slice layer data corresponding to multiple layered slices can be obtained. For example, by reading an SLC format file, all slice layer data (layers) obtained from the segmentation of the 3D solid model can be obtained. The total number of segments is n, and the slice layer numbers between each layered slice can be sequentially marked as 0, 1, ..., n-1. The height difference between two adjacent layers is equal, which is the slice layer height. For the i-th layered slice, its slice layer data (layers[i]) contains the slice layer height h of that layer and the original boundary contours (borders) of that layer. With the slice layer height h and the specific slice layer number of the i-th layered slice, the height of the i-th layered slice in the Z-axis direction can be determined. In this embodiment, moving forward along any original boundary contour, the internal region of the 3D solid model is always on the left-hand side.

[0022] S102. Perform offset processing on the original boundary contours in each layer slice to determine the offset contour data corresponding to each layer slice; wherein, the offset contour data includes the offset inner contour and the offset outer contour.

[0023] Offset processing can be understood as performing equidistant expansion and / or contraction on the polygonal region corresponding to the original boundary contour. For example, when offsetting outward (expanding), the offset distance is positive; when offsetting inward (contracting), the offset distance is negative. The result after processing is the offset contour data. It can be understood that performing overall offset processing on the polygonal region means that after the offset processing, corresponding offset inner contour and offset outer contour can be obtained. The offset inner contour and offset outer contour are relative; the offset inner contour refers to the contour obtained by offsetting the original boundary contour inward by a certain distance, while the offset outer contour refers to the contour obtained by offsetting the original boundary contour outward by a certain distance.

[0024] Specifically, the original boundary contours in each layer slice can be offset separately to determine the offset contour data corresponding to each layer slice. The offset contour data includes the offset inner contour and the offset outer contour.

[0025] As an optional but non-limiting implementation, the original boundary contours in each layered slice are offset to determine the offset contour data corresponding to each layered slice. This includes: determining the original boundary contours of each layered slice based on the slice layer data, and integerizing the coordinates of each point in the original boundary contours to obtain the boundary contours corresponding to each layered slice; offsetting the boundary contours based on a first preset offset distance to obtain the offset boundary contours corresponding to each layered slice; and for the target layered slice, determining the offset inner contour and offset outer contour of the target layered slice based on the boundary contours and offset boundary contours between the target layered slice and adjacent layered slices. Using this optional scheme, the coordinates of each point in the original boundary contours can be integerized first to improve data accuracy, and then offset processing can be performed to determine the offset contour data corresponding to each layered slice.

[0026] Here, the boundary contour refers to the boundary contour obtained after integerizing the coordinates of each point. This boundary contour has the exact same shape as the original boundary contour; the only difference is the precision of the coordinates used to represent the contour line. The coordinates in the original boundary contour are floating-point numbers, while the coordinates in the boundary contour are integers. It is understandable that the coordinates of each point in the original boundary contour (borders) of the slice layer data are usually represented by floating-point numbers. However, the precision of floating-point numbers may accumulate errors in subsequent calculations, leading to inaccurate results. Therefore, in this embodiment, the coordinates of each point in the original boundary contour are integerized, thereby improving the accuracy of subsequent calculations to some extent.

[0027] The first preset offset distance can be understood as the distance used for offset processing, and this first preset offset distance can be set differently based on actual needs. For example, the first preset offset distance can be set to the distance corresponding to twice the slice height after being integerized to the same degree.

[0028] The target layer slice can be any one of all layer slices. Correspondingly, adjacent layer slices refer to other layer slices that are immediately adjacent to the target layer slice. In this embodiment, adjacent layer slices include: adjacent upper layer slices and / or adjacent lower layer slices. It can be understood that for each layer slice from layer 0 to layer (n-1), layer 0 is the bottommost layer slice, so its adjacent layer slices are only adjacent upper layer slices; layer (n-1) is the topmost layer slice, so its adjacent layer slices are only adjacent lower layer slices; while layer slices located between layers 0 and (n-1) will have both adjacent upper layer slices and adjacent lower layer slices.

[0029] Specifically, based on the slice layer data, the original boundary contours (borders) of each slice layer can be determined, and the coordinates of each point in the original boundary contours (borders) can be integerized to obtain the boundary contours corresponding to each slice layer. Integerization refers to multiplying the coordinates by a preset integer multiple (e.g., 100,000) to make the coordinate values ​​integers. Conversely, floating-point conversion refers to dividing the coordinates by a preset equal integer multiple (e.g., 100,000) to make the coordinate values ​​floating-point numbers. In this embodiment, "integerization" and "floating-point conversion" are opposite operations, allowing the coordinate values ​​to be transformed between "floating-point numbers" and "integers." For example, during integerization, the coordinates of each point can be multiplied by 100,000 to expand by a factor of 100,000, resulting in the boundary contours (polys) corresponding to each slice layer. Then, based on a pre-set first offset distance, the boundary contours are offset to obtain the offset boundary contours corresponding to each layer slice. For example, for any layer slice, its integer-represented boundary contour polys can be offset inward and outward by twice the slice layer height to obtain the offset boundary contour offPolys. Next, for the target layer slice (which can be any layer slice), the offset inner contour and offset outer contour of the target layer slice can be determined based on the boundary contours and offset boundary contours between the target layer slice and its adjacent layer slices. For example, the offset inner contour innerPolys and offset outer contour outerPolys of the target layer slice can be determined by calculation and analysis based on the boundary contour polys and offset boundary contour offPolys of the target layer slice, as well as the boundary contour polys and offset boundary contour offPolys of its corresponding adjacent layer slices. The same principle can be used to determine the offset contour data corresponding to each other layer slice.

[0030] As an optional but non-limiting implementation, the offset inner contour and offset outer contour of the target layer slice are determined based on the boundary contour and offset boundary contour between the target layer slice and adjacent layer slices, including: If the target layer slice is the bottom layer slice, the boundary contour of the target layer slice is directly used as the offset inner contour. In addition, the difference between the union of the offset contours of adjacent layers and the boundary contour of the target layer slice is calculated, and the difference result is used as the offset outer contour. The union of the offset contours of adjacent layers is the union formed by the offset boundary contours between the target layer slice and the adjacent upper layer slice. If the target layer slice is the top layer slice, the boundary contour of the target layer slice is directly used as the offset inner contour. In addition, the difference between the union of the offset contours of adjacent layers and the boundary contour of the target layer slice is calculated, and the difference result is used as the offset outer contour. The union of the offset contours of adjacent layers is the union formed by the offset boundary contours between the target layer slice and the adjacent lower layer slice. If the target layer slice is an intermediate layer slice, the intersection boundary contour is determined based on the boundary contours between the target layer slice and its adjacent upper and lower layer slices. Based on a second preset offset distance, the intersection boundary contour is offset inwards to obtain an offset intersection boundary contour. The offset intersection boundary contour is subtracted from the boundary contour of the target layer slice, and the difference is taken as the offset inner contour. The union offset boundary contour is determined based on the offset boundary contours between the target layer slice, its adjacent upper and lower layer slices. The boundary contour of the target layer slice is subtracted from the union offset boundary contour, and the difference is taken as the offset outer contour. Using this optional scheme, the offset inner and outer contours can be determined specifically for different layer slices based on their layer numbers.

[0031] The bottom layer slice is the slice located at the very bottom of all layered slices (with the smallest height Z-value). The top layer slice is the slice located at the very top of all layered slices (with the largest height Z-value). Intermediate layer slices are other slices that are neither the bottom layer slice nor the top layer slice, that is, other slices located between the bottom layer slice and the top layer slice.

[0032] Specifically, if the target layer slice is the bottom layer slice, that is, when i=0, the boundary contour polys of layer 0 can be directly used as the inner offset contour innerPolys of layer 0. Furthermore, the union of the offset boundary contour offPolys of layer 0 and the offset boundary contour offPolys of layer 1 (layer 0 only has adjacent upper layer slices) is taken to obtain the union of the offset contours of adjacent layers. The difference between this union and the boundary contour polys of layer 0 is then calculated, and the difference result is used as the outer offset contour outerPolys of layer 0.

[0033] When the target layered slice is the topmost slice, that is, when i = n-1, the boundary contour polys of the (n-1)th layer can be directly used as the offset inner contour innerPolys of the (n-1)th layer. In addition, the union of the offset boundary contour offPolys of the (n-1)th layer and the offset boundary contour offPolys of the (n-2)th layer (the (n-1)th layer only has an adjacent lower slice) is taken to obtain the union of offset contours of adjacent layers, then the difference set calculation is performed between the union of offset contours of adjacent layers and the boundary contour polys of the (n-1)th layer, and the difference set result is taken as the offset outer contour outerPolys of the (n-1)th layer.

[0034] When the target layered slice is an intermediate layer slice, that is, when 0 < i < n-1, the intersection boundary contour of the three can be first determined based on the boundary contour polys of the (i-1)th layer, the boundary contour polys of the ith layer, and the boundary contour polys of the (i+1)th layer; then, the intersection boundary contour is offset inward by a second preset offset distance, for example, it can be offset inward to obtain the offset intersection boundary contour unionOffsetPolys; next, the boundary contour polys of the ith layer can be subtracted by the offset intersection boundary contour unionOffsetPolys, and the obtained difference result is taken as the offset inner contour innerPolys of the ith layer. On the other hand, the union of the offset boundary contour offPolys of the ith layer (that is, the target layered slice), the offset boundary contour offPolys of the (i-1)th layer (that is, the adjacent lower slice) and the offset boundary contour offPolys of the (i+1)th layer (that is, the adjacent upper slice) is taken to obtain the union offset boundary contour; further, the union offset boundary contour is subtracted by the boundary contour polys of the ith layer, and the obtained difference result is taken as the offset outer contour outerPolys of the ith layer. Wherein, voxelSizeInt refers to the voxel size after integerization processing, that is, the result obtained by performing integerization processing on the voxel size voxelSize. It is understandable that when the offset processing is performed above, the coordinate points are subjected to integerization processing, so in the process of determining the offset inner contour and the offset outer contour of the layered slice, the voxel size used also needs to be subjected to the same degree of integerization processing, so that the data precision is aligned and consistent. For example, voxelSizeInt may be the integerized voxel size obtained by multiplying the voxel size voxelSize by 100000 to expand it by 100,000 times.

[0035] Exemplarily, Figure 2 is a schematic principle diagram for determining the offset inner contour and the offset outer contour of a target layered slice provided by the embodiment of the present invention, as shown in Figure 2As shown, the three thick black lines represent the layered slices from a side view, from bottom to top: layer (i-1), layer 1, and layer (i+1). This can be combined with... Figure 2 To understand the principle of determining the bias inner contour and bias outer contour in this embodiment, we will not go into details here.

[0036] S103. Based on the offset contour data, determine the voxel distance values ​​of multiple active voxels associated with each layer slice; wherein, the voxel size of the active voxel is an integer multiple of the slice height of the layer slice.

[0037] It's important to clarify that, given the slice layer data of the 3D solid design model, the key to reconstructing the corresponding triangular mesh model is determining the zero isosurface of the 3D solid design model. This zero isosurface is essentially the volume surface of the 3D solid design model itself. Therefore, in this embodiment, to determine the zero isosurface used for subsequent triangular mesh model reconstruction based on the slice layer data, a voxel model is applied to the slice layer data to calculate the signed distance field near the model surface, thus facilitating the extraction of the zero isosurface in subsequent steps. Since the voxel model contains a vast number of voxels, this embodiment focuses on calculating the signed distance field near the model surface. For voxels far from the model surface, accurate distance field calculations are unnecessary; it's sufficient to ensure the distance field value is negative. This improves computational speed and reduces memory consumption.

[0038] In this context, an active voxel refers to a voxel located near the surface of the 3D solid design model. Such an active voxel can be located near the surface of the 3D solid design model, either outside or inside it. In short, these active voxels are essentially voxels at specific locations within the entire voxel model, and these active voxels at these specific locations are essentially the voxels closely related to the previously determined inner and outer offset contours. In this embodiment, the voxel distance value corresponding to each active voxel is calculated separately. The voxel distance value refers to the quantized distance from a voxel to the nearest object surface or boundary in 3D space. In this embodiment, the voxel distance value can be specifically characterized by the distance between the voxel's center point and the boundary contour of its layer.

[0039] It is understandable that if the center point of an active voxel is located outside the surface of the 3D solid design model, its corresponding voxel distance value is positive; if the center point of an active voxel is located inside the surface of the 3D solid design model, its corresponding voxel distance value is negative. This embodiment determines the voxel distance values ​​of these active voxels located near the model surface, and subsequently, based on these positive and negative voxel distance values, the zero isosurface of the 3D solid design model can be determined. On the zero isosurface, the voxel distance value is always 0.

[0040] Specifically, for each layer slice, a voxel model can be constructed for auxiliary use. The voxel size of each voxel in the constructed voxel model is an integer multiple of the slice height of the layer slice, thus allowing multiple voxels to be constructed based on each layer slice. For example, the voxel size can be 1 times, 2 times, etc., of the slice height. It can be understood that when the slice height is appropriate, a voxel size of 1 times the slice height can be used, meaning the voxel size equals the slice height of the layer slice; while when the slice height is too small, a voxel size of 2 times, 3 times, etc., can be used. For example, when the multiple is 2 times, in practice, a layer slice can be extracted every other layer, and the voxel size can be determined based on the finally extracted layer slices. Furthermore, based on the offset contour data, the voxel distance values ​​of multiple active voxels associated with each layer slice can be determined. These active voxels are essentially special voxels located near the surface of the model body, and the voxel size of each active voxel is also an integer multiple of the slice height of the layer slice. However, in actual processing, since the determination of the offset contour data involves integer processing, the voxel size (voxelSize) can also be integerized to the same degree to ensure that the data precision of both is at the same level. For example, the voxel size (voxelSize) can be multiplied by 100,000 to expand it by a factor of 100,000, resulting in the integerized voxel size (voxelSizeInt). The first and second preset offset distances described above also undergo the same principle of integerization to ensure that the data precision is aligned.

[0041] S104. Based on the offset contour data, determine the layer slice to be corrected from multiple layer slices, and adjust the voxel distance value of the activation voxel associated with the layer slice to be corrected to obtain the corrected voxel distance value of the activation voxel to be corrected; wherein, the layer slice to be corrected is the adjacent upper layer slice closest to the local peak point.

[0042] It is understandable that the surface of a 3D solid design model will contain some special local peaks. These local peaks may happen to be located within a certain layer of a slice during the slicing process. Therefore, the slice closest to the local peak and belonging to the layer above it will not show the presence of the local peak. For example, Figure 3 This is a schematic diagram illustrating the principle of local peak smoothing provided in an embodiment of the present invention, as shown below. Figure 3 As shown, assuming point 'a' in the figure is a local peak point actually existing on the surface of the 3D solid design model, after slicing the 3D solid design model into layers according to the layer height 'h', the j-th layer slice intersects with the 3D solid design model, while the (j+1)-th layer slice does not intersect with the 3D solid design model (this (j+1)-th layer slice is the nearest adjacent upper layer slice to the local peak point). In subsequent calculations, if the distance value of the local active voxels in the (j+1)-th layer (upper layer) is not corrected, then according to the method described above for calculating the offset outer contour corresponding to the j-th layer slice (i.e., obtaining the offset outer contour of this layer by subtracting the boundary contour of this layer from the union of the offset outer contours of the upper and lower layers), the offset outer contour corresponding to the adjacent upper layer slice is not empty. There will be corresponding active voxels in the polygonal region corresponding to the offset outer contour, which will cause the subsequently reconstructed triangular mesh model to have a flat top at the location of the j-th layer (lower layer), that is, it will appear flattened at the local peak point. For example, Figure 4 This is a schematic diagram illustrating the effect of flattening local peaks in a reconstructed model, as provided in an embodiment of the present invention. Figure 4 As shown, Figure 4 The red boxes highlight several instances where local sharp points in the 3D solid design model have been flattened. It can be seen that if the voxel distance values ​​related to these local sharp points are not corrected, these sharp points will be flattened in the later reconstructed model, resulting in inaccuracies in the local positions of the constructed model. Therefore, in this embodiment, [the following is omitted as the text is incomplete and requires further context]. Figure 3 The (j+1)th layer in the model is used as a slice to be corrected, so as to correct and adjust the voxel distance values ​​of voxels closely related to these local peaks, that is, to correct and adjust the voxel distance values ​​of the relevant activation voxels to be corrected, so as to improve the accuracy of the model construction.

[0043] Specifically, analysis can be performed based on offset contour data to determine the layer slice to be corrected from multiple layer slices. For example, the offset contour data corresponding to each layer slice can be analyzed separately to identify which layer slices are associated with local spurs, and the adjacent upper layer slice closest to the local spur is selected as the layer slice to be corrected. Then, the voxel distance values ​​of the activation voxels associated with the layer slice to be corrected can be adjusted to obtain the corrected voxel distance values. Here, the activation voxels to be corrected can be understood as activation voxels whose voxel distance values ​​need to be corrected. In this embodiment, there can be at least one layer slice to be corrected, and one layer slice to be corrected can be associated with multiple activation voxels to be corrected.

[0044] S105. Based on the activated voxels and the activated voxels to be corrected, flood the voxel model so that the voxel distance values ​​inside the voxel model are all negative and the voxel distance values ​​outside the voxel model are all positive, so as to obtain the voxel model.

[0045] Specifically, after determining the voxel distance values ​​of each active voxel and correcting the voxel distance values ​​of the active voxels to be corrected, these active voxels are equivalent to dividing the spatial region corresponding to the 3D solid design model into inner and outer parts. However, these inner and outer parts are only related to the surface of the model body. The inner and outer parts in the overall space are not completely separated. Therefore, based on the active voxels and the active voxels to be corrected, the auxiliary constructed voxel model can be flooded to make the voxel distance values ​​inside the voxel model negative and the voxel distance values ​​outside positive, so that the voxel model is obtained after the filling is completed.

[0046] Optionally, when flooding the voxel model based on active voxels and active voxels to be corrected, flooding can be performed along the Z-axis. When an active voxel is encountered, the current inside / outside state is recorded; when an inactive voxel is encountered (this inactive voxel refers to a voxel whose voxel distance value has not been determined in the previous scheme), if the current state is "inside", the voxel distance value of the inactive voxel can be set to... If the current state is "External", then the voxel distance value of the inactive voxel can be set to... This ensures that the voxel distance values ​​inside the voxel model are all negative and the voxel distance values ​​outside are all positive.

[0047] S106. Extract the zero isosurface from the voxel model to obtain the zero isosurface, and reconstruct the triangular mesh model based on the zero isosurface.

[0048] Specifically, after constructing the voxel model, since the voxel distance values ​​in the voxel model can be positive or negative, the voxel model can be extracted using zero isosurfaces to obtain zero isosurfaces (where the voxel distance value is 0), thereby accurately reconstructing the original 3D solid design model. For example, Marching Cubes or Dual Contouring methods can be used to obtain the reconstructed triangular mesh model, thereby realizing the reconstruction of the triangular mesh model based on slice layer data, so that relevant optimization algorithms can be applied in subsequent practical use to improve the printing quality of the model.

[0049] The technical solution of this invention involves acquiring slice layer data corresponding to multiple layered slices, each slice layer data including a slice layer number, slice layer height, and the original boundary contour of the slice; performing offset processing on the original boundary contours in each layered slice to determine the offset contour data corresponding to each layered slice; wherein, the offset contour data includes an offset inner contour and an offset outer contour; then, based on the offset contour data, determining the voxel distance values ​​of multiple active voxels associated with each layered slice; wherein, the voxel size of the active voxel is an integer multiple of the slice layer height of the layered slice, thereby determining the voxel distance values ​​in the inner and outer regions closely related to the model surface; subsequently, based on the offset contour data... The method involves identifying the layer slice to be corrected from multiple layer slices, and adjusting the voxel distance values ​​of the active voxels associated with this layer slice to obtain the corrected voxel distance values. The layer slice to be corrected is the adjacent upper-layer slice closest to the local spike, allowing for the correction of voxel distance values ​​at specific locations with local spikes. Next, based on the active voxels and the active voxels to be corrected, the voxel model is flooded to ensure that all voxel distance values ​​inside the model are negative and all voxel distance values ​​outside are positive, thus obtaining the voxel model. Finally, zero-isosurface extraction is performed on the voxel model to obtain zero-isosurfaces, and triangular mesh model reconstruction is performed based on these zero-isosurfaces. Using this method, signed voxel distances near the surface of a 3D solid design model can be selectively calculated based on slice layer data, and accurate zero-isosurfaces can be extracted from them. This allows for the accurate reconstruction of the original 3D solid design model based on the zero-isosurfaces, achieving the reconstruction of the triangular mesh model.

[0050] Figure 5 This is a flowchart illustrating another triangular mesh model reconstruction method based on slice layer data provided by an embodiment of the present invention. The technical solution of this embodiment further optimizes the process in the aforementioned embodiments of determining the voxel distance values ​​of multiple active voxels associated with each layer slice based on offset contour data. This embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 5As shown, the triangular mesh model reconstruction method based on slice layer data in this embodiment of the invention may include the following process: S501. Obtain the slice layer data corresponding to multiple layered slices. Each slice layer data includes the slice layer number, slice layer height, and the original boundary contour of the slice.

[0051] S502. Perform offset processing on the original boundary contours in each layer slice to determine the offset contour data corresponding to each layer slice; wherein, the offset contour data includes the offset inner contour and the offset outer contour.

[0052] S503. For a single layered slice, determine multiple target points based on the offset contour data of the layered slice, and construct a total list of line segments based on the original boundary contour of the layered slice; wherein, the target points are located within the polygonal region or on the boundary line of the polygonal region corresponding to the offset contour data; the total list of line segments is used to represent the original boundary contour through multiple line segments.

[0053] It is understandable that the offset contour data obtained after offset processing still essentially corresponds to a closed polygonal region. Therefore, multiple target points located within or on the boundary line of the polygonal region can be identified. These target points will be used as voxel center points in subsequent schemes to calibrate the relevant active voxels in three-dimensional space.

[0054] The overall line segment list contains multiple line segments, which are used to represent the original boundary contour. The line segments in the overall list can be connected end-to-end to represent the original boundary contour.

[0055] In this embodiment, the principle is explained using the example of determining the voxel distance values ​​of multiple associated active voxels for a single layer slice. The processing operation for the remaining layer slices follows the same principle and will not be described in detail. Specifically, for a single layer slice, multiple target points located within or on the boundary line of the polygonal region corresponding to the offset contour data of the layer slice can be determined. For example, since the offset contour data includes an inner offset contour and an outer offset contour, the corresponding target points can be determined based on the inner offset contour or the outer offset contour, and these two sets of target points are ultimately used as the target points corresponding to the single layer slice. At the same time, a total list of line segments can also be constructed based on the original boundary contour of the layer slice.

[0056] As an optional but non-limiting implementation, when the offset contour data is an offset inner contour, for a single layered slice, multiple target points are determined based on the offset contour data of the layered slice. This includes: determining the target polygonal region based on the offset inner contour, and determining the bounding box of the target polygonal region; determining the ordinate and abscissa boundaries of the bounding box; constructing multiple horizontal lines intersecting the target polygonal region based on the ordinate boundaries, and determining multiple horizontal line segments located within the target polygonal region; wherein the spacing between each horizontal line is the slice height of the layered slice; and constructing multiple vertical lines intersecting the target polygonal region based on the abscissa boundaries, and determining multiple target points formed by the intersections of the multiple vertical lines and the multiple horizontal line segments. Using this optional scheme, a series of horizontal and vertical lines can be constructed for the target polygonal region based on the offset contour data, and multiple target points can be determined based on the intersections of the multiple vertical lines and the multiple horizontal line segments.

[0057] In this context, the bounding box can be understood as the smallest bounding rectangle of a polygonal region. Correspondingly, the y-coordinate boundary of the bounding box refers to the boundary values ​​of its y-coordinates, including the minimum and maximum y-coordinate values ​​(i.e., minY and maxY). The x-coordinate boundary of the bounding box refers to the boundary values ​​of its x-coordinates, including the minimum and maximum x-coordinate values ​​(i.e., minX and maxX).

[0058] Specifically, when the offset contour data is an offset inner contour, the target polygonal region can be determined based on the offset inner contour. This target polygonal region is the polygonal region corresponding to the offset inner contour, and the bounding box of this target polygonal region can be determined. Then, the ordinate boundary and the abscissa boundary (minY, maxY, minX, maxX) of the bounding box can be determined. Next, based on the ordinate boundary, multiple horizontal lines intersecting the target polygonal region can be constructed, with the spacing between each horizontal line being the slice height corresponding to the layer slice, and multiple horizontal line segments located within the target polygonal region can be determined. Then, based on the abscissa boundary, multiple vertical lines intersecting the target polygonal region can be constructed, with the spacing between each vertical line also being the slice height corresponding to the layer slice. Further, multiple intersection points formed by the intersection of the multiple vertical lines and the multiple horizontal line segments can be determined, and these intersection points are all used as target points.

[0059] The following is an illustrative example of the process for determining the target point. Figure 6 This is a schematic diagram of the processing logic for determining a target point provided in an embodiment of the present invention. Figure 6 It contains 4 subgraphs, such as Figure 6As shown, the thick black solid line in subfigure (1) is the offset inner contour corresponding to the layer slice. These thick black solid lines can form a closed target polygon region. The red solid line in subfigure (1) is the bounding box (minimum bounding rectangle) corresponding to the target polygon region. In the specific process of determining the target point, for the i-th layer slice, the target polygon region can be determined based on the corresponding offset inner contour, and the bounding box of the target polygon region can be determined to obtain minX, minY, maxX, and maxY. Then, a series of horizontal lines intersecting the target polygon region can be determined based on minY and maxY (i.e., the vertical coordinate boundary). The spacing between each horizontal line is voxelSizeInt. The effect can be seen in the multiple horizontal lines numbered 5 to 20 in subfigure (1). In the process of constructing the horizontal lines, the horizontal coordinate boundaries minX and maxX can be appropriately expanded outward by a certain unit length at both ends, that is, the left boundary minX of the horizontal coordinate is appropriately reduced and the right boundary maxX of the horizontal coordinate is appropriately increased. For example, we can expand outward by 5 units so that the left endpoint of each constructed horizontal line corresponds to minX-5 and the right endpoint corresponds to maxX+5, thus enabling each constructed horizontal line to extend beyond the boundary of the target polygon region. Then, we can determine multiple horizontal intersection segments within the target polygon region. The effect can be seen in subfigure (2). Next, based on minX and maxX (i.e., the horizontal coordinate boundary), we can construct multiple vertical lines that intersect with the target polygon region. The spacing between each vertical line is also voxelSizeInt. The effect can be seen in subfigure (3). Further, we can find the intersection of these vertical lines with the horizontal intersection segments to obtain multiple intersection points. These intersection points are all taken as target points. The effect can be seen in subfigure (4). These target points are the internal points of the offset inner contour innerPolys, denoted as innerPts. Of course, in the actual calculation process, we can give priority to using the Boolean intersection operation between these horizontal lines and the polygon to determine the horizontal intersection segments to avoid dealing with complex situations.

[0060] It should be noted that in the actual process of determining the target points corresponding to the layered slices, since the offset contour data obtained above has been integerized, the target points innerPts can be converted to floating-point numbers to the same degree. For example, the coordinates of each point in the target points innerPts can be divided by 100,000 to reduce the size by a factor of 100,000 and return to the original floating-point precision, thereby obtaining the target points innerPtsF.

[0061] S504. For a single target point corresponding to a layered slice, in the current segmentation round, the list of line segments to be segmented is segmented along the target direction segmentation line to obtain a first line segment sublist and a second line segment sublist, and the first bounding box corresponding to the first line segment sublist and the second bounding box corresponding to the second line segment list are determined.

[0062] The list of line segments to be segmented refers to the list of line segments that need to be segmented in the current segmentation round. In the first segmentation round, the total list of line segments corresponding to the original boundary contours of the layered slices can be directly used as the list of line segments to be segmented.

[0063] The target direction dividing line can be determined based on the bounding box of the polygonal region corresponding to the list of line segments to be divided, so that the longer side of the bounding box can be divided in two. Accordingly, the first sub-list of line segments and the second sub-list of line segments are the results obtained after dividing the list of line segments to be divided. In this embodiment, both the list of line segments or the sub-list of line segments can have corresponding polygonal regions. Therefore, determining the bounding box corresponding to these list of line segments or the sub-list of line segments is essentially still determining the corresponding minimum bounding rectangle. The principle of determining the bounding box will not be elaborated further.

[0064] For a given slice, there can be multiple target points; see examples below. Figure 6 In the subgraph (4), this embodiment only takes one target point among multiple target points as an example to illustrate the principle. The calculation principle is the same for other target points. Specifically, for a single target point corresponding to a certain layer slice, in the current segmentation round, the list of line segments to be segmented can be divided along the target direction segmentation line to obtain the first line segment sublist and the second line segment sublist, and further determine the first bounding box corresponding to the first line segment sublist and the second bounding box corresponding to the second line segment sublist.

[0065] S505. Based on the distance between the target point and the first bounding box and the second bounding box, determine the target line segment list from the first line segment list and the second line segment list, and use the target line segment list as the line segment list to be segmented in the next segmentation round.

[0066] It should be noted that, in this embodiment, the distance between a "point" and the "bounding box" can be represented by the shortest distance between the "point" and the "nearest edge of the bounding box". In other words, this distance is essentially the shortest straight-line distance from the "point" to the "bounding box". Therefore, the distance from the target point to the first bounding box is the shortest straight-line distance between the target point and the nearest edge of the first bounding box, and the distance from the target point to the second bounding box is the shortest straight-line distance between the target point and the nearest edge of the second bounding box.

[0067] The target line segment sublist refers to the list of line segments that are filtered and retained. It can be the list of line segments that are smaller / shorter than the target point.

[0068] Specifically, the distance from the target point to the first bounding box and the distance from the target point to the second bounding box can be determined. Based on these two determined distances, a target line segment sublist is determined from the first and second line segment sublists. Specifically, the sublist of line segments with the smaller / shorter distance between the two can be used as the target line segment sublist. The determined target line segment sublist will become the list of line segments to be divided in the next segmentation round, and so on, continuously segmenting the list of line segments to be divided in each segmentation round.

[0069] S506. After multiple iterations of segmentation, at the end of the iteration, determine the shortest distance between the target point and the original boundary profile.

[0070] Specifically, by iterating through multiple rounds of segmentation based on the aforementioned segmentation principle, the shortest distance from the target point to the original boundary contour of the layered slice can be determined at the end of the iteration. The end of the iteration can be indicated by the fact that only one line segment remains in the list of line segments to be segmented in a certain segmentation round.

[0071] The following is an illustrative example of the process of iteratively dividing the list of line segments to be divided. Figure 7 This is a schematic diagram illustrating the processing logic for iteratively segmenting a list of line segments to be segmented, as provided in an embodiment of the present invention. Figure 7 As shown, Figure 7 It contains three subgraphs, which represent the first, second, and third partitioning rounds, respectively. Figure 7The diagram illustrates the processing of a layered slice with two annular regions. Point P is a target point within this layered slice. The specific process is as follows: For this layered slice, a total list of line segments can be constructed based on the original boundary contours of the layered slice. In the first segmentation round, the total list of line segments can be directly used as the list of line segments to be segmented, and the bounding box corresponding to the list of line segments to be segmented can be determined. Then, the target direction segmentation line can be determined based on the length of the adjacent two sides of the determined bounding box, so that after segmentation along the target direction segmentation line, the longer side of the bounding box can be segmented, dividing it into two. The segmentation effect can be seen in sub-figure (1). In this segmentation round, the target direction segmentation line is parallel to the shorter side of the bounding box, thereby segmenting the longer side of the bounding box. After segmentation, a first sub-list of line segments and a second sub-list of line segments are obtained, and the first bounding box corresponding to the first sub-list of line segments and the second bounding box corresponding to the second sub-list of line segments can be determined. Next, we can calculate the distance from point P to the first bounding box and the distance from point P to the second bounding box, and determine the target line segment sublist based on the distance between them, as shown in sub-figure (1). The distance from point P to the left bounding box is less than the distance from point P to the right bounding box. Therefore, the nearest line segment must not be in the right bounding box, but in the left bounding box. So we can exclude the line segments in the right bounding box and reduce the amount of calculation. The identified target line segment sublist will be used as the line segment list to be divided in the second division round. Similarly, in the second division round, new target direction dividing lines can be determined and new bounding boxes can be divided. In subgraph (2), the distance from point P to the upper bounding box is less than the distance from point P to the lower bounding box. Therefore, the line segment closest to point P is definitely not in the lower bounding box. So the line segment in the lower bounding box can be directly excluded. In this way, iterative division is continuously performed until only one line segment remains in the line segment list to be divided in a certain division round. Then the distance between point P and the only remaining line segment can be determined. The calculated distance is the shortest distance from point P to the two rings, which is to say, the shortest distance from the target point P to the original boundary contour of the layered slice is determined. Optionally, in the actual implementation, this segmentation process can be performed only once on the same layer. The resulting hierarchical bounding box can correspond to a binary tree. When calculating the distance between each target point, it is only necessary to traverse this binary tree and switch to a certain subtree according to the judgment condition, and recursively execute until a certain leaf node is reached, thereby obtaining the shortest distance corresponding to the target point.

[0072] S507. Determine the multiple active voxels associated with the target point, and determine the voxel distance value corresponding to each active voxel based on the shortest distance and the slice layer number of the slice to which the target point belongs.

[0073] Specifically, after determining the shortest distance between the target point and the original boundary contour of the layer slice, multiple active voxels associated with the target point can be identified. Based on the determined shortest distance and the slice layer number of the layer slice to which the target point belongs, the voxel distance value corresponding to each active voxel can be determined.

[0074] For example, continuing from above Figure 7 Taking the determination of target point P as an example, assuming the shortest distance d1 from the determined point P to the borders of the original boundary contour, then we can... The voxel distance value of the active voxel at the location is set to -d1, where, This represents the x-coordinate of point P in three-dimensional space; This represents the ordinate of point P in three-dimensional space; This represents the vertical coordinate of point P in three-dimensional space. If the slice to which point P belongs is layer 0, then the next layer... The voxel distance value of the active voxel at the location is set to d1. If the slice to which point P belongs is the (n-1)th slice, then the previous slice (i.e., the slice above the current slice) is... The voxel distance value of the active voxel at the location is set to d1.

[0075] It should be noted that in this embodiment, only the principle of how to determine the target point, how to iteratively segment the list of line segments to be segmented, and how to determine the voxel distance value of the associated active voxels are explained when the offset contour data is an offset inner contour. When the offset contour data is an offset outer contour, the calculation principle is the same, and it will not be described in detail here. For example, similarly, multiple outer points outerPts with a voxelSizeInt spacing can be determined based on the offset outer contour outerPolys of a certain layer slice. The outer points outerPts are then processed by floating-point conversion, such as dividing the coordinates of each outer point by the same large number s to obtain the outer point outerPtsF. For any outer point P2 among the multiple outer points outerPtsF, the iterative segmentation principle of the aforementioned scheme can still be used to process it to determine the shortest distance d2 from the outer point P2 to the original boundary contour borders, thereby... The voxel distance value of the active voxel at the location is set to d2, etc., and will not be listed in detail here.

[0076] S508. Based on the offset contour data, determine the layer slice to be corrected from multiple layer slices, and correct and adjust the voxel distance value of the activation voxel associated with the layer slice to be corrected to obtain the corrected voxel distance value of the activation voxel to be corrected; wherein, the layer slice to be corrected is the adjacent upper layer slice closest to the local peak point.

[0077] As an optional but non-limiting implementation, based on offset contour data, the layer slice to be corrected is determined from multiple layer slices. This includes: for a single layer slice, dividing the offset outer contour of the layer slice into multiple sub-regions, and determining whether each sub-region is adjacent to the offset inner contour of the layer slice; if there is a sub-region that is not adjacent to the offset inner contour, then the layer slice is taken as the layer slice to be corrected. Using this optional scheme, the offset outer contour of a single layer slice can be divided, and the layer slice to be corrected can be determined based on the sub-regions obtained from the division.

[0078] Specifically, for a single layer slice (which can be any layer), the offset outer contour (outerPolys) of the layer slice can be divided into multiple sub-regions. Each sub-region contains a counterclockwise outer ring and several clockwise inner rings. It is then determined whether each sub-region is adjacent to the offset inner contour (innerPolys) of the layer slice. If it is determined that there is a sub-region that is not adjacent to the offset inner contour (innerPolys) of the layer, it means that the sub-region is the layer above a certain local highest contour, that is, there is a local peak point below the layer slice. In this case, the layer slice can be used as the layer slice to be corrected.

[0079] As an optional but non-limiting implementation, the voxel distance values ​​of the active voxels associated with the layered slice to be corrected are adjusted to obtain the corrected voxel distance values. This includes: determining multiple points to be corrected within the sub-region to be corrected in the layered slice; determining the distance values ​​from each point to the boundary of the sub-region to be corrected, and determining the maximum distance value from the multiple distance values; determining the active voxels associated with each point to be corrected; and for a single active voxel to be corrected, determining the corrected voxel distance value based on the distance value of the point to be corrected and the maximum distance value, and then adjusting the voxel distance values ​​of the active voxels to be corrected based on the corrected voxel distance values. Using this optional approach, the voxel distance values ​​of the active voxels associated with the layered slice to be corrected can be adjusted, enabling the subsequent determination of accurate zero isosurfaces at local peaks in the actual 3D solid model.

[0080] The sub-region to be corrected is the sub-region with local spikes below. This sub-region to be corrected is the sub-region that is not adjacent to the offset inner contour of the slice in this layer.

[0081] Specifically, multiple points to be corrected within the sub-region to be corrected in the layered slice to be corrected can be identified. Then, the distance value from each point to be corrected to the boundary of the sub-region to be corrected is determined. This distance value can be characterized by the shortest distance from the "point to be corrected" to the "boundary of the sub-region to be corrected," and the detailed calculation principle is described above. Furthermore, the maximum distance value is determined from the multiple determined distance values. Next, the corresponding activation voxels to be corrected for each point to be corrected can be determined. For example, these activation voxels can be the activation voxels of the adjacent upper slice of the layered slice to be corrected. Then, for a single activation voxel to be corrected, the correction voxel distance value can be determined based on the distance value of the point to be corrected and the maximum distance value, and the voxel distance value of the activation voxel to be corrected is adjusted based on the correction voxel distance value. In this embodiment, the correction voxel distance value of the activation voxel to be corrected can be determined according to the following formula: ; in, d represents the correction voxel distance value of a single active voxel to be corrected; d represents the distance value from a single point to be corrected to the boundary of the sub-region to be corrected. This represents the maximum distance value (i.e., the maximum value among the distances from all points to be corrected to the boundary of the sub-region to be corrected). Indicates taking the absolute value; This indicates finding the square root. Indicates the adjustment factor. It is a number greater than 0.25 (so that...) ), The larger the value, the smaller the local peak will be after adjustment.

[0082] For example, Figure 8 This is a schematic diagram illustrating the effect before voxel distance value correction is performed on the activated voxel to be corrected, according to an embodiment of the present invention. Figure 9 This is a schematic diagram illustrating the effect of correcting the voxel distance value of the activated voxel to be corrected, according to an embodiment of the present invention. Figure 8 , Figure 9 The numbers indicate the voxel distance values ​​between the upper and lower active voxels, such as... Figure 8 , Figure 9As shown, the specific correction process can be as follows: First, determine multiple points pts to be corrected within the sub-region to be corrected, with each point pts having an interval of voxelSizeInt. Then, convert the coordinates of each point to floating-point (for example, divide the coordinate values ​​of each point by 100000) to obtain multiple points ptsF to be corrected. Simultaneously, convert the coordinates of each point in the sub-region to be corrected to floating-point to the same degree to obtain the sub-region regionF to be corrected. Next, for a single point p3 among the multiple points ptsF to be corrected, calculate the shortest distance d3 from p3 to the boundary of the sub-region regionF to be corrected (this can also be determined using the principle described above). By analogy, the distance values ​​from each point to be corrected to the boundary of the sub-region to be corrected can be determined, and the maximum distance among them can be determined as maxDist. Then, for the activation voxel to be corrected corresponding to the single point p3, let absDist = abs(maxDist - d3), and associate the... The corrected voxel distance value for the active voxel at the location to be corrected is set to: absDist - sqrt(absDist) + α, to produce a gentle bulge. For example... Figure 8 , Figure 9 As shown, from Figure 8 Data from the top Figure 9 The data above uses: ,correspond If the actual floor height is 0.03, then we can take... Finally, the voxel distance values ​​of the activated voxels to be corrected can be adjusted based on this corrected voxel distance value. For example... Figure 9 As shown, after correction, the zero contour lines between the upper and lower layers have become relatively gentle, which makes the local highest contours in the 3D solid model more accurate and avoids the phenomenon of being flattened.

[0083] It should be noted that this embodiment describes the processing logic for local peaks / local highest contours in a 3D solid model. The processing logic for local depressions / local lowest contours in a 3D solid model is similar in principle and will not be described in detail here.

[0084] S509. Based on the activated voxels and the activated voxels to be corrected, flood the voxel model so that the voxel distance values ​​inside the voxel model are all negative and the voxel distance values ​​outside the voxel model are all positive, so as to obtain the voxel model.

[0085] S510. Extract the zero isosurface from the voxel model to obtain the zero isosurface, and reconstruct the triangular mesh model based on the zero isosurface.

[0086] For example, Figure 10 This is a schematic diagram illustrating the effect of a reconstructed triangular mesh model provided in an embodiment of the present invention, as shown below. Figure 10 As shown, the solution based on this embodiment can realize the reconstruction of a triangular mesh model based on slice layer data.

[0087] Optionally, this scheme can also use voxels larger than the slice layer height, find the adjacent upper and lower layers based on the voxel height, and obtain the voxel distance value through interpolation of the upper and lower layer distances. Additionally, when the slice layer height is very small (e.g., 0.001 mm), voxel sizes that are integer multiples of the slice layer height can be used to reduce computational load. For example, one layer can be taken every 10 layers, changing the layer height from 0.001 mm to 0.01 mm, and the voxel size also changing from 0.001 mm to 0.01 mm to reduce computational load. Although this conversion accuracy will decrease and some detailed features may be lost, the degree of accuracy loss is still acceptable.

[0088] The technical solution of this invention involves acquiring slice layer data corresponding to multiple layered slices, each slice layer data including a slice layer number, slice layer height, and the original boundary contour of the slice; performing offset processing on the original boundary contour of each layered slice to determine the offset contour data corresponding to each layered slice; wherein, the offset contour data includes an offset inner contour and an offset outer contour; then, for a single layered slice, determining multiple target points based on the offset contour data of the layered slice, and constructing a total list of line segments based on the original boundary contour of the layered slice; wherein, the target point is located within a polygonal region or on the boundary line of the polygonal region corresponding to the offset contour data, and the total list of line segments is used to represent the original boundary contour through multiple line segments; for a single target point corresponding to a layered slice, in the current segmentation round, the list of line segments to be segmented is segmented along the target direction segmentation line to obtain a first sub-list of line segments and a second sub-list of line segments, and determining the first bounding box corresponding to the first sub-list of line segments and the second bounding box corresponding to the second sub-list of line segments; based on the distance between the target point and the first and second bounding boxes, the target line segment is determined from the first sub-list of line segments and the second sub-list of line segments. The target line segment sublist is used as the line segment list to be segmented in the next segmentation round. After multiple segmentation rounds of iteration, the shortest distance from the target point to the original boundary contour is determined at the end of the iteration. Multiple activation voxels associated with the target point are determined, and based on the shortest distance and the slice layer number of the slice to which the target point belongs, the voxel distance value corresponding to each activation voxel is determined, thereby determining the voxel distance values ​​in the inner and outer regions closely related to the model surface. Then, based on the offset contour data, the slice to be corrected is determined from multiple slices, and the activation voxels associated with the slice to be corrected are determined. The voxel distance values ​​of the voxels are corrected and adjusted to obtain the corrected voxel distance values ​​of the active voxels to be corrected. The slice to be corrected is the adjacent upper slice closest to the local spiking point, thus allowing for the correction of voxel distance values ​​at specific locations with local spiking points. Next, based on the active voxels and the active voxels to be corrected, the voxel model is flooded to ensure that the voxel distance values ​​inside the voxel model are all negative and the voxel distance values ​​outside are all positive, thus obtaining the voxel model. Finally, zero-isosurface extraction is performed on the voxel model to obtain zero-isosurfaces, and the triangular mesh model is reconstructed based on the zero-isosurfaces. Using this scheme, signed voxel distances near the surface of a 3D solid design model can be selectively calculated based on slice layer data, and accurate zero-isosurfaces can be extracted from them. This allows for the accurate reconstruction of the original 3D solid design model based on the zero-isosurfaces, achieving the reconstruction of the triangular mesh model.

[0089] Figure 11This is a schematic diagram of a triangular mesh model reconstruction device based on slice layer data provided in an embodiment of the present invention. This embodiment is applicable to the reconstruction of triangular mesh models based on slice layer data in SLC format. This triangular mesh model reconstruction device based on slice layer data can be implemented in software and / or hardware, and is generally integrated into any electronic device with network communication capabilities, such as a mobile terminal, PC, or server. Figure 11 As shown, the triangular mesh model reconstruction device based on slice layer data in this embodiment of the invention may include: a slice layer data acquisition module 1101, an offset processing module 1102, a voxel distance value determination module 1103, a voxel distance value correction module 1104, a flooding filling module 1105, and a triangular mesh model reconstruction module 1106. Wherein: The slice layer data acquisition module 1101 is used to acquire slice layer data corresponding to multiple layered slices, and each slice layer data includes a slice layer number, a slice layer height, and the original boundary contour of the slice. The offset processing module 1102 is used to perform offset processing on the original boundary contours in each of the layered slices respectively, and determine the offset contour data corresponding to each of the layered slices; wherein, the offset contour data includes an offset inner contour and an offset outer contour. The voxel distance value determination module 1103 is used to determine the voxel distance value of multiple active voxels associated with each of the layered slices based on the offset contour data; wherein the voxel size of the active voxel is an integer multiple of the slice height of the layered slice. The voxel distance correction module 1104 is used to determine the layer slice to be corrected from multiple layer slices based on the offset contour data, and to correct and adjust the voxel distance value of the active voxel to be corrected associated with the layer slice to be corrected, so as to obtain the corrected voxel distance value of the active voxel to be corrected; wherein, the layer slice to be corrected is the adjacent upper layer slice closest to the local peak point. The flooding filling module 1105 is used to flood fill the voxel model based on the activated voxel and the activated voxel to be corrected, so that the voxel distance values ​​inside the voxel model are all negative and the voxel distances outside are all positive, so as to obtain the voxel model. The triangular mesh model reconstruction module 1106 is used to extract the zero isosurface from the voxel model to obtain the zero isosurface, and to reconstruct the triangular mesh model based on the zero isosurface.

[0090] The technical solution of this invention involves acquiring slice layer data corresponding to multiple layered slices through a slice layer data acquisition module. Each slice layer data includes a slice layer number, slice layer height, and the original boundary contour of the slice. An offset processing module performs offset processing on the original boundary contours of each layered slice to determine the offset contour data corresponding to each layered slice. This offset contour data includes an offset inner contour and an offset outer contour. Then, a voxel distance value determination module determines the voxel distance values ​​of multiple active voxels associated with each layered slice based on the offset contour data. The voxel size of the active voxel is an integer multiple of the slice layer height of the layered slice, thereby determining the voxel distance values ​​in the inner and outer regions closely related to the model surface. Finally, the voxel distance values ​​are corrected... The positive module, based on offset contour data, determines the layer slice to be corrected from multiple layer slices and adjusts the voxel distance values ​​of the active voxels associated with the layer slice to be corrected, obtaining the corrected voxel distance values ​​of the active voxels. The layer slice to be corrected is the adjacent upper-layer slice closest to the local peak, thus allowing for the correction of voxel distance values ​​at specific locations with local peaks. Next, the flooding module floods the voxel model based on the active voxels and the active voxels to be corrected, ensuring that the voxel distance values ​​inside the voxel model are all negative and the voxel distances outside are all positive, thus obtaining the voxel model. Finally, the triangular mesh model reconstruction module extracts zero-isosurfaces from the voxel model, obtaining zero-isosurfaces, and reconstructs the triangular mesh model based on the zero-isosurfaces. Using this scheme, signed voxel distances near the surface of a 3D solid design model can be selectively calculated based on slice layer data, and accurate zero-isosurfaces can be extracted from them, thereby accurately reconstructing the original 3D solid design model based on the zero-isosurfaces, achieving the reconstruction of the triangular mesh model.

[0091] As an optional but non-limiting implementation, the offset processing module 1102 includes: a boundary contour determination unit, an offset processing unit, and an offset contour data determination unit. Wherein: The boundary contour determination unit is used to determine the original boundary contour of each layer slice based on the slice layer data, and to perform integer processing on the coordinates of each point in the original boundary contour to obtain the boundary contour corresponding to each layer slice. The offset processing unit is used to perform offset processing on the boundary contours based on a first preset offset distance to obtain the offset boundary contours corresponding to each layer slice. The offset contour data determination unit is used to determine the offset inner contour and the offset outer contour of the target layer slice based on the boundary contour between the target layer slice and the adjacent layer slice and the offset boundary contour.

[0092] As an optional but non-limiting implementation, the offset contour data determination unit is specifically used for: If the target layer slice is the bottom layer slice, the boundary contour of the target layer slice is directly used as the offset inner contour, and the difference between the union of the offset contours of adjacent layers and the boundary contour of the target layer slice is calculated, and the difference result is used as the offset outer contour; wherein, the union of the offset contours of adjacent layers is the union formed by the offset boundary contours between the target layer slice and the adjacent upper layer slice; If the target layer slice is the topmost slice, the boundary contour of the target layer slice is directly used as the offset inner contour. Furthermore, the difference between the union of the offset contours of adjacent layers and the boundary contour of the target layer slice is calculated, and the difference result is used as the offset outer contour. The union of the offset contours of adjacent layers is the union formed by the offset boundary contours between the target layer slice and the adjacent lower layer slice. If the target layer slice is an intermediate layer slice, an intersection boundary contour is determined based on the boundary contours between the target layer slice and its adjacent upper and lower layer slices; based on a second preset offset distance, the intersection boundary contour is offset inward to obtain an offset intersection boundary contour; the offset intersection boundary contour is subtracted from the boundary contour of the target layer slice, and the difference is taken as the offset inner contour; based on the offset boundary contours between the target layer slice, its adjacent upper and lower layer slices, a union offset boundary contour is determined; the boundary contour of the target layer slice is subtracted from the union offset boundary contour, and the difference is taken as the offset outer contour.

[0093] As an optional but non-limiting implementation, the voxel distance value determination module 1103 includes: a target point determination unit, a segmentation unit, a target line segment sub-list determination unit, a shortest distance determination unit, and a voxel distance value determination unit. Wherein: The target point determination unit is used to determine multiple target points for a single layered slice based on the offset contour data of the layered slice, and to construct a total list of line segments based on the original boundary contour of the layered slice; wherein the target points are located within a polygonal region or on the boundary line of the polygonal region corresponding to the offset contour data; the total list of line segments is used to characterize the original boundary contour using multiple line segments. The segmentation unit is used to segment the list of line segments to be segmented along the target direction segmentation line in the current segmentation round for a single target point corresponding to the layered slice, to obtain a first line segment sublist and a second line segment sublist, and to determine the first bounding box corresponding to the first line segment sublist and the second bounding box corresponding to the second line segment list. The target line segment sub-list determination unit is used to determine the target line segment list from the first line segment sub-list and the second line segment list based on the distance between the target point and the first bounding box and the second bounding box respectively, and use the target line segment list as the line segment list to be segmented in the next segmentation round; The shortest distance determination unit is used to determine the shortest distance between the target point and the original boundary contour at the end of the iteration after multiple segmentation rounds. A voxel distance value determination unit is used to determine multiple active voxels associated with the target point, and to determine the voxel distance value corresponding to each active voxel based on the shortest distance and the slice layer number of the slice to which the target point belongs.

[0094] As an optional but non-limiting implementation, when the offset contour data is an offset inner contour, the target point determination unit accordingly includes: a bounding box determination subunit, a coordinate boundary determination subunit, a horizontal intersection segment determination subunit, and a target point determination subunit. Wherein: A bounding box determination subunit is used to determine a target polygonal region based on the offset inner contour, and to determine the bounding box of the target polygonal region; The coordinate boundary determination subunit is used to determine the vertical coordinate boundary and the horizontal coordinate boundary of the bounding box; A horizontal line segment determination subunit is used to construct multiple horizontal lines intersecting the target polygon region based on the vertical coordinate boundary, and to determine multiple horizontal line segments located within the target polygon region; wherein the spacing between each horizontal line is the slice layer height of the layered slice; The target point determination subunit is used to construct multiple vertical lines that intersect with the target polygon region based on the horizontal coordinate boundary, and to determine multiple target points formed by the intersection of the multiple vertical lines and the multiple horizontal line segments.

[0095] As an optional but non-limiting implementation, the voxel distance value correction module 1104 includes a sub-region splitting unit and a layer slice determination unit to be corrected. Wherein: The sub-region splitting unit is used to split the offset outer contour of a single layered slice into multiple sub-regions, and determine whether each sub-region is adjacent to the offset inner contour of the layered slice. The layer slice determination unit is used to determine the layer slice to be corrected if there is a sub-region that is not adjacent to the offset inner contour.

[0096] As an optional but non-limiting implementation, the voxel distance value correction module 1104 further includes: a point-to-be-corrected unit, a distance value determination unit, an active voxel-to-be-corrected unit, and a voxel distance value correction unit. Wherein: The unit for determining points to be corrected is used to determine multiple points to be corrected within the sub-region to be corrected in the layered slice to be corrected. The distance value determination unit is used to determine the distance value from each point to be corrected to the boundary of the sub-region to be corrected, and to determine the maximum distance value from the multiple distance values; The activation voxel determination unit is used to determine the activation voxel to be corrected associated with each of the points to be corrected. A voxel distance correction unit is used to determine a correction voxel distance value for a single active voxel to be corrected based on the distance value of the point to be corrected and the maximum distance value, and to correct and adjust the voxel distance value of the active voxel to be corrected based on the correction voxel distance value.

[0097] The triangular mesh model reconstruction device based on slice layer data provided in this embodiment of the invention can be used to execute the triangular mesh model reconstruction method based on slice layer data, and has the corresponding functional modules and beneficial effects for executing the triangular mesh model reconstruction method based on slice layer data.

[0098] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of the present invention.

[0099] Figure 12 This is a schematic diagram of an electronic device that implements a method for reconstructing a triangular mesh model based on slice layer data, as provided in an embodiment of the present invention. The following refers to... Figure 12 The diagram illustrates a structural schematic of an electronic device 1210 suitable for implementing embodiments of the present invention. The terminal devices in these embodiments may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 12 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of the present invention.

[0100] like Figure 12 As shown, the electronic device 1210 includes at least one processor 1211 and a memory, such as a read-only memory (ROM) 1212 and a random access memory (RAM) 1213, communicatively connected to the at least one processor 1211. The memory stores computer programs executable by the at least one processor. The processor 1211 can perform various appropriate actions and processes based on the computer program stored in the ROM 1212 or loaded from storage unit 1218 into the RAM 1213. The RAM 1213 may also store various programs and data required for the operation of the electronic device 1210. The processor 1211, ROM 1212, and RAM 1213 are interconnected via a bus 1214. An input / output (I / O) interface 1215 is also connected to the bus 1214.

[0101] Multiple components in electronic device 1210 are connected to input / output (I / O) interface 1215, including: input unit 1216, such as keyboard, mouse, etc.; output unit 1217, such as various types of monitors, speakers, etc.; storage unit 1218, such as disk, optical disk, etc.; and communication unit 1219, such as network card, modem, wireless transceiver, etc. Communication unit 1219 allows electronic device 1210 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0102] Processor 1211 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 1211 include, but are not limited to, central processing unit (CPU), graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 1211 executes the triangular mesh model reconstruction method based on slice layer data provided in any embodiment of the present invention.

[0103] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the triangular mesh model reconstruction method based on slice layer data shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication unit 1219, or installed from storage unit 1218, or installed from read-only memory (ROM) 1212. When the computer program is executed by processor 1211, it performs the functions defined above in the triangular mesh model reconstruction method based on slice layer data of the embodiments of the present invention.

[0104] The names of the messages or information exchanged between the multiple devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0105] The electronic device provided in this embodiment of the invention and the triangular mesh model reconstruction method based on slice layer data provided in the above embodiment belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0106] This invention provides a computer storage medium storing a computer program that, when executed by a processor, implements the triangular mesh model reconstruction method based on slice layer data provided in the above embodiments.

[0107] It should be noted that the computer-readable medium described above in this invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0108] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0109] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0110] The units described in the embodiments of the present invention can be implemented in software or in hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0111] The above description is merely a preferred embodiment of the present invention and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this invention is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-disclosed concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this invention.

[0112] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the invention. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0113] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for reconstructing a triangular mesh model based on slice layer data, characterized in that, The method includes: Obtain slice layer data corresponding to multiple layered slices, each slice layer data including slice layer number, slice layer height and original boundary contour of the slice; The original boundary contours in each of the layered slices are offset to determine the offset contour data corresponding to each of the layered slices; wherein, the offset contour data includes an offset inner contour and an offset outer contour. Based on the offset contour data, the voxel distance values ​​of multiple active voxels associated with each of the layered slices are determined respectively; wherein, the voxel size of the active voxel is an integer multiple of the slice height of the layered slice; Based on the offset contour data, a layer slice to be corrected is determined from multiple layer slices, and the voxel distance value of the activation voxel associated with the layer slice to be corrected is adjusted to obtain the corrected voxel distance value of the activation voxel to be corrected; wherein, the layer slice to be corrected is the adjacent upper slice closest to the local peak point. Based on the activated voxels and the activated voxels to be corrected, the voxel model is flooded to fill the voxel model so that the voxel distance values ​​inside the voxel model are all negative and the voxel distance values ​​outside the voxel model are all positive, so as to obtain the voxel model. The zero isosurface is extracted from the voxel model to obtain the zero isosurface, and the triangular mesh model is reconstructed based on the zero isosurface.

2. The method according to claim 1, characterized in that, The step of offsetting the original boundary contours in each of the layered slices to determine the offset contour data corresponding to each of the layered slices includes: Based on the slice layer data, the original boundary contour of each slice is determined, and the coordinates of each point in the original boundary contour are integerized to obtain the boundary contour corresponding to each slice. Based on the first preset offset distance, the boundary contours are offset respectively to obtain the offset boundary contours corresponding to each layer slice. For a target layer slice, the offset inner contour and the offset outer contour of the target layer slice are determined based on the boundary contour and the offset boundary contour between the target layer slice and adjacent layer slices.

3. The method according to claim 2, characterized in that, The step of determining the offset inner contour and the offset outer contour of the target layer slice based on the boundary contour and the offset boundary contour between the target layer slice and adjacent layer slices includes: If the target layer slice is the bottom layer slice, the boundary contour of the target layer slice is directly used as the offset inner contour, and the difference between the union of the offset contours of adjacent layers and the boundary contour of the target layer slice is calculated, and the difference result is used as the offset outer contour; wherein, the union of the offset contours of adjacent layers is the union formed by the offset boundary contours between the target layer slice and the adjacent upper layer slice; If the target layer slice is the topmost slice, the boundary contour of the target layer slice is directly used as the offset inner contour. Furthermore, the difference between the union of the offset contours of adjacent layers and the boundary contour of the target layer slice is calculated, and the difference result is used as the offset outer contour. The union of the offset contours of adjacent layers is the union formed by the offset boundary contours between the target layer slice and the adjacent lower layer slice. If the target layer slice is an intermediate layer slice, the intersection boundary contour is determined based on the boundary contours between the target layer slice and its adjacent upper and lower layer slices. Based on the second preset offset distance, the intersection boundary contour is offset inward to obtain the offset intersection boundary contour. Subtract the offset intersection boundary contour from the boundary contour of the target layer slice, and use the difference result as the offset inner contour. Based on the offset boundary contours between the target layer slice, the adjacent upper layer slice, and the adjacent lower layer slice, a union offset boundary contour is determined; the boundary contour of the target layer slice is subtracted from the union offset boundary contour, and the difference is used as the offset outer contour.

4. The method according to claim 1, characterized in that, The step of determining the voxel distance values ​​of multiple active voxels associated with each of the layered slices based on the offset contour data includes: For a single layered slice, multiple target points are determined based on the offset contour data of the layered slice, and a total list of line segments is constructed based on the original boundary contour of the layered slice; wherein, the target points are located within the polygonal region or on the boundary line of the polygonal region corresponding to the offset contour data; the total list of line segments is used to represent the original boundary contour using multiple line segments. For a single target point corresponding to the layered slice, in the current segmentation round, the list of line segments to be segmented is divided along the target direction segmentation line to obtain a first line segment sublist and a second line segment sublist, and the first bounding box corresponding to the first line segment sublist and the second bounding box corresponding to the second line segment list are determined. Based on the distances between the target point and the first bounding box and the second bounding box, a target line segment list is determined from the first line segment sublist and the second line segment list, and the target line segment list is used as the line segment list to be segmented in the next segmentation round. After multiple iterations of segmentation, the shortest distance between the target point and the original boundary contour is determined at the end of the iteration. The target point is associated with multiple active voxels, and based on the shortest distance and the slice layer number of the slice to which the target point belongs, the voxel distance value corresponding to each active voxel is determined.

5. The method according to claim 4, characterized in that, When the offset contour data is an offset inner contour, the corresponding step of determining multiple target points based on the offset contour data of a single layer slice includes: Based on the offset inner contour, the target polygon region is determined, and the bounding box of the target polygon region is determined; Determine the vertical and horizontal coordinate boundaries of the bounding box; Based on the vertical coordinate boundary, multiple horizontal lines intersecting the target polygon region are constructed, and multiple horizontal line segments located within the target polygon region are determined; wherein, the spacing between each of the horizontal lines is the slice height of the layered slice; Based on the horizontal coordinate boundary, multiple vertical lines intersecting the target polygon region are constructed, and multiple target points are determined by the intersection of the multiple vertical lines and the multiple horizontal line segments.

6. The method according to claim 1, characterized in that, The step of determining the layered slice to be corrected from multiple layered slices based on the offset contour data includes: For a single layered slice, the offset outer contour of the layered slice is divided into multiple sub-regions, and it is determined whether each sub-region is adjacent to the offset inner contour of the layered slice. If there exists a sub-region that is not adjacent to the offset inner contour, then the layered slice is taken as the layered slice to be corrected.

7. The method according to claim 1, characterized in that, The step of correcting and adjusting the voxel distance value of the active voxel associated with the layer slice to be corrected, to obtain the corrected voxel distance value of the active voxel to be corrected, includes: Identify multiple points to be corrected within the sub-region to be corrected in the layered slice to be corrected; Determine the distance value from each point to be corrected to the boundary of the sub-region to be corrected, and determine the maximum distance value from the multiple distance values; Each of the points to be corrected is associated with a corresponding activation voxel to be corrected; For a single activated voxel to be corrected, the corrected voxel distance value is determined based on the distance value of the point to be corrected and the maximum distance value, and the voxel distance value of the activated voxel to be corrected is adjusted based on the corrected voxel distance value.

8. A device for reconstructing a triangular mesh model based on slice layer data, characterized in that, The device includes: The slice layer data acquisition module is used to acquire slice layer data corresponding to multiple layered slices. Each slice layer data includes a slice layer number, a slice layer height, and the original boundary contour of the slice. The offset processing module is used to perform offset processing on the original boundary contours in each of the layered slices to determine the offset contour data corresponding to each of the layered slices; wherein, the offset contour data includes an offset inner contour and an offset outer contour. The voxel distance value determination module is used to determine the voxel distance value of multiple active voxels associated with each of the layered slices based on the offset contour data; wherein the voxel size of the active voxel is an integer multiple of the slice height of the layered slice. The voxel distance correction module is used to determine the layer slice to be corrected from multiple layer slices based on the offset contour data, and to correct and adjust the voxel distance value of the active voxel to be corrected associated with the layer slice to be corrected, so as to obtain the corrected voxel distance value of the active voxel to be corrected; wherein, the layer slice to be corrected is the adjacent upper layer slice closest to the local peak point. The flooding filling module is used to flood the voxel model based on the activated voxels and the activated voxels to be corrected, so that the voxel distance values ​​inside the voxel model are all negative and the voxel distances outside are all positive, so as to obtain the voxel model. The triangular mesh model reconstruction module is used to extract the zero isosurface from the voxel model to obtain the zero isosurface, and to reconstruct the triangular mesh model based on the zero isosurface.

9. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the triangular mesh model reconstruction method based on slice layer data as described in any one of claims 1-7.

10. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the triangular mesh model reconstruction method based on slice layer data as described in any one of claims 1-7.