Section output method, device and equipment of three-dimensional model and storage medium
By establishing a binary space tree and filtering the section units, the problem of long output time for sections of large model datasets is solved, and efficient 3D model section calculation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2026-03-31
Smart Images

Figure CN119313809B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics technology, and in particular to a method, apparatus, device, and storage medium for outputting the cross-section of a three-dimensional model. Background Technology
[0002] Outputting the state of a 3D model after it has been segmented by cross-sections helps in observing and analyzing the model's internal structure or the condition of a specific cross-section. Current techniques typically involve traversing all elements of the model and determining whether each element has been segmented. However, the traversal and determination processes themselves involve computational complexity. When dealing with large model datasets, the sheer number of mesh elements in the model leads to excessive computational demands on the cross-sections, resulting in lengthy output times for the 3D model's cross-sections. Summary of the Invention
[0003] The main objective of this application is to provide a method, apparatus, device, and storage medium for outputting cross-sections of a 3D model, aiming to solve the technical problem that in the prior art, when processing large model datasets, the amount of cross-section calculation is too large due to the large number of mesh units in the model, resulting in long output time for 3D model cross-sections.
[0004] To achieve the above objectives, this application proposes a method for outputting the cross-section of a 3D model. The method includes: obtaining a 3D model based on a unit representation, wherein the unit is formed by connecting point data in the 3D model; determining a binary space tree corresponding to the 3D model based on a set maximum level, wherein each spatial node of the binary space tree contains at least one of the units; calculating the bounding box of each spatial node of the binary space tree, and filtering out the cross-section units in the unit according to the positive and negative states of the bounding box and the cross-section; performing cross-section calculation based on the cross-section units, and outputting the cross-section model corresponding to the 3D model.
[0005] In one embodiment, the step of obtaining a 3D model based on unit representation includes:
[0006] Acquire point data and the connection relationships between the point data;
[0007] The unit is determined based on the connection relationship and the point data;
[0008] The three-dimensional model is obtained based on the unit.
[0009] In one embodiment, the step of determining the binary space tree corresponding to the 3D model based on a set maximum level includes:
[0010] Generate the root node of a binary tree based on the bounding box of the 3D model;
[0011] The maximum level is determined based on the number of units in the three-dimensional model;
[0012] Generate the binary space tree with the maximum level based on the root node of the binary tree, such that each spatial node of the binary space tree contains at least one of the units.
[0013] In one embodiment, the step of generating the binary space tree with the maximum level based on the root node of the binary tree includes:
[0014] Based on the maximum level, the root node is divided into leaf nodes corresponding to the maximum level according to the hierarchical order of the binary space tree to generate the binary space tree.
[0015] In one embodiment, the spatial nodes include root nodes, tree nodes, and leaf nodes. The step of calculating the bounding boxes of each spatial node of the binary tree and filtering out the sectional elements in the unit based on the positive and negative states of the bounding boxes and the sectional elements includes:
[0016] Based on the hierarchical relationship of the binary space tree, traverse from the root node to the leaf node of the binary space tree to determine the distance between each vertex of the bounding box corresponding to the space node and the set tangent.
[0017] The positive or negative state of the bounding box of the spatial node is determined based on the distance;
[0018] If the bounding box of the spatial node is in a slicing state and the spatial node is not a leaf node, then traverse the child nodes of the spatial node and execute the step of determining the distance between each vertex of the bounding box of the spatial node and the set slicing plane.
[0019] If the bounding box of the spatial node is in a slicing state, and the spatial node is the leaf node, then the unit contained in the spatial node is determined to be the slicing unit.
[0020] In one embodiment, the step of determining the distance between each vertex of the bounding box corresponding to the spatial node and the set tangent includes:
[0021] Obtain the plane equation of the defined cross-section;
[0022] Determine the vertices of the bounding box of the spatial node;
[0023] Based on the coordinates of the vertices and the plane equation, the distance from each vertex to the set tangent is determined.
[0024] In one embodiment, the step of determining the positive or negative state of the spatial node based on the distance includes any one of the following:
[0025] If all the distances mentioned are greater than zero, then the positive and negative states are determined to be positive spaces;
[0026] If all the distances are less than zero, then the positive and negative states are determined to be negative space;
[0027] Otherwise, the positive or negative state is determined to be the cut state.
[0028] Furthermore, to achieve the above objectives, this application also provides a 3D model section output device, which includes: a model acquisition module for acquiring a 3D model based on unit representation, wherein the unit is formed by connecting point data in the 3D model; a section unit judgment module for determining the binary space tree corresponding to the 3D model based on a set maximum level, wherein each spatial node of the binary space tree contains at least one of the units; calculating the bounding box of each spatial node of the binary space tree, and filtering out section units in the unit according to the positive and negative states of the bounding box and the section; and an output module for performing section calculation based on the section units and outputting the section model corresponding to the 3D model.
[0029] In addition, to achieve the above objectives, this application also provides a three-dimensional model section output device, the three-dimensional model section output device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the three-dimensional model section output method as described above.
[0030] In addition, to achieve the above objectives, this application also provides a storage medium, which is a computer-readable storage medium, and stores a program for implementing a method for outputting the cross-section of a three-dimensional model. The program for implementing the method for outputting the cross-section of a three-dimensional model is executed by a processor to implement the steps of the method for outputting the cross-section of a three-dimensional model as described above.
[0031] This application provides a method for outputting the cross-section of a 3D model. First, it obtains a 3D model expressed by units by connecting point data. Then, it determines a binary space tree corresponding to the 3D model according to a pre-set maximum level. Next, it filters out the cross-section units corresponding to the units based on the positive and negative states of the bounding boxes of the binary space trees containing at least one unit in each space node. Finally, it performs cross-section calculation based on the filtered cross-section units and outputs the cross-section model corresponding to the 3D model, thereby reducing the time complexity of the 3D model cross-section output.
[0032] In summary, this application quickly determines whether a cell in a spatial node is tangent to a tangent plane by calculating the tangency between the bounding box of the spatial node and the tangent plane. If not, the traversal calculation of the cutting algorithm between the cell and the tangent plane can be avoided. This application eliminates unnecessary cell traversal calculations in the tangent plane calculation process for large model datasets, achieving a significant reduction in computational overhead and improved model output performance. Attached Figure Description
[0033] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0034] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart illustrating an embodiment of the method for outputting the cross-section of a 3D model in this application.
[0036] Figure 2 This is a flowchart illustrating Embodiment 2 of the method for outputting the cross-section of a 3D model in this application.
[0037] Figure 3 This is a flowchart illustrating the method for outputting the cross-section of a 3D model in this application, as provided in Embodiment 3.
[0038] Figure 4 This is a flowchart illustrating Embodiment 4 of the method for outputting the cross-section of a 3D model in this application.
[0039] Figure 5 This is a flowchart illustrating the general embodiment of the method for outputting the cross-section of a 3D model according to this application.
[0040] Figure 6 This is a schematic diagram of the hardware operating environment involved in the embodiment of the 3D model section output device of this application.
[0041] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0042] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0043] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0044] The main solution of this application embodiment is as follows: obtaining a three-dimensional model based on unit expression, wherein the unit is formed by connecting several points in the three-dimensional model; determining the binary space tree corresponding to the three-dimensional model based on a set maximum level, wherein each spatial node of the binary space tree contains at least one of the units; filtering out the sectional units in the units according to the positive and negative states of the bounding boxes of each spatial node of the binary space tree; performing sectional calculation based on the sectional units, and outputting the sectional model corresponding to the three-dimensional model.
[0045] Because existing technologies often involve traversing all elements of a 3D model and determining whether an element has been cut before performing calculations, the common practice in processing 3D models is to traverse all elements of the model and determine whether the element has been cut before performing the calculation. This approach is inefficient.
[0046] This application provides a method for outputting cross-sections of a 3D model. The model is divided into binary subspaces to obtain a set of elements within each subspace. Tangency calculations are then performed between the element sets and the bounding boxes corresponding to the subspaces, quickly determining whether any element in the space is tangent to the cross-section. If elements do not intersect, subsequent traversal calculations using cutting algorithms for child nodes are avoided, significantly reducing computational overhead.
[0047] It should be noted that the execution subject in this embodiment can be a 3D model section output device, or a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or a 3D model section output device capable of performing the above functions. This embodiment does not specifically limit it in this way. The following uses a 3D model section output device as the execution subject as an example to describe this embodiment and the following embodiments.
[0048] Based on this, Embodiment 1 of this application provides a method for outputting the cross-section of a three-dimensional model, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the method for outputting the cross-section of a 3D model according to this application. In this embodiment, the method for outputting the cross-section of a 3D model includes steps S100 to S400:
[0049] Step S100: Obtain a three-dimensional model based on unit representation, wherein the unit is formed by connecting point data in the three-dimensional model.
[0050] It should be noted that in a 3D model, a unit refers to a basic geometric building block composed of a set of connected point data. Units can be lines, surfaces, or volumes. A line can be formed by connecting two points, a surface can be a polygon formed by connecting multiple points in sequence, and a volume is a 3D solid composed of surfaces. Point data is the basic element constituting a 3D model. In this embodiment, it refers to points with specific coordinates (x, y, z). The connection and combination of different points constitute multiple units, which are then used to build the 3D model step by step. The 3D model can be a tetrahedron, a cube, or other hexahedrons; it is a solid graphic. This embodiment does not limit the appearance of the 3D model.
[0051] As an alternative implementation method, the point data in the model is first identified and extracted to obtain the geometric shape of the model defined in the point data. Then, based on the topology information of the model file, which can be the connection relationship between points, the units formed by connecting the point data are obtained, thereby constructing a complete three-dimensional model.
[0052] For example, a regular hexahedron model is constructed. In this model, the point data includes the three-dimensional coordinates of the eight vertices of the hexahedron. After obtaining the coordinates of the point data, the 3D model file is read to obtain the connection information of all points and elements required to construct the 3D model. If feasible, these point data are connected to form the edges of the hexahedron, with each edge defined by two vertices. Further, these edges are used to form six faces, each defined by four edges or four vertices. Thus, the six faces of the hexahedron can be obtained, which are the elements constituting the 3D model.
[0053] Step S200: Determine the binary space tree corresponding to the three-dimensional model based on the set maximum level, wherein each spatial node of the binary space tree contains at least one of the units.
[0054] It's important to note that a binary space tree is a tree constructed by recursively dividing space into two subspaces. Each node in a binary space tree represents a subspace of the 3D model. During each partition, a plane cuts through the space corresponding to a node, generating child nodes for that node. The maximum level refers to the longest distance from the root node to the farthest leaf node when constructing the binary space tree; this is also the maximum depth of the binary space tree. The root node represents the entire 3D model.
[0055] As an optional implementation, the binary space tree is constructed starting from the root node based on the maximum level of the pre-set binary space tree. The root node can be determined based on the boundary of the space to be divided, which can be an axis-aligned bounding box (AABB) type bounding box, but is not limited to it. Then, the dividing plane is confirmed, which can be selected from the midpoint of the space. Thus, the binary space tree corresponding to the three-dimensional model is obtained.
[0056] For example, using the regular hexahedron mentioned above, first set the maximum level to 8 levels. Then, create a root node based on the space occupied by the entire regular hexahedron. Next, select a dividing plane, which can be a plane parallel to the x-axis, y-axis, or z-axis. Then, recursively divide the space according to the requirements to obtain a 3D model that meets the expected maximum level.
[0057] Step S300: Calculate the bounding box of each spatial node of the binary space tree, and filter out the sectional units in the unit according to the positive and negative states of the bounding box and the sectional.
[0058] It should be noted that the bounding box of an object is a closed space that completely encloses the object. As an optional embodiment, the bounding box of a 3D model is the smallest volume bounding box that can contain the 3D model; for example, it can be a cube or cuboid with the smallest volume. The bounding box can be used to determine whether it intersects with a certain spatial region. In a binary tree, the bounding box of a spatial node can be an axis-aligned bounding box, used to quickly determine whether the geometry may intersect with a specific region or object. Positive and negative states refer to the position of the bounding box relative to the sectional plane in this scheme; the intersection of the bounding box and the sectional plane is determined based on the position of the sectional plane.
[0059] As an optional implementation, the bounding box of the spatial node is obtained based on the divided spatial nodes. Any four vertices of the bounding box are selected, and the distances from the four vertices to the tangent are calculated. Then, the positive or negative state of the bounding box of the spatial node relative to the tangent is determined based on the distance, thereby determining whether the bounding box and the tangent intersect.
[0060] For example, in the binary space tree corresponding to a regular hexahedron, the bounding box of each spatial node is examined. The four vertices of the cross-section where the bounding box intersects with the cut surface are used as test samples. The location of each vertex on the cut surface is determined. If all four vertices are on the same side, it can be considered a positive or negative spatial state. For example, if all four vertices are on the side defined as positive, the state is positive; if all four vertices are on the side defined as negative, the state is negative. If the bounding box of a spatial node is positive or negative, further subdivision is unnecessary. If the four vertices are not all on the same side of the cut surface, the bounding box is considered to be in a cut state, requiring further subdivision. Positive and negative state checks are performed on the bounding boxes of the child nodes of this spatial node until the highest-level leaf node is reached.
[0061] Step S400: Perform cross-section calculation based on the cross-section unit, and output the cross-section model corresponding to the three-dimensional model.
[0062] It's important to note that section calculation refers to processing the acquired section elements to determine the intersection points, lines, or surfaces between the section elements and the sections, and then modifying the model accordingly. For example, section calculation might involve calculating the coordinates of intersection points, generating new geometric elements including cutting lines or surfaces, and updating the model's topology. The section model, based on the results of the section calculation, primarily displays the shape and structure after being cut by the sections.
[0063] As an alternative implementation, after selecting the sectional elements, geometric operations are performed on the sectional elements to determine the exact intersection points or lines between the sectional elements and the sectional surface. Then, the original element data is modified using these intersection lines, and a new three-dimensional model is constructed using the modified element data. Thus, a sectional model can be output.
[0064] For example, a regular hexahedron contains two cube model elements, with no restrictions on appearance. Then, the model elements are truncated, and the intersection lines between them and the truncated surfaces are calculated. The position of the intersection lines defines new cutting edges, thereby creating new cutting surfaces. Finally, the truncated surfaces are used to generate a cross-sectional view of the cut surfaces.
[0065] In this embodiment, basic units of the model are constructed by connecting point data in the 3D model. A binary space tree is then created based on this, and the space is divided according to a preset maximum level to ensure that each spatial node contains at least one unit. Then, based on the relative position of the bounding box and the cut surface of each node in the binary space tree, the positive or negative state or cutting state is determined, and potentially intersecting units, i.e., cut surface units, are identified. Finally, based on these cut surface units, a cut surface model corresponding to the original model is output, thus providing a fast and accurate 3D model cutting solution suitable for complex or large-scale 3D datasets.
[0066] Based on Embodiment 1, Embodiment 2 of this application provides a method for outputting the cross-section of a three-dimensional model, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of the method for outputting the cross-section of a 3D model according to this application. Step S100 includes steps A110 to A130:
[0067] Step A110: Obtain point data and the connection relationships between the point data;
[0068] Step A120: Determine the unit based on the connection relationship and the point data;
[0069] Step A130: Obtain the three-dimensional model based on the unit.
[0070] An alternative implementation first extracts point data from the model's data source, including the coordinates of each vertex in three-dimensional space. Next, the topological structure of the three-dimensional model is analyzed to obtain the connectivity relationships between the point data, such as how vertex combinations are defined to form higher-level geometric structures including edges, faces, or volumes. Based on these connectivity relationships, the units that constitute the model are determined, and finally, the complete three-dimensional model is constructed using these units.
[0071] For example, in a 3D house model, the coordinates of all the vertices that make up the house are first obtained, including the corners, windows, and door edges. These coordinates constitute point data. Next, the connections between these vertices are analyzed, such as which vertices make up the walls and which points define the window frames. This connection data is then used to determine the units of the house model, such as walls and roofs. Finally, these units are combined to construct a complete 3D house model.
[0072] In this embodiment, based on the point data of the 3D model, by analyzing the connection relationships between points, units with well-defined geometric shapes and topological structures are constructed. Based on the units and point data, a complete 3D model is constructed, ensuring the accuracy and integrity of the model.
[0073] Based on any of the above embodiments, Embodiment 3 of this application provides a method for outputting the cross-section of a three-dimensional model, referring to... Figure 3 , Figure 3 This is a flowchart illustrating the third embodiment of the method for outputting the cross-section of a 3D model according to this application. Step S200 includes steps A210 to A230:
[0074] Step A210: Generate the root node of a binary tree based on the bounding box of the 3D model.
[0075] It should be noted that the root node of the binary tree represents the bounding box space occupied by the entire 3D model.
[0076] An alternative implementation involves calculating the bounding box of the entire 3D model, which contains all elements of the 3D model.
[0077] Step A220: Determine the maximum level based on the number of units in the three-dimensional model.
[0078] It should be noted that before dividing the root node of the binary tree, it is necessary to determine the maximum level of the binary space tree, and then determine the depth of the binary space tree based on the maximum level, which determines the query time of traversal. Determining the maximum level of the binary tree requires comprehensive consideration of the number of leaf nodes and the depth of the binary space tree.
[0079] Further, step A220 includes: determining the maximum level based on the number of units and the expected number of units contained in a single spatial node, wherein the formula for calculating the maximum level is: maximum level = log2(number of units / expected number).
[0080] It should be noted that the expected number refers to the number of units that are expected to be included in each leaf node at the highest level. The mapping relationship refers to the relationship between the depth of the tree and the number of units in the leaf nodes. It can be understood that if the depth of the tree is greater, the number of units contained in each leaf node is less, but the corresponding tree construction and query time will increase; while if the depth of the tree is smaller, the number of units contained in each leaf node is more, but the query efficiency will decrease. At the same time, excessive partitioning will lead to an excessively large tree depth, increasing memory usage and query time.
[0081] As an optional implementation, the maximum level is calculated using the following formula:
[0082] Max_depth=log2(num_cells / target_cells_per_leaf)
[0083] Where Max_depth is the maximum depth, num_cells is the number of cells in the 3D model, and target_cells_per_leaf is the expected number of cells contained in a single spatial node.
[0084] Step A230: Generate a binary space tree with the maximum level based on the root node of the binary tree, such that each space node of the binary space tree contains at least one of the units.
[0085] It should be noted that after calculating the maximum level, the binary space tree is partitioned. This means that each partition creates a new node until the preset maximum level is reached or each leaf node contains at least one unit. These spatial nodes represent the partitioned spatial regions, not the partitioning plane itself. Each spatial node consists of leaf nodes and intermediate nodes, all associated with a partitioning plane. This plane defines the partitioning method. In a binary space tree, the partitioning plane divides the space into two parts: one part contains all faces that are located on or directly opposite the cutter (the front side); the other part contains all faces that are away from the cutter (the back side). Therefore, the partitioning method of the binary space tree is determined based on the front and back sides.
[0086] Furthermore, step A230 includes step A231:
[0087] A231, Based on the maximum level, the root node is divided into leaf nodes corresponding to the maximum level according to the hierarchical order of the binary space tree to generate the binary space tree.
[0088] It should be noted that the hierarchical order of the binary tree refers to the root node, intermediate nodes, and leaf nodes in a binary tree from top to bottom.
[0089] As an optional implementation, a binary space tree is generated starting from the root node. A recursive partitioning strategy is used according to the preset maximum level to determine the entire space represented by the root node. A suitable partitioning plane is selected to divide the space into two parts, forming two child nodes. The partitioning operation is repeated on the child nodes until the preset maximum level is reached. At this point, the space node is a leaf node, thus forming the binary space tree.
[0090] For example, in a regular hexahedron, the three-dimensional model of the regular hexahedron is the root node, and the maximum level is set to 4. First, a dividing plane is selected, which can be divided along an axisymmetric plane to obtain the child nodes of the two cubes corresponding to the regular hexahedron. Then, the division process is repeated for the child nodes until all leaf nodes reach the maximum level. In this example, that is, eight leaf nodes are obtained.
[0091] This embodiment determines the hierarchical relationship of the binary space tree, determines the traversal termination condition, and sequentially traverses and divides the root node to obtain a complete binary space tree, effectively organizing and dividing the space of the 3D model, and comprehensively considering the efficiency of space query and partitioning.
[0092] Based on any of the above embodiments, Embodiment 4 of this application proposes a method for outputting the cross-section of a three-dimensional model, referring to... Figure 4 Step S300 includes steps A310 to A340:
[0093] Step A310: Based on the hierarchical relationship of the binary space tree, traverse from the root node to the leaf node of the binary space tree to determine the distance between each vertex of the bounding box corresponding to the space node and the set tangent.
[0094] It should be noted that, in this embodiment, distance refers to the distance between the vertices of the bounding box and the tangent in three-dimensional space. The distance between each vertex of the bounding box and the tangent is determined by defining the plane equation of the tangent and obtaining the vertex positions of the bounding box.
[0095] The vertex is located on which side of the face by calculating the signed distance of the vertex relative to the face.
[0096] Furthermore, step A310 includes steps A311 to A313:
[0097] Step A311: Obtain the plane equation of the set cross-section.
[0098] It should be noted that the cut surface data is determined based on the position of the cut surface in three-dimensional space. It can be (x, y, z, n), where x, y, z are the cut surface coordinates and n is the cut surface normal direction.
[0099] Step A312: Determine the vertices of the bounding box of the spatial node.
[0100] It's important to note that in a binary tree, a bounding box is an axis-aligned AABB (Alternating Angles and Boundaries) bounding box consisting of eight vertices, each corresponding to one of the eight corners. While a standard AABB typically does indeed have eight vertices, when calculating relationships with planes, only four vertices need to be considered. This is because plane equations determine a point's position on a plane by its distance from the plane, and in 3D space, the four vertices of any quadrilateral (such as a face of a bounding box) are sufficient to determine which side of the plane it's on.
[0101] As an alternative implementation, four vertices of the bounding box corresponding to the spatial node are randomly selected, which may be the four vertices directly above the bounding box.
[0102] Step A313: Determine the distance from each vertex to the set tangent plane based on the coordinates of the vertex and the plane equation.
[0103] As an alternative implementation, when calculating the relationship with the tangent, only the four vertices of the bounding box need to be considered, and the signed distance from each vertex to the tangent can be calculated.
[0104] For example, based on the above section data, we define a plane consisting of a point p0(x0, y0, z0) and a normal vector n(a, b, c). Therefore, the equation of the section plane can be expressed as:
[0105] a(x-x0)+b(y-y0)+c(z-z0)=0.
[0106] Therefore, for any vertex p(x, y, z), the signed distance d from the point to the plane can be calculated by substituting the point's coordinates into the plane equation:
[0107] d=a(x-x0)+b(y-y0)+c(z-z0).
[0108] Step A320: Determine the positive or negative state of the bounding box of the spatial node based on the distance.
[0109] In an optional implementation, the distance from each vertex to the plane is analyzed to determine which side of the plane the vertex is located on, and the positive or negative state of the spatial node is determined, thereby determining whether the bounding box and the tangent intersect.
[0110] For example, according to the above formula for calculating the signed distance d, if d is greater than 0, then the vertex is in the positive space of the plane; if d is less than 0, then the vertex is in the negative space of the plane; if d is equal to 0, then the vertex is located on the plane.
[0111] Furthermore, step A320 includes steps A321 to A323:
[0112] Step A321: If all the distances are greater than zero, then the positive and negative states are determined to be positive spaces;
[0113] Step A322: If all the distances are less than zero, then the positive and negative states are determined to be negative space;
[0114] Step A323, otherwise, determine that the positive and negative states are cut states.
[0115] In an optional implementation, it is understood that if all four vertices of the bounding box are in positive space or negative space, the tangent is determined not to intersect with the space node, meaning that none of the child nodes below the level of the space node intersect with the tangent. Therefore, it is not necessary to continue traversing its subspaces. If there are both positive and negative spaces at the four vertices of the bounding box, the tangent is determined to intersect with the space node, and its subspaces are traversed.
[0116] For example, in the process of determining whether a tangent intersects with a spatial node, if one of the vertices belongs to the positive space and one of the other three vertices belongs to the negative space, then the tangent intersects with the spatial node, and it is necessary to further traverse the subspace of the spatial node.
[0117] Optionally, step B10 is included after step A320:
[0118] Step B10: If the spatial node belongs to the positive space or the negative space, stop traversing the spatial node.
[0119] It is understandable that if the spatial node belongs to the positive space or the negative space, that is, if all the vertices are located on the same side, it means that the spatial node has no intersection with the tangent. Therefore, the subspace traversal of the spatial node can be stopped.
[0120] For example, in the process of determining whether a tangent intersects with a spatial node, if all four vertices belong to positive space, then it is determined that the tangent does not intersect with the spatial node, and there is no need to further traverse the subspace of the spatial node.
[0121] Step A330: If the bounding box of the spatial node is in a slicing state and the spatial node is not a leaf node, then traverse the child nodes of the spatial node and execute the step of determining the distance between each vertex of the bounding box of the spatial node and the set slicing plane.
[0122] It should be noted that the cut state refers to the state in which a node in a given space needs to continue traversing its subspace when it is determined that the four vertices exist in different spaces.
[0123] Step A340: If the bounding box of the spatial node is in a slicing state and the spatial node is the leaf node, then the unit contained in the spatial node is determined to be the slicing unit.
[0124] In an optional implementation, after determining the state of intersection between a spatial node and a tangent, if the spatial node is in a cut state and is not a leaf node, then the child nodes of the spatial node are traversed to calculate the distance from each vertex of the child node to the tangent, and further determination is made until it is determined that the child node is a leaf node and is in a cut state, thereby determining the tangent unit corresponding to the leaf node.
[0125] For example, a 3D model representing a regular hexahedron is given, and its bounding box is determined. The maximum level is preset to 4. The 3D model is taken as the root node, and the axisymmetric face is taken as the tangent. When determining the intersection of the intermediate node at level 2 with the tangent, the four vertices of the intermediate node are not all located on the same side. Therefore, the intermediate node is in the cut state. Then, its child nodes need to be further traversed and determined until the leaf node is reached, and the tangent unit of the leaf node is determined.
[0126] As another optional implementation, if the spatial node is in a slicing state and the spatial node is a leaf node, that is, the maximum level of the binary space tree has been traversed, then the unit contained in the spatial node is determined to be the slicing unit.
[0127] For example, refer to Figure 5 , Figure 5 This is a flowchart illustrating the general embodiment of the method for outputting the cross-section of a 3D model according to this application:
[0128] First, after obtaining 3D model data, a root node of a binary space tree is created based on the bounding box of the 3D model. Simultaneously, the maximum level of the binary space tree is set according to the model complexity. Based on this, all units of the model are generated into a binary space tree. Units belonging to the binary space are spatially mapped, with each subspace containing a set of units belonging to it. Further, the model is segmented, setting the face data, face normal orientation, and coordinates (x, y, z, n). Then, the bounding boxes of the binary tree space nodes are recursively traversed to determine if the faces intersect. In one case, if all spatially intersecting nodes have been traversed, the set of cell IDs for the face is returned and the cells are processed. The section model result is obtained by traversing and calculating the section ID set. In another case, there are two feasible solutions. Solution 1: If not all spatially intersecting nodes have been traversed, the intersection of the section and the bounding box of the spatial node needs to be calculated. At the same time, if the section does not intersect with the spatial node, another spatial node is returned for intersection detection. Solution 2: If the section intersects with the binary spatial node and the spatial node is a leaf node, the Cell ID set is obtained and stored in the set required by the section. If the section intersects with the binary spatial node and the spatial node is not a leaf node, its child node space is traversed again until the bounding box of the binary tree spatial node has been recursively traversed to check whether the section intersects. The final Cell ID set is then returned to calculate the section model result.
[0129] In this embodiment, based on the hierarchical relationship of the binary space tree, the distance from each vertex of the space node to the tangent is calculated, and then it is further determined which side of the tangent each vertex is located on, thereby determining whether the space node and the tangent are in a cut state. Based on the cut state of the space node, the tangent unit of the space node is calculated, thereby obtaining the set of units that need to be calculated for the tangent among all units.
[0130] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the method of outputting the cross-section of the three-dimensional model of this application. Any simple transformations based on this technical concept are within the protection scope of this application.
[0131] This application embodiment also provides a 3D model section output device, the 3D model section output device comprising:
[0132] The model acquisition module is used to acquire a three-dimensional model based on unit representation, wherein the unit is formed by connecting point data in the three-dimensional model;
[0133] The section element determination module is used to determine the binary space tree corresponding to the three-dimensional model based on a set maximum level, wherein each spatial node of the binary space tree contains at least one of the elements; calculate the bounding box of each spatial node of the binary space tree, and filter out the section elements in the elements according to the positive and negative states of the bounding box and the section;
[0134] The output module is used to perform cross-section calculations based on the cross-section unit and output the cross-section model corresponding to the three-dimensional model.
[0135] Optionally, the model acquisition module is further configured to acquire point data and the connection relationships between the point data; determine the unit based on the connection relationships and the point data; and acquire the three-dimensional model based on the unit.
[0136] Optionally, the section unit determination module is further configured to generate a binary tree root node based on the bounding box of the three-dimensional model; determine the maximum level according to the number of units in the three-dimensional model; and generate a binary spatial tree with the maximum level based on the binary tree root node, so that each spatial node of the binary spatial tree contains at least one unit.
[0137] Optionally, the section unit judgment module is further configured to divide the root node down to the leaf node corresponding to the maximum level according to the hierarchical order of the binary space tree based on the maximum level, thereby generating the binary space tree.
[0138] Optionally, the slicing unit determination module is further configured to, based on the hierarchical relationship of the binary space tree, traverse from the root node to the leaf node of the binary space tree to determine the distance between each vertex of the bounding box corresponding to the space node and the set slicing unit; determine the positive or negative state of the bounding box of the space node according to the distance; if the bounding box of the space node is in a slicing state and the space node is not a leaf node, then traverse the child nodes of the space node and perform the step of determining the distance between each vertex of the bounding box corresponding to the space node and the set slicing unit; if the bounding box of the space node is in a slicing state and the space node is a leaf node, then determine that the unit contained in the space node is the slicing unit.
[0139] Optionally, the section unit judgment module is further configured to obtain the plane equation of the set section; determine the vertices of the bounding box of the spatial node; and determine the distance from each vertex to the set section based on the coordinates of the vertex and the plane equation.
[0140] Optionally, the slicing unit judgment module is further configured to determine the positive and negative states of the bounding box of the spatial node based on the distances. If all the distances are greater than zero, the positive and negative states are determined to be positive space; if all the distances are less than zero, the positive and negative states are determined to be negative space; otherwise, the positive and negative states are determined to be sliced states.
[0141] This application provides a 3D model section output device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the 3D model section output method in the above embodiment 1.
[0142] The following is for reference. Figure 6 This diagram illustrates a structural schematic of a cross-sectional output device suitable for implementing the three-dimensional model in the embodiments of this application. The cross-sectional output device for the three-dimensional model in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The 3D model section output device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0143] like Figure 6As shown, the 3D model's cross-section output device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the 3D model's cross-section output device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the 3D model's cross-sectional output device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows 3D model cross-sectional output devices with various systems, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.
[0144] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0145] The 3D model section output device provided in this application, employing the 3D model section output method in the above embodiments, can solve the technical problem of 3D model section output. Compared with the prior art, the beneficial effects of the 3D model section output device provided in this application are the same as the beneficial effects of the 3D model section output method provided in the above embodiments, and other technical features in this 3D model section output device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0146] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0147] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0148] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the method for outputting the cross-section of a three-dimensional model in the above embodiments.
[0149] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, 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 devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0150] The aforementioned computer-readable storage medium may be included in the 3D model's cross-sectional output device; or it may exist independently and not be assembled into the 3D model's cross-sectional output device.
[0151] The aforementioned computer-readable storage medium carries one or more programs that, when executed by a 3D model slicing output device, cause the 3D model slicing output device to: acquire a 3D model based on a unit representation, wherein the unit is formed by connecting several points in the 3D model; determine a binary space tree corresponding to the 3D model based on a set maximum level, wherein each spatial node of the binary space tree contains at least one of the units; filter out slicing units from the units according to the positive or negative state of the bounding boxes of each spatial node of the binary space tree; perform slicing calculations based on the slicing units, and output a slicing model corresponding to the 3D model.
[0152] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language 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).
[0153] 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 this application. 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.
[0154] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0155] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described method for outputting the cross-section of a 3D model, thereby solving the technical problem of outputting the cross-section of a 3D model. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the method for outputting the cross-section of a 3D model provided in the above embodiments, and will not be repeated here.
[0156] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method for outputting the cross-section of a three-dimensional model.
[0157] The computer program product provided in this application can solve the technical problem of outputting the cross-sections of a 3D model. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the 3D model cross-section output method provided in the above embodiments, and will not be repeated here.
[0158] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A method of sectioning a three-dimensional model, characterized by, The section output method of the three-dimensional model comprises: acquiring a three-dimensional model expressed based on cells, the cells being connected by point data in the three-dimensional model; determining a binary spatial tree corresponding to the three-dimensional model based on a set maximum level, each spatial node of the binary spatial tree containing at least one cell; calculating a bounding box of each spatial node of the binary spatial tree, and screening out a section cell from the cells according to a positive or negative state of the bounding box and a section; performing section calculation based on the section cell, and outputting a section model corresponding to the three-dimensional model; the step of determining the binary spatial tree corresponding to the three-dimensional model based on the set maximum level comprises: generating a binary tree root node based on a bounding box of the three-dimensional model; determining the maximum level according to a number of the cells in the three-dimensional model, wherein the following formula is used to calculate the maximum level: Max_depth=log2(num_cells / target_cells_per_leaf), Max_depth is the maximum level, num_cells is the number of the cells in the three-dimensional model, and target_cells_per_leaf is an expected number of the cells contained in a single spatial node; generating the binary spatial tree with the maximum level from the binary tree root node, so that each spatial node of the binary spatial tree contains at least one cell; the spatial nodes comprise a root node, a tree node, and a leaf node, and the step of calculating the bounding box of each spatial node of the binary spatial tree and screening out the section cell from the cells according to the positive or negative state of the bounding box and the section comprises: based on a hierarchical relationship of the binary spatial tree, traversing from the root node to a leaf node of the binary spatial tree to obtain a plane equation of a set section; randomly selecting four vertices of a bounding box corresponding to a spatial node; determining distances from the vertices to the set section according to coordinates of the vertices and the plane equation; determining the positive or negative state of the bounding box of the spatial node according to the distances; if the bounding box of the spatial node belongs to a sectioned state and the spatial node is not the leaf node, then traversing child nodes of the spatial node to perform the step of determining the distances from the vertices to the set section; if the bounding box of the spatial node belongs to the sectioned state and the spatial node is the leaf node, then determining that the cell contained in the spatial node is the section cell.
2. The cross section output method of a three-dimensional model according to Claim 1, wherein the step of acquiring the three-dimensional model expressed based on the cells comprises: acquiring point data and a connection relationship between the point data; determining the cells according to the connection relationship and the point data; acquiring the three-dimensional model based on the cells.
3. The cross section output method of a three-dimensional model according to Claim 1, wherein the step of generating the binary spatial tree with the maximum level from the binary tree root node comprises: based on the maximum level, splitting the root node according to a hierarchical order of the binary spatial tree until a leaf node corresponding to the maximum level, to generate the binary spatial tree.
4. The cross section output method of a three-dimensional model according to Claim 1, wherein The step of determining the positive-negative state of the bounding box of the spatial node according to the distances comprises any one of the following: If all the distances are greater than zero, the positive-negative state is determined as positive space; If all the distances are less than zero, the positive-negative state is determined as negative space; Otherwise, the positive-negative state is determined as a cut state.
5. An apparatus for section output of a three-dimensional model, characterized by comprising: The section output device of the three-dimensional model comprises: A model acquisition module configured to acquire a three-dimensional model expressed based on cells, the cells being connected by point data in the three-dimensional model; A section cell determination module configured to determine a binary spatial tree corresponding to the three-dimensional model based on a set maximum level, each spatial node of the binary spatial tree containing at least one cell; calculate a bounding box of each spatial node of the binary spatial tree; and filter out a section cell from the cells according to a positive-negative state of the bounding box and a section; the determination of the binary spatial tree corresponding to the three-dimensional model based on the set maximum level comprises: generating a binary tree root node based on a bounding box of the three-dimensional model; determining the maximum level according to a number of the cells in the three-dimensional model, wherein the maximum level is calculated using the following formula: Max_depth=log2(num_cells / target_cells_per_leaf), Max_depth being the maximum level, num_cells being the number of cells in the three-dimensional model, and target_cells_per_leaf being an expected number of the cells contained in a single spatial node; and generating the binary spatial tree with the maximum level from the binary tree root node, so that each spatial node of the binary spatial tree contains at least one cell; the spatial nodes comprise a root node, a tree node, and a leaf node; the calculation of the bounding box of each spatial node of the binary spatial tree and the filtering out of the section cell from the cells according to the positive-negative state of the bounding box and the section comprise: based on a hierarchical relationship of the binary spatial tree, traversing from the root node to a leaf node of the binary spatial tree to obtain a plane equation of a set section; randomly selecting four vertices of a bounding box corresponding to a spatial node; determining distances of the four vertices to the set section according to coordinates of the vertices and the plane equation; determining the positive-negative state of the bounding box of the spatial node according to the distances; if the bounding box of the spatial node belongs to a cut state and the spatial node is not the leaf node, traversing child nodes of the spatial node to perform the determination of the distances of the four vertices to the set section; if the bounding box of the spatial node belongs to the cut state and the spatial node is the leaf node, determining that the cell contained in the spatial node is the section cell; An output module configured to perform section calculation based on the section cell and output a section model corresponding to the three-dimensional model.
6. A section output device of a three-dimensional model, characterized by comprising: The section output device of the three-dimensional model comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the section output method of the three-dimensional model according to any one of claims 1 to 4.
7. A storage medium, characterized by The storage medium is a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the section output method of the three-dimensional model according to any one of claims 1 to 4.
Citation Information
Patent Citations
Three-dimensional pyramid construction method based on triangular patch number division
CN113468286A
Method and system for generating cut surface of three-dimensional grid model
CN117011490A