A method, apparatus, storage medium, and electronic device for constructing a triangular patch mesh

Through hierarchical spatial division and parallel calculation of intersecting voxels, the problem that traditional multi-forktree algorithms cannot use GPU for parallel computing is solved, and the efficiency of triangular mesh construction is improved.

CN119379953BActive Publication Date: 2025-06-13ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411941319.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-06-13
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

Traditional multi-forktree algorithms cannot use GPU for parallel computing, resulting in low efficiency in building triangular mesh.

Method used

By obtaining the bounding box of the target three-dimensional model, spatial division is carried out in layers, and the sub-voxels intersecting the target three-dimensional model is determined in the order of the spatial resolution from low to high, and a triangular panel grid is constructed.

Benefits of technology

This method is suitable for GPU parallel computing, improving the efficiency of triangular mesh construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119379953B_ABST
    Figure CN119379953B_ABST
Patent Text Reader

Abstract

This specification discloses a method, apparatus, storage medium, and electronic device for constructing a triangular facet mesh. The bounding box of the target 3D model of the object to be printed is determined, and the bounding box is hierarchically divided in space to obtain sub-voxels at each division level. In the order from low to high spatial resolution, for each division level in turn, among the sub-voxels at this division level, the sub-voxels that intersect with the target 3D model are determined as the intersecting voxels corresponding to this division level. According to the intersection points of the intersecting voxels corresponding to the last division level and the target 3D model, a triangular facet mesh of the target 3D model is constructed. In this method, the intersecting voxels are determined according to each division level, that is, the sub-voxels at each division level are processed one by one. There is no sequential dependence between the sub-voxels at the same division level, and parallel computing can be performed, which is suitable for GPUs. The parallel computing ability of GPUs can be utilized to accelerate the process of constructing the triangular facet mesh.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular, to a method, apparatus, storage medium, and electronic device for constructing a triangular facet mesh. Background Art

[0002] Additive manufacturing, also known as 3D printing, is a technology for manufacturing solid parts by layer-by-layer accumulation of materials based on a three-dimensional model. In application, the three-dimensional model needs to be meshed, and a triangular facet mesh is reconstructed. In the triangular facet mesh, the surface of the three-dimensional model is approximated by triangular facets composed of points and edges. Then, through preset bottom-up cutting planes, the cross-sectional profiles of the solid part are obtained by intersecting with the triangular facet mesh data. Finally, according to the cross-sectional profiles, the materials are accumulated layer by layer from bottom to top to obtain the solid part.

[0003] Currently, in the process of constructing a triangular facet mesh, a multi-way tree data structure is used to represent the three-dimensional space. Each node of the multi-way tree represents the volume space range of a cube, and the volume space ranges represented by the child nodes of a node together are equal to the volume space range represented by the node. The traditional multi-way tree algorithm uses a depth-first traversal method to recursively divide the root node from top to bottom until a preset maximum depth. Since the GPU does not support recursive calls, the traditional multi-way tree algorithm cannot use the GPU for parallel computing, resulting in a low efficiency of constructing the triangular facet mesh.

[0004] Based on this, this specification provides a method for constructing a triangular facet mesh. Summary of the Invention

[0005] This specification provides a method, apparatus, storage medium, and electronic device for constructing a triangular facet mesh to at least partially solve the above problems existing in the prior art.

[0006] This specification adopts the following technical solutions:

[0007] This specification provides a method for constructing a triangular facet mesh, including:

[0008] Obtain the target three-dimensional model of the object to be printed, and determine the bounding box of the target three-dimensional model;

[0009] Perform spatial division on the bounding box layer by layer to obtain sub-voxels of each division level;

[0010] In the order from low to high spatial resolution, for each division level in turn, among the sub-voxels of this division level, determine the sub-voxels that intersect with the target 3D model as the intersecting voxels corresponding to this division level; according to the sub-voxels of the next division level in the intersecting voxels corresponding to this division level, continue to determine the intersecting voxels corresponding to the next division level until the intersecting voxels corresponding to the last division level are determined;

[0011] Construct a triangular facet mesh of the target 3D model based on the intersection points of the intersecting voxels corresponding to the last division level and the target 3D model.

[0012] Optionally, determining the bounding box of the target 3D model specifically includes:

[0013] Determine the spatial coordinate system in which the target 3D model is located;

[0014] For each coordinate axis of the spatial coordinate system, determine two boundary points of the target 3D model on this coordinate axis;

[0015] Based on the two boundary points, determine the spatial range of the target 3D model on this coordinate axis;

[0016] Based on the spatial ranges of the target 3D model on each coordinate axis, determine the bounding box of the target 3D model.

[0017] Optionally, performing spatial division on the bounding box in layers to obtain sub-voxels of each division level, specifically including:

[0018] In the order from low to high spatial resolution, for each division level in turn, determine the voxels to be divided at this division level;

[0019] According to the number of divisions corresponding to this division level, divide the voxels to be divided to obtain the sub-voxels of the voxels to be divided;

[0020] Judge whether the sizes of the sub-voxels of the voxels to be divided meet the preset resolution;

[0021] If so, stop the division process;

[0022] If not, determine the number of divisions at the next division level and continue the division process.

[0023] Optionally, among the sub-voxels of this division level, determining the sub-voxels that intersect with the target 3D model as the intersecting voxels corresponding to this division level, specifically including:

[0024] Among the sub-voxels of this division level, determine the sub-voxels that need to perform distance calculation as the voxels to be calculated at this division level;

[0025] Determine the sub-voxels that intersect with the target 3D model based on the distance from the voxels to be calculated at this division level to the surface of the target 3D model, and use them as the intersecting voxels corresponding to this division level; use the intersecting voxels corresponding to this division level as the voxels to be calculated at the next division level.

[0026] Optionally, among the sub-voxels at this division level, determine the sub-voxels that need to calculate the distance as the voxels to be calculated at this division level, specifically including:

[0027] When this division level is the first division level, use all the sub-voxels at this division level as the voxels to be calculated at this division level;

[0028] When this division level is not the first division level, use the sub-voxels obtained by dividing the intersecting voxels corresponding to the previous division level as the voxels to be calculated at this division level.

[0029] Optionally, determine the sub-voxels that intersect with the target 3D model based on the distance from the voxels to be calculated at this division level to the surface of the target 3D model, specifically including:

[0030] Calculate the distances from each vertex of the voxels to be calculated at this division level to the surface of the target 3D model respectively;

[0031] Judge whether there is a distance less than the preset value among the calculated distances;

[0032] If so, determine that the voxel to be calculated is the intersecting voxel corresponding to this division level;

[0033] If not, determine that the voxel to be calculated is not the intersecting voxel corresponding to this division level.

[0034] Optionally, construct the triangular facet mesh of the target 3D model according to the intersection points of the intersecting voxels corresponding to the last division level and the target 3D model, specifically including:

[0035] Determine each edge of the intersecting voxels corresponding to the last division level;

[0036] For each edge, calculate the signed distances from the two vertices corresponding to this edge to the target 3D model respectively;

[0037] When the signed distances from the two vertices to the target 3D model are of different signs, perform interpolation on this edge to determine the interpolation point on this edge, and determine the intersection point of this edge and the target 3D model according to the interpolation point;

[0038] Construct a triangular facet mesh of the target 3D model based on the intersection points of each edge of the intersection voxels corresponding to the last division level and the target 3D model.

[0039] This specification provides a triangular facet mesh construction device, which includes:

[0040] An acquisition module, which acquires the target 3D model of the object to be printed and determines the bounding box of the target 3D model;

[0041] A division module, which divides the space of the bounding box layer by layer to obtain sub-voxels of each division level;

[0042] A layer-by-layer calculation module, in the order from low to high spatial resolution, for each division level in turn, determines the sub-voxels that intersect with the target 3D model among the sub-voxels of this division level as the intersection voxels corresponding to this division level; according to the sub-voxels of the next division level in the intersection voxels corresponding to this division level, continue to determine the intersection voxels corresponding to the next division level until the intersection voxels corresponding to the last division level are determined;

[0043] A mesh construction module, which constructs a triangular facet mesh of the target 3D model based on the intersection points of the intersection voxels corresponding to the last division level and the target 3D model.

[0044] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned triangular facet mesh construction method is implemented.

[0045] This specification provides an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the above-mentioned triangular facet mesh construction method is implemented.

[0046] At least one of the above technical solutions adopted by this specification can achieve the following beneficial effects:

[0047] In the triangular facet mesh construction method provided in this specification, a target 3D model of an object to be printed is obtained, the bounding box of the target 3D model is determined, and the bounding box is divided in space layer by layer to obtain sub-voxels of each division level. In the order from low to high spatial resolution, for each division level in turn, among the sub-voxels of this division level, the sub-voxels that intersect with the target 3D model are determined as the intersecting voxels corresponding to this division level. According to the intersection points of the intersecting voxels corresponding to the last division level and the target 3D model, a triangular facet mesh of the target 3D model is constructed. In this method, the intersecting voxels are determined according to each division level, that is, the sub-voxels of one division level are processed each time, and there is no forward or backward dependence between the sub-voxels of the same division level, so parallel computing can be performed. Therefore, this method is suitable for the GPU and can utilize the parallel computing power of the GPU to accelerate the construction process of the triangular facet mesh. Description of the Drawings

[0048] The drawings described herein are used to provide a further understanding of this specification, and constitute a part of this specification. The illustrative embodiments and descriptions thereof of this specification are used to explain this specification and do not constitute an improper limitation of this specification. In the drawings:

[0049] Figure 1 is a schematic flowchart of a triangular facet mesh construction method in this specification;

[0050] Figure 2 is a schematic tree structure diagram of a target 3D model provided in an embodiment of this specification;

[0051] Figure 3 is a schematic diagram of the meaning of signed distance provided in this specification;

[0052] Figure 4 is a schematic diagram of a triangular facet mesh construction device provided in this specification;

[0053] Figure 5 corresponding to what is provided in this specification Figure 1 schematic diagram of an electronic device. Detailed Description of the Embodiments

[0054] To make the purpose, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of this application.

[0055] The following will describe in detail the technical solutions provided in each embodiment of this specification in conjunction with the drawings.

[0056] Figure 1 This is a schematic flow chart of a method for constructing a triangular facet mesh in this specification, which specifically includes the following steps:

[0057] S100: Obtain the target three-dimensional model of the object to be printed, and determine the bounding box of the target three-dimensional model.

[0058] All steps in the method for constructing a triangular facet mesh provided in this specification can be implemented by any electronic device with computing functions, such as terminals, servers, etc. For the sake of convenience of description, hereinafter, only the server is used as the execution entity to describe the method for constructing a triangular facet mesh provided in this specification.

[0059] In the application scenario of this specification, the object to be printed can be the entire solid part or the voxel structure of the solid part. The target three-dimensional model of the object to be printed can be determined by an implicit function, designed by modeling software, or obtained by scanning a solid part with a 3D scanner.

[0060] Then, the server can determine the bounding box of the target three-dimensional model.

[0061] In one or more embodiments of this specification, the server determines the spatial coordinate system where the target three-dimensional model is located. For each coordinate axis of this spatial coordinate system, determine two boundary points of the target three-dimensional model on this coordinate axis. According to the two boundary points, determine the spatial range of the target three-dimensional model on this coordinate axis.

[0062] This specification does not limit the specific determination method of the boundary points. For example, the server can determine the spatial ranges on the three coordinate axes according to the domain of the implicit function. The server can also determine the projection planes of the target three-dimensional model on the three coordinate planes, and determine the projection lengths of each projection plane parallel to the three coordinate axes. Among the projection lengths, use the largest projection length as the side length of the cube to construct the bounding box. Or, the server can also determine the axis-aligned bounding box (AABB), oriented bounding box (OBB), etc. of the target three-dimensional model as the bounding box of the target three-dimensional model in this step.

[0063] The bounding box represents the spatial range of the target three-dimensional model in the three-dimensional spatial coordinate system. This bounding box can be regarded as the root node of the spatial division. In subsequent steps, the server can perform spatial divisions at each level based on this bounding box.

[0064] S102: Perform spatial division on the bounding box layer by layer to obtain sub-voxels at each division level.

[0065] In this specification, the server uses the bounding box of the target 3D model as the root node and divides the bounding box into layers according to a tree structure for spatial partitioning. The specific number of partitioning layers can be determined according to the volume of the target 3D model and the required spatial resolution. The deeper the partitioning layer, the smaller the size of each sub-voxel obtained in this partitioning layer, and the higher the corresponding spatial resolution.

[0066] The server determines the voxels to be partitioned in each partitioning layer in ascending order of spatial resolution.

[0067] Specifically, when this partitioning layer is the first partitioning layer, the server partitions the volume space corresponding to the bounding box and uses the bounding box of the target 3D model as the voxel to be partitioned in this layer. When this partitioning layer is not the first partitioning layer, the sub-voxels obtained in the previous partitioning layer are used as the voxels to be partitioned in this layer. That is, the number of voxels to be partitioned in the first partitioning layer is one, and the number of voxels to be partitioned in other partitioning layers is multiple.

[0068] Secondly, the server partitions the voxels to be partitioned according to the number of partitions corresponding to this partitioning layer to obtain the sub-voxels of the voxels to be partitioned.

[0069] This specification does not limit the number of partitions in each partitioning layer. The number of partitions in different partitioning layers can be the same or different.

[0070] When this partitioning layer is the first partitioning layer, the voxel to be partitioned is the bounding box of the target 3D model. The server partitions the bounding box of the target 3D model according to the number of partitions corresponding to the first partitioning layer to obtain the sub-voxels of the first partitioning layer.

[0071] When this partitioning layer is not the first partitioning layer, the voxels to be partitioned are the sub-voxels obtained in the previous partitioning layer. For each sub-voxel obtained in the previous partitioning layer, the server uses this sub-voxel as the voxel to be partitioned and partitions this voxel to be partitioned according to the number of partitions corresponding to this partitioning layer to obtain the sub-voxels partitioned from this voxel to be partitioned.

[0072] Figure 2 Shown in the figure is a schematic diagram of the tree structure of a target 3D model provided in the embodiments of this specification. Figure 2 As shown, the number of partitioning layers is 3, and the number of partitions in each partitioning layer is set to 64 3 、16 3 、4 3 . Then, in the first-level partitioning, each side of the bounding box of the target 3D model is divided into 64 equal parts to obtain 64 3sub-voxels. At the second division level, for each sub-voxel obtained from the first division, taking this sub-voxel as the voxel to be divided, each edge of this voxel to be divided is equally divided into 16 parts, then this voxel to be divided is divided into 16 3 sub-voxels. After the division at the second division level, the bounding box of the target 3D model is divided into (64×16) 3 sub-voxels. At the third division level, for each sub-voxel obtained from the second division, taking this sub-voxel as the voxel to be divided, each edge of this voxel to be divided is equally divided into 4 parts, then this voxel to be divided is divided into 4 3 sub-voxels. After the division at the third division level, the bounding box of the target 3D model is divided into (64×16×4) 3 sub-voxels.

[0073] Then, the server determines whether the sizes of the sub-voxels of the voxel to be divided meet the preset resolution. If so, the division process stops. If not, it determines the division quantity at the next division level and continues the division process.

[0074] For objects to be printed with different sizes or structures, the required precision of the triangular facet meshes to be constructed is different. Generally, for objects to be printed with larger sizes or more complex structures, the target 3D model needs to be divided into sub-voxels with smaller sizes, that is, the sizes of the divided sub-voxels need to reach a higher spatial resolution.

[0075] For each division level, the sizes of the sub-voxels obtained at this division level are determined according to the size of the voxel to be divided at this division level and the division quantity at this division level. For example, if the size of the bounding box of the target 3D model is a 3 , and the division quantity at the first division level is 64 3 when, the size of each sub-voxel obtained by the division at the first division level is .

[0076] For each division level, after obtaining the sub-voxels of this division level, the server determines whether the sizes of the sub-voxels obtained at this division level meet the preset resolution according to the preset resolution, and this preset resolution is the minimum distinguishable side length of adjacent sub-voxels.

[0077] If the server determines that the side length of the sub-voxels obtained at this division level is not greater than the preset resolution, then the server stops the division process.

[0078] S104: In the order from low to high spatial resolution, for each division level in turn, among the sub-voxels at this division level, determine the sub-voxels that intersect with the target 3D model as the intersecting voxels corresponding to this division level; based on the sub-voxels of the next division level in the intersecting voxels corresponding to this division level, continue to determine the intersecting voxels corresponding to the next division level until the intersecting voxels corresponding to the last division level are determined.

[0079] After the above hierarchical division, the 3D space where the target 3D model is located is represented in a multi-way tree data structure, and the bounding box of the target 3D model is the root node.

[0080] In the triangular facet mesh construction method in this specification, the server uses a hierarchical traversal method to perform operations on the nodes of each division level, that is, the sub-voxels obtained at each division level. Then, for the sub-voxels of a division level, since there is no dependency relationship between the sub-voxels, a GPU thread can be allocated to each sub-voxel for parallel calculation to accelerate the construction process of the triangular facet mesh.

[0081] The server, in the order from low to high spatial resolution, for each division level in turn, among the sub-voxels at this division level, determines the sub-voxels that intersect with the target 3D model as the intersecting voxels corresponding to this division level.

[0082] First, the server determines the sub-voxels that need to perform distance calculation among the sub-voxels at this division level as the to-be-calculated voxels at this division level.

[0083] In this specification, the server needs to determine the sub-voxels that intersect with the target 3D model, and further determine the boundary of the target 3D model based on the intersecting sub-voxels. Therefore, the server needs to calculate the distance between the sub-voxels and the surface of the target 3D model to determine whether the sub-voxels intersect with the target 3D model.

[0084] Specifically, when this division level is the first division level, all the sub-voxels at this division level are used as the to-be-calculated voxels at this division level. When this division level is not the first division level, all the sub-voxels obtained by dividing the intersecting voxels corresponding to the previous division level are used as the to-be-calculated voxels at this division level.

[0085] In this embodiment, the server allocates GPU threads to the determined to-be-calculated voxels and does not perform calculations on non-to-be-calculated voxels, saving storage and computing resources.

[0086] Then, the server determines the sub-voxels that intersect with the target 3D model based on the distance from the voxels to be calculated at this division level to the surface of the target 3D model, and uses them as the intersecting voxels corresponding to this division level; and uses the intersecting voxels corresponding to this division level as the voxels to be calculated at the next division level.

[0087] The voxels to be calculated are in the shape of a cube and have 8 vertices. When any one of the 8 vertices intersects with the target 3D model, the voxel to be calculated intersects with the target 3D model. In an ideal state, when the distance from a certain vertex to the surface of the target 3D model is 0, it means that the vertex intersects with the target 3D model. Due to the limitation of spatial resolution, the intersection point between the voxel to be calculated and the target 3D model may not exactly be the vertex of the voxel to be calculated. However, if the voxel to be calculated intersects with the target 3D model, there are vertices in the voxel to be calculated with a relatively small distance to the surface of the target 3D model.

[0088] Therefore, the server calculates the distances from each vertex of the voxels to be calculated at this division level to the surface of the target 3D model respectively, and determines whether there is a distance less than a preset value among the distances from each vertex to the surface of the target 3D model. If so, it is determined that the voxel to be calculated is the intersecting voxel corresponding to this division level. If not, it is determined that the voxel to be calculated is not the intersecting voxel corresponding to this division level. Among them, the distance calculation method here can be Euclidean distance, Signed Distance Field (SDF), etc.

[0089] The sizes of the sub-voxels obtained by dividing at the next division level of this division level are smaller than the sizes of the sub-voxels obtained by dividing at this division level. When it is determined that a certain sub-voxel at this division level is not an intersecting voxel, it means that there is no intersection point between this sub-voxel and the surface of the target 3D model. Then, the smaller sub-voxels obtained by further dividing this sub-voxel will also have no intersection point with the surface of the target 3D model.

[0090] When it is determined that a certain sub-voxel at this division level is an intersecting voxel, it means that there is an intersection point between this sub-voxel and the surface of the target 3D model. To determine the intersection point between the surface of the target 3D model and this intersecting voxel, it is necessary to continue to calculate the distances for the sub-voxels included in the intersecting voxel to determine the accurate intersection point position. Therefore, the server uses the sub-voxels obtained by further dividing the intersecting voxel at this division level as the voxels to be calculated at the next division level.

[0091] S106: Construct a triangular facet mesh of the target 3D model based on the intersection points between the intersecting voxels corresponding to the last division level and the target 3D model.

[0092] In the above steps, for each sub-voxel included in each division level, the server calculates the distance between each sub-voxel and the surface of the target 3D model in parallel, and finally determines the intersecting voxels of the last division level.

[0093] Based on the intersection points of the intersecting voxels of the last division level and the target 3D model, the server can construct a triangular mesh.

[0094] Specifically, the server determines the intersecting voxels of the last division level. These intersecting voxels intersect with the contour of the surface of the target 3D model.

[0095] For each intersecting voxel of the last division level, each edge of the intersecting voxel is determined. For each edge, the signed distance (Signed Distance Field, SDF) between the two vertices of the edge and the target 3D model is calculated.

[0096] If the signed distance is positive, it means that the vertex is outside the target 3D model; if the signed distance is negative, it means that the vertex is inside the target 3D model; if the signed distance is zero, it means that the vertex is on the surface of the target 3D model.

[0097] If the edge intersects with the surface of the target 3D model, it means that the edge penetrates the inside and outside of the target 3D model, so one of the two vertices of the edge is positive and the other is negative. Therefore, when the signed distances of the two vertices of the edge have different signs, the server determines that the edge has an intersection point with the target 3D model.

[0098] Specifically, when the server determines that the edge has an intersection point with the target 3D model, the midpoint of the edge can be taken as the intersection point of the edge and the target 3D model.

[0099] Figure 3 This is a schematic diagram of the meaning of signed distance provided in this specification, with the shaded area representing the voxel range inside the target 3D model. In the left voxel, the signed distances of all 8 vertices are less than zero, indicating that the voxel is inside the target 3D model and has no intersection point with the target 3D model. In the right voxel, the signed distances of all 8 vertices are greater than zero, indicating that the voxel is outside the target 3D model and has no intersection point with the target 3D model. In the middle voxel, the voxel intersects with the target 3D model. The signed distance of vertex A is greater than zero, the signed distance of vertex B is less than zero, and the position of vertex B is close to the intersection point, and the signed distance of vertex B is close to zero.

[0100] Finally, after calculating the intersection points of the voxels and the target 3D model, the server can generate a triangular mesh based on the intersection points. There are various ways to generate a triangular mesh, such as the Marching Cubes (MC) algorithm, the Dual Contouring (DC) algorithm, etc.

[0101] In this specification, the distances between the sub-voxels of the same layer and the target 3D model are calculated in parallel, which can quickly determine the intersecting voxels and accelerate the generation speed of the triangular facet mesh.

[0102] In the triangular facet mesh construction method provided in this specification, the target 3D model of the object to be printed is obtained, the bounding box of the target 3D model is determined, and the space of the bounding box is divided into layers to obtain the sub-voxels of each divided layer. In the order from low to high spatial resolution, for each divided layer in turn, among the sub-voxels of this divided layer, the sub-voxels that intersect with the target 3D model are determined as the intersecting voxels corresponding to this divided layer. According to the intersection points of the intersecting voxels corresponding to the last divided layer and the target 3D model, the triangular facet mesh of the target 3D model is constructed. In this method, the intersecting voxels are determined according to each divided layer, that is, the sub-voxels of one divided layer are processed each time, and there is no forward or backward dependence relationship between the sub-voxels of the same divided layer, so parallel calculation can be performed. Then this method is suitable for GPU, and the parallel computing power of GPU can be utilized to accelerate the construction process of the triangular facet mesh.

[0103] In one embodiment, in the above step S108, after obtaining the triangular facet mesh of the target 3D model, mesh repair tools such as MeshLab and Netfabb can be used to detect the watertightness of the triangular facet mesh. After determining that the triangular facet mesh is watertight, that is, there are no any gaps or missing parts, it is used for 3D printing of the object to be printed.

[0104] In the above step S108, for the edges determined to intersect with the target 3D model, the server performs interpolation on this edge to determine the interpolation points on this edge, and determines the intersection points of this edge and the target 3D model according to the interpolation points.

[0105] For each interpolation point, the server calculates the distance between this interpolation point and the surface of the target 3D model. This distance can be the Euclidean distance, the signed distance (Signed Distance Field, SDF), etc. The closer the value of this distance is to zero, the closer the actual intersection point of this interpolation point and the surface of the target 3D model is.

[0106] The server determines the interpolation point with the distance closest to zero from the surface of the target 3D model among the interpolation points as the intersection point of this edge and the target 3D model.

[0107] This specification does not limit the specific number and specific interpolation method of the interpolation points, and interpolation methods such as linear interpolation and non-linear interpolation can be used. The more the number of interpolation points, the higher the accuracy of the finally determined intersection points.

[0108] The above is the triangular patch mesh construction method provided in this specification. Based on the same idea, this specification also provides a corresponding triangular patch mesh construction device, as Figure 4 shown.

[0109] Figure 4 is a schematic diagram of a triangular patch mesh construction device provided in this specification, specifically including:

[0110] An acquisition module 200, configured to acquire a target three-dimensional model of an object to be printed and determine a bounding box of the target three-dimensional model;

[0111] A partitioning module 202, configured to perform spatial partitioning on the bounding box layer by layer to obtain sub-voxels of each partitioning level;

[0112] A layer-by-layer calculation module 204, configured to, in the order from low to high spatial resolution, for each partitioning level in turn, determine, among the sub-voxels of each partitioning level of this partitioning level, the sub-voxels that intersect with the target three-dimensional model as the intersecting voxels corresponding to this partitioning level; continue to determine the intersecting voxels corresponding to the next partitioning level according to the sub-voxels of the next partitioning level in the intersecting voxels corresponding to this partitioning level until the intersecting voxels corresponding to the last partitioning level are determined;

[0113] A mesh construction module 206, configured to construct a triangular patch mesh of the target three-dimensional model according to the intersection points of the intersecting voxels corresponding to the last partitioning level and the target three-dimensional model.

[0114] Optionally, the acquisition module 200 is specifically configured to determine the spatial coordinate system where the target three-dimensional model is located, for each coordinate axis of the spatial coordinate system, determine two boundary points of the target three-dimensional model on this coordinate axis, determine the spatial range of the target three-dimensional model on this coordinate axis according to the two boundary points, and determine the bounding box of the target three-dimensional model according to the spatial ranges of the target three-dimensional model on each coordinate axis.

[0115] Optionally, the partitioning module 202 is specifically configured to, in the order from low to high spatial resolution, for each partitioning level in turn, determine the voxels to be partitioned at this partitioning level, partition the voxels to be partitioned according to the number of partitions corresponding to this partitioning level to obtain the sub-voxels of the voxels to be partitioned, and determine whether the sizes of the sub-voxels of the voxels to be partitioned meet a preset resolution. If so, stop the partitioning process. If not, determine the number of partitions at the next partitioning level and continue the partitioning process.

[0116] Optionally, the hierarchical calculation module 204 is specifically configured to determine, among the sub-voxels of the divided level, the sub-voxels that need to perform distance calculation as the voxels to be calculated at this divided level, determine the sub-voxels that intersect with the target three-dimensional model based on the distances from the voxels to be calculated at this divided level to the surface of the target three-dimensional model as the intersecting voxels corresponding to this divided level, and use the intersecting voxels corresponding to this divided level as the voxels to be calculated at the next divided level.

[0117] Optionally, when this divided level is the first divided level, the hierarchical calculation module 204 is specifically configured to use the sub-voxels of this divided level as the voxels to be calculated at this divided level; when this divided level is not the first divided level, the hierarchical calculation module 204 is specifically configured to use the sub-voxels obtained by dividing the intersecting voxels corresponding to the previous divided level as the voxels to be calculated at this divided level.

[0118] Optionally, the hierarchical calculation module 204 is specifically configured to calculate the distances from the vertices of the voxels to be calculated at this divided level to the surface of the target three-dimensional model respectively, and determine whether there is a distance less than a preset value among the calculated distances. If so, it is determined that the voxel to be calculated is the intersecting voxel corresponding to this divided level; if not, it is determined that the voxel to be calculated is not the intersecting voxel corresponding to this divided level.

[0119] Optionally, the mesh construction module 206 is specifically configured to determine each edge of the intersecting voxels corresponding to the last divided level. For each edge, calculate the signed distances between the two vertices corresponding to the edge and the target three-dimensional model respectively. When the signed distances of the two vertices from the target three-dimensional model have different signs, perform interpolation on this edge to determine the interpolation points on this edge, determine the intersection points of this edge and the target three-dimensional model based on the interpolation points, and construct the triangular facet mesh of the target three-dimensional model according to the intersection points of each edge of the intersecting voxels corresponding to the last divided level and the target three-dimensional model.

[0120] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above Figure 1 provided triangular facet mesh construction method.

[0121] This specification also provides Figure 5 a schematic structural diagram of the electronic device shown. As Figure 5 described above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory. Of course, it may also include other hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above Figure 1The described triangular patch mesh construction method. Of course, in addition to the software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, and can also be hardware or a logic device.

[0122] For an improvement in a technology, it can be clearly distinguished whether it is a hardware improvement (e.g., improvement in circuit structures such as diodes, transistors, switches, etc.) or a software improvement (improvement in method processes). However, with the development of technology, many improvements in method processes today can be regarded as direct improvements in hardware circuit structures. Almost all designers obtain the corresponding hardware circuit structure by programming the improved method process into the hardware circuit. Therefore, it cannot be said that an improvement in a method process cannot be implemented with a hardware entity module. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. The designer can program by himself to "integrate" a digital system on a piece of PLD, without having to ask the chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a Hardware Description Language (HDL), and there is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones currently are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be clear that only by slightly logically programming the method process with the above-mentioned several hardware description languages and programming it into the integrated circuit, it is easy to obtain the hardware circuit that implements the logical method process.

[0123] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. to achieve the same function. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or structures within the hardware component.

[0124] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.

[0125] For the convenience of description, when describing the above devices, they are described separately as various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0126] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code.

[0127] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and combinations of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or blocks.

[0128] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including instruction means that implement the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or blocks.

[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are performed on the computer or other programmable device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or blocks.

[0130] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0131] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.

[0132] A computer-readable medium includes both permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0133] It should also be noted that the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0134] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, system or computer program product. Therefore, this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0135] This specification can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0136] The various embodiments in this specification are described in a progressive manner. For the same or similar parts among the various embodiments, reference can be made to each other, and the key points of each embodiment are the differences from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant parts, reference can be made to the partial description of the method embodiments.

[0137] The above description is only for the embodiments of this specification and is not intended to limit this specification. For those skilled in the art, various modifications and changes can be made to this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this specification shall be included within the scope of the claims of this application.

Claims

1. A method for constructing a triangular patch mesh, characterized in that: include: Acquire a target three-dimensional model of the object to be printed, and determine a bounding box of the target three-dimensional model; Performing spatial division on the bounding box layer by layer to obtain sub-voxels of each division layer, and for each sub-voxel of a division layer, assigning a GPU thread to each sub-voxel to perform parallel calculation; In order of spatial resolution from low to high, for each division level, in each sub-voxel of the division level, sub-voxels intersecting with the target three-dimensional model are determined as intersection voxels corresponding to the division level; according to each sub-voxel of the next division level among the intersection voxels corresponding to the division level, intersection voxels corresponding to the next division level are continuously determined until the intersection voxels corresponding to the last division level are determined; Constructing a triangular patch mesh of the target three-dimensional model according to the intersection points of the intersecting voxels corresponding to the last division level and the target three-dimensional model; The bounding box is spatially divided into layers to obtain sub-voxels at each division level, specifically including: According to the order of spatial resolution from low to high, for each division level, determine the voxels to be divided at the division level; divide the voxels to be divided according to the number of divisions corresponding to the division level to obtain each sub-voxel of the voxel to be divided; determine whether the size of each sub-voxel of the voxel to be divided meets the preset resolution; if so, stop the division process; if not, determine the number of divisions at the next division level and continue the division process; Constructing a triangular face mesh of the target three-dimensional model according to the intersection voxels corresponding to the last division level and the intersection points of the target three-dimensional model, specifically comprising: Determine each edge of the intersecting voxels corresponding to the last division level; for each edge, respectively calculate the signed distance between the two vertices corresponding to the edge and the target three-dimensional model; when the signed distances between the two vertices and the target three-dimensional model are of different signs, interpolate the edge to determine the interpolation point on the edge, and determine the intersection of the edge and the target three-dimensional model based on the interpolation point; construct a triangular facet mesh of the target three-dimensional model based on the intersection of each edge of the intersecting voxels corresponding to the last division level and the target three-dimensional model.

2. The method according to claim 1, characterized in that Determining the bounding box of the target three-dimensional model specifically includes: Determine the spatial coordinate system where the target three-dimensional model is located; For each coordinate axis of the spatial coordinate system, determining two boundary points of the target three-dimensional model on the coordinate axis; Determine the spatial range of the target three-dimensional model on the coordinate axis according to the two boundary points; According to the spatial range of the target three-dimensional model on each coordinate axis, a bounding box of the target three-dimensional model is determined.

3. The method according to claim 1, characterized in that Among the sub-voxels of the division level, determining the sub-voxels intersecting with the target three-dimensional model as the intersecting voxels corresponding to the division level specifically includes: Among the sub-voxels of the division level, determining the sub-voxels that need to be calculated as the voxels to be calculated at the division level; According to the distance between the voxel to be calculated at the division level and the surface of the target three-dimensional model, the sub-voxel intersecting with the target three-dimensional model is determined as the intersecting voxel corresponding to the division level; the intersecting voxel corresponding to the division level is used as the voxel to be calculated at the next division level.

4. The method according to claim 3, characterized in that Among the sub-voxels of the division level, the sub-voxels that need to be calculated are determined as the voxels to be calculated of the division level, specifically including: When the division level is the first division level, each sub-voxel of the division level is used as the voxel to be calculated of the division level; When the division level is not the first division level, each sub-voxel obtained by dividing the intersecting voxels corresponding to the previous division level is used as the voxels to be calculated in the division level.

5. The method according to claim 3, characterized in that According to the distance from the voxel to be calculated at the division level to the surface of the target three-dimensional model, determining the sub-voxel intersecting with the target three-dimensional model as the intersecting voxel corresponding to the division level specifically includes: Calculating the distances of the vertices of the voxels to be calculated at the divided level to the surface of the target three-dimensional model respectively; Determine whether there is a distance less than a preset value among the calculated distances; If yes, it is determined that the voxel to be calculated is the intersection voxel corresponding to the division level; If not, it is determined that the voxel to be calculated is not an intersection voxel corresponding to the division level.

6. A triangular patch mesh construction device, characterized in that: include: An acquisition module is used to acquire a target three-dimensional model of the object to be printed and determine a bounding box of the target three-dimensional model; A partitioning module, which performs spatial partitioning on the bounding box layer by layer to obtain sub-voxels of each partitioning layer, and allocates a GPU thread to each sub-voxel of a partitioning layer for parallel computing; The hierarchical calculation module determines, for each division level in order from low to high spatial resolution, sub-voxels intersecting with the target three-dimensional model in each sub-voxel of the division level as intersection voxels corresponding to the division level; and continues to determine intersection voxels corresponding to the next division level according to each sub-voxel of the next division level among the intersection voxels corresponding to the division level, until the intersection voxels corresponding to the last division level are determined; A mesh construction module, constructing a triangular face mesh of the target three-dimensional model according to the intersection points of the intersecting voxels corresponding to the last division level and the target three-dimensional model; The division module is specifically used to determine the voxels to be divided at each division level in order from low to high spatial resolution; divide the voxels to be divided according to the number of divisions corresponding to the division level to obtain sub-voxels of the voxels to be divided; determine whether the size of each sub-voxel of the voxel to be divided meets the preset resolution; if so, stop the division process; if not, determine the number of divisions at the next division level and continue the division process; The mesh construction module is specifically used to determine each edge of the intersecting voxels corresponding to the last division level; for each edge, respectively calculate the signed distance between the two vertices corresponding to the edge and the target three-dimensional model; when the signed distances between the two vertices and the target three-dimensional model are of different signs, interpolate the edge to determine the interpolation point on the edge, and determine the intersection of the edge and the target three-dimensional model based on the interpolation point; and construct a triangular face mesh of the target three-dimensional model based on the intersection of each edge of the intersecting voxels corresponding to the last division level and the target three-dimensional model.

7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 5 is implemented.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Three-dimensional model rapid voxelization method based on slicing strategy

    CN110889903A

  • Reconstruction method, device and equipment of three-dimensional entity model, medium and program product

    CN117409144A