Three-dimensional model filling method, device, storage medium and electronic equipment

By performing multiple equal divisions on complex three-dimensional models, a set of fewer triangular face sheets is formed, and unnecessary triangular face sheets are filtered when calculating implicit field values, the problem of long filling of three-dimensional models in the prior art is solved, and a fast and accurate filling effect is achieved.

CN119579841BActive Publication Date: 2025-05-13ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510137842.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-07
Publication Date
2025-05-13
Estimated Expiration
2045-02-07

AI Technical Summary

Technical Problem

The prior art takes a long time and is prone to errors when building implicit fields and filling complex three-dimensional models, especially when the model is complex and the data is large, the existing tree structure division method leads to excessive calculation time.

Method used

By obtaining the triangular face position and axial length of the target three-dimensional model, multiple equal divisions are performed to form multiple triangular face sets with a small number of triangular faces, and filter unnecessary triangular face sets when calculating implicit field values, and only the smallest triangle face sets are retained for calculation.

Benefits of technology

This method significantly improves the calculation speed by spatially dividing and filtering unnecessary triangular faces, reducing the amount of data processed, and achieving fast and accurate three-dimensional model filling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579841B_ABST
    Figure CN119579841B_ABST
Patent Text Reader

Abstract

This specification discloses a three-dimensional model filling method, device, storage medium and electronic device. When the method is used to implement three-dimensional model filling, the target three-dimensional model can be evenly divided into multiple groups of triangular facet sets containing a small number of triangular facets according to the length of the target three-dimensional model in each axis direction through multiple divisions, and unnecessary triangular facet sets are filtered when calculating implicit field values, and only a minimum triangular facet set is retained for calculation to obtain the implicit field value and fill it. By dividing the three-dimensional model into spaces, the method does not need to traverse all the triangular facets, and can quickly eliminate unnecessary triangular facets in each calculation, and only a small number of triangular facets are calculated, which greatly improves the calculation speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a three-dimensional model filling method, device, storage medium and electronic device. Background Art

[0002] With the continuous development of three-dimensional (3D) printing technology, 3D printing technology is now being used more and more widely in all aspects of society and life. It has been widely used in aerospace technology, international space, electronics industry, automobile industry, housing construction and pharmaceutical preparation.

[0003] Printing a 3D model includes a series of intermediate preparation processes such as filling, simulating, adding supports, and slicing. Since complex 3D models contain a large number of triangles and vertices, it is time-consuming and difficult to fill them directly, which is prone to errors. Converting the 3D model to implicit field values ​​and filling them is relatively simple, and implicit field values ​​reduce the storage space of the 3D model, which has been widely studied in the industry.

[0004] However, existing implicit field construction methods, such as partitioning the grid model through Kd tree, BVH and other methods to extract the implicit field, speed up the calculation of the implicit field, but because each node of this type of tree has only two child nodes, when the model itself is more complex and contains a large amount of data, the number of division layers will also increase significantly, which takes a long time.

[0005] Therefore, how to simply and quickly construct implicit fields and fill three-dimensional models is an urgent problem to be solved. Summary of the invention

[0006] The present specification provides a three-dimensional model filling method, device, storage medium and electronic device to at least partially solve the above-mentioned problems existing in the prior art.

[0007] This manual adopts the following technical solutions:

[0008] This specification provides a three-dimensional model filling method, including:

[0009] Acquire a target three-dimensional model to be filled, and determine the position of each triangular facet included in the target three-dimensional model;

[0010] Determine the length of the target three-dimensional model in each axis according to the position of each triangular facet;

[0011] According to the length of the target three-dimensional model in each axis direction, the target three-dimensional model is divided, and the number of divisions is increased by one, wherein the initial value of the number of divisions is zero, and the division operation is to perform equal division for a specified number of times to obtain a specified number of triangular face sets;

[0012] In response to the number of divisions not reaching the preset number and each triangle face set contains at least two triangle face sets, performing the division operation on each obtained triangle face set, and increasing the number of divisions by one until the number of divisions reaches the preset number or any triangle face set obtained during the division process contains only one triangle face set, and determining each triangle face set obtained by performing the division operation for the last time as a minimum triangle face set;

[0013] For each preset point, determine a target minimum triangular patch set with the shortest distance to the preset point, and determine a distance field value between the preset point and the target three-dimensional model according to the target minimum triangular patch set;

[0014] The target three-dimensional model is filled according to the distance field value between each preset point and the target three-dimensional model.

[0015] Optionally, determining the position of each triangular facet included in the target three-dimensional model specifically includes:

[0016] The vertex coordinates of each triangular facet included in the three-dimensional model are determined as the position of the triangular facet, wherein each triangular facet includes three vertices.

[0017] Optionally, determining the length of the target three-dimensional model in each axis direction according to the position of each triangular facet specifically includes:

[0018] For each axial direction, the maximum coordinate value and the minimum coordinate value on the axial direction are determined in the vertex coordinates of each triangular facet, and the difference between the maximum coordinate value and the minimum coordinate value is determined as the length of the target three-dimensional model on the axial direction.

[0019] Optionally, all triangular facets included in the target three-dimensional model are a triangular facet set, and an initial value of the number of triangular facet sets is one;

[0020] The target three-dimensional model is divided into two parts, specifically comprising:

[0021] For each equal division, for each currently existing triangular face set, determine the axis with the longest length among the lengths of the triangular face set along each axis, and equally divide the triangular facets contained in the triangular face set along the axis with the longest length, and obtain two triangular face sets whose number of triangular facets differs by no more than one, until the specified number of equal divisions is completed and the specified number of triangular face sets are obtained.

[0022] Optionally, determining a target minimum triangular face set having the shortest distance to the preset point specifically includes:

[0023] For each triangular face set obtained by the first division operation, determine the triangular face set with the shortest distance to the preset point, and continue to determine the triangular face set with the shortest distance to the preset point in each triangular face set obtained by dividing the triangular face set, until the determined triangular face set is the minimum triangular face set, and the minimum triangular face set is determined as the target minimum triangular face set.

[0024] Optionally, determining the distance between the preset point and the triangular face set specifically includes:

[0025] For each triangular facet included in the triangular facet set, determining the centroid coordinates of the triangular facet according to the vertex coordinates of the triangular facet;

[0026] Determining the coordinates of the sphere center of the triangular face set according to the centroid coordinates of each triangular face included in the triangular face set;

[0027] Determine the vertex coordinates of each triangular facet included in the triangular facet set, which vertex coordinates are farthest from the sphere center coordinates, and determine the distance between the vertex coordinates farthest from the sphere center coordinates and the sphere center coordinates as the radius;

[0028] Constructing a spherical bounding box of the triangular facet set according to the spherical center coordinates and the radius;

[0029] The minimum distance between the preset point and the spherical surface of the spherical bounding box of the triangular face set is determined as the distance between the preset point and the triangular face set.

[0030] Optionally, determining the distance field value between the preset point and the target three-dimensional model according to the target minimum triangular facet set specifically includes:

[0031] Determine the target triangular facet in the target minimum triangular facet set that is closest to the preset point;

[0032] Determine the normal vector of the target triangle;

[0033] The distance field value between the preset point and the target three-dimensional model is determined according to the normal vector of the target triangular face and the distance between the preset point and the target triangular face.

[0034] This specification provides a three-dimensional model filling device, the device comprising:

[0035] An acquisition module, used for acquiring a target three-dimensional model to be filled, and determining the position of each triangular facet included in the target three-dimensional model;

[0036] A determination module, used to determine the length of the target three-dimensional model in each axial direction according to the position of each triangular facet;

[0037] A division module, used for dividing the target three-dimensional model according to the length of the three-dimensional model in each axis direction, and increasing the number of divisions by one, wherein the initial value of the number of divisions is zero, and the division operation is to perform equal division for a specified number of times to obtain a specified number of triangular face sets;

[0038] a loop module, configured to, in response to the number of divisions not reaching the preset number and each triangle face set containing at least two triangle face sets, perform the division operation on each obtained triangle face set, and increase the number of divisions by one until the number of divisions reaches the preset number or any triangle face set obtained by division contains only one triangle face set, and determine each triangle face set obtained by the last execution of the division operation as a minimum triangle face set;

[0039] A calculation module, used for determining, for each preset point, a target minimum triangular face set with the shortest distance to the preset point, and determining a distance field value between the preset point and the target three-dimensional model according to the target minimum triangular face set;

[0040] The filling module is used to fill the target three-dimensional model according to the distance field value between each preset point and the target three-dimensional model.

[0041] 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 three-dimensional model filling method is implemented.

[0042] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned three-dimensional model filling method when executing the program.

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

[0044] In the three-dimensional model filling method provided in the present specification, a target three-dimensional model to be filled is obtained, and the position of each triangular facet contained in the target three-dimensional model is determined; the length of the target three-dimensional model in each axial direction is determined according to the position of each triangular facet; according to the length of the target three-dimensional model in each axial direction, a division operation is performed on the target three-dimensional model, and the number of divisions is increased by one, wherein the initial value of the number of divisions is zero, and the division operation is performed by performing equal divisions for a specified number of times to obtain a specified number of triangular facet sets; in response to the number of divisions not reaching a preset number and each triangular facet set containing at least two or more triangles The method comprises the following steps: performing the division operation on each obtained triangular face set, and increasing the number of divisions by one, until the number of divisions reaches the preset number of times or any triangular face set obtained in the division process contains only one triangular face, and determining each triangular face set obtained by the last execution of the division operation as a minimum triangular face set; for each preset point, determining a target minimum triangular face set with the shortest distance to the preset point, and determining a distance field value between the preset point and the target three-dimensional model according to the target minimum triangular face set; and filling the target three-dimensional model according to the distance field value between each preset point and the target three-dimensional model.

[0045] When this method is used to fill a three-dimensional model, the target three-dimensional model can be evenly divided into multiple groups of triangle face sets with a small number of triangle face sets according to the length of the target three-dimensional model in each axis direction through multiple divisions, and unnecessary triangle face sets are filtered when calculating the implicit field value, and only a minimum triangle face set is retained for calculation to obtain the implicit field value and fill it. This method divides the three-dimensional model into spaces without traversing all the triangle face sets, and can quickly eliminate unnecessary triangle face sets in each calculation, and only a small number of triangle face sets are calculated, which greatly improves the calculation speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] 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 of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0047] Figure 1 A schematic diagram of a flow chart of a three-dimensional model filling method in this specification;

[0048] Figure 2 A schematic diagram of a three-dimensional model filling device provided in this specification;

[0049] Figure 3 The corresponding Figure 1 Schematic diagram of electronic equipment. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0051] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0052] Figure 1 The following is a flow chart of a three-dimensional model filling method in this specification, which specifically includes the following steps:

[0053] S100: Acquire a target three-dimensional model to be filled, and determine the position of each triangular facet included in the target three-dimensional model.

[0054] All steps in the three-dimensional model filling method provided in this specification can be implemented by any electronic device with computing functions, such as terminals, servers and other devices.

[0055] This method is mainly used to render 3D models in various 3D modeling software. Based on this, the target 3D model to be filled can be first obtained in this step. The target 3D model can be obtained through various types of 3D mesh data files input by the user in the 3D modeling software, including but not limited to ".stl", ".obj" and other types of files.

[0056] In 3D modeling software, triangular facets are generally used to form a three-dimensional model. Therefore, when the target three-dimensional model is obtained, the position of each triangular facet can also be obtained. In this method, all positions involved can be represented by three-dimensional coordinates in three-dimensional space. Among them, the 3D modeling software in three-dimensional space can give the three-dimensional coordinates of each point in three-dimensional space.

[0057] For a triangular face, its position can be represented by the vertex coordinates of the three vertices of the triangular face. Specifically, the vertex coordinates of each triangular face contained in the three-dimensional model can be determined as the position of the triangular face, wherein each triangular face contains three vertices. As the name implies, a triangular face is a triangular face, so as long as the vertex coordinates of the three vertices of the triangular face are determined, the position of the triangular face can be accurately locked.

[0058] S102: Determine the length of the target three-dimensional model in each axial direction according to the position of each triangular facet.

[0059] After determining the position of each triangle in the target 3D model, the length of the 3D model in each axis can be further determined based on the determined position of the triangle. There are three axes in the 3D space of the 3D modeling software, namely the X axis, the Y axis, and the Z axis, so the length of the target 3D model in the three axes can be determined in the end.

[0060] There are many methods for determining the axial length, and this specification introduces a specific embodiment for reference. Specifically, for each axial direction, the maximum coordinate value and the minimum coordinate value on the axial direction can be determined from the vertex coordinates of each triangular facet, and the difference between the maximum coordinate value and the minimum coordinate value can be determined as the length of the target three-dimensional model on the axial direction.

[0061] In this method, the coordinates of a point can be represented by (x, y, z). Taking the X-axis as an example, consider the coordinates of all vertices of all triangles at the same time, and find the largest x coordinate value x among all vertex coordinates in the X-axis direction. max and the minimum x coordinate value x min , the difference between the two, that is, (x max -x min ) as the length of the target 3D model along the X axis. Similarly, the same method is used to find the maximum y coordinate value y among all vertex coordinates. max and the minimum y coordinate value y min , and the maximum z coordinate value z max and the minimum z coordinate value z min , will (y max -y min ) is used as the length of the target 3D model in the Y axis, (z max -z min ) is used as the length of the target 3D model in the Z axis.

[0062] S104: dividing the target three-dimensional model according to the length of the target three-dimensional model in each axis direction, and increasing the number of divisions by one, wherein the initial value of the number of divisions is zero, and the division operation is to perform equal division a specified number of times to obtain a specified number of triangle face sets.

[0063] In this step, the target three-dimensional model can be divided according to the length of the target three-dimensional model in each axis direction determined in step S102. In this method, the significance of the division operation is to cut the target three-dimensional model, which is originally large in volume and contains more triangular facets, into a number of small volume units containing fewer triangular facets, and in the subsequent filling, the filling is changed from relying on the entire target three-dimensional model to relying on some small volume units, which greatly reduces the amount of data to be processed.

[0064] Since the division operation is actually the division of triangular facets, the objects to be divided can be determined by the triangular facet set. When no division is performed, all triangular facets contained in the initial target 3D model can be determined as a triangular facet set, and the initial number of triangular facet sets is set to 1.

[0065] In this method, each division operation performed on a triangle face set will divide the triangle face set into several smaller ones, that is, triangle face sets containing fewer triangle facets, through several equal divisions. Each equal division operation doubles the number of currently existing triangle face sets, and the number of triangle face sets contained in each triangle face set is halved. For example, if a triangle face set containing 800 triangle facets is divided once, two triangle face sets containing 400 triangle facets will be obtained; if it is divided again on this basis, four triangle face sets containing 200 triangle facets will be obtained; if it is divided again on this basis, eight triangle face sets containing 100 triangle facets will be obtained... and so on. The specific method of equal division and the number of smaller triangle face sets finally obtained can be set according to specific needs, and this manual does not impose specific restrictions on this.

[0066] This specification provides a specific embodiment of dividing a triangular face set for reference. In this embodiment, specifically, for each equal division, for each currently existing triangular face set, the axis where the longest length of the triangular face set is located is determined, and the triangular face sets included in the triangular face set are equally divided along the axis where the longest length is located, to obtain two triangular face sets whose number of triangular face sets differs by no more than one, until the specified number of equal divisions is completed and the specified number of triangular face sets are obtained.

[0067] In this method, the target three-dimensional model is divided according to the length of the target three-dimensional model in each axis determined in step S102. During the division process, a specified number of equal divisions will be performed, and each equal division will be performed along the longest axis among the currently existing triangular face sets. During the equal division, a surface perpendicular to the longest axis will be used to divide the equally divided triangular face set into two at an appropriate position, so that the triangular face sets obtained in the two triangular face sets are the same (or differ by 1). Since each equal division in a division process will divide all the currently existing triangular face sets in the divided area into two parts, each equal division will double the number of triangular face sets existing in this area. It is not difficult to imagine that the relationship between the specified number of times t and the specified number n should be n=2 t Among them, the specified times and the specified quantity can be set according to specific needs. Generally, the specified times can be set to 3 and the specified quantity can be set to 8 to construct an octree-type partition.

[0068] Taking octree partitioning as an example, in a specific embodiment, assuming that the specified number is 3 and the specified number is 8, the divided triangle face set A contains 800 triangle face sets. In this partition, 3 equal divisions will be performed, and 8 triangle face sets will be obtained in the end. In the first equal division, assuming that the longest axis of the divided triangle face set A is the X axis, then the triangle face set A will be cut into two parts from the X axis through a plane perpendicular to the X axis, that is, a plane parallel to the surface YOZ, to obtain triangle face set B and triangle face set C, each containing 400 triangle face sets. It should be noted that since the triangle face sets are not necessarily evenly distributed in three-dimensional space, the position selection for each division is based only on whether the difference in the number of triangle face sets contained on both sides after the division is not greater than 1, and has nothing to do with the length of the triangle face set itself. The second equal division will operate on triangle face set B and triangle face set C respectively. At this time, the longest axis of triangle face set B and triangle face set C may not be the same. Assuming that the longest axis of triangle face set B is the Y axis, then the face perpendicular to the Y axis, that is, parallel to plane XOZ, will be used to split triangle face set B, and triangle face set D and triangle face set E, each containing 200 triangle face pieces; similarly, assuming that the longest axis of triangle face set C is still the X axis, then the plane parallel to plane YOZ can still be used to split triangle face set C from the X axis, and triangle face set F and triangle face set G, each containing 200 triangle face pieces, are obtained, completing the second equal division. For the third equal division, according to the above rules, triangle face set D, triangle face set E, triangle face set F, and triangle face set G are split respectively, and 8 triangle face sets, each containing 100 triangle face pieces, are obtained, completing the third equal division, and at the same time completing the division of triangle face set A this time.

[0069] It should be emphasized that the division operation of the triangle face set in this specification is several equal divisions, that is, the difference in the number of triangle face sets obtained after each equal division should be kept within a range of no more than 1. If a triangle face set containing 403 triangle face sets is divided into 8 smaller triangle face sets, then the two triangle face sets obtained by the first equal division contain 201 and 202 triangle face sets respectively; one of the four triangle face sets obtained by the second equal division contains 100 triangle face sets, and three contain 101 triangle face sets; among the eight triangle face sets obtained by the third equal division, five of the triangle face sets contain 50 triangle face sets, and the remaining three triangle face sets contain 51 triangle face sets.

[0070] S106: In response to the fact that the number of divisions has not reached the preset number and each triangular face set contains at least two triangular face sets, the division operation is performed on each triangular face set obtained, and the number of divisions is increased by one until the number of divisions reaches the preset number or any triangular face set obtained during the division process contains only one triangular face, and each triangular face set obtained by the last execution of the division operation is determined as the minimum triangular face set.

[0071] In this method, the division operation does not necessarily only execute once in step S104. It is not difficult to imagine that for a large and complex large-volume three-dimensional model, a large number of equal division operations are required to divide it into a number of sufficiently small triangular facet sets. In this specification, this purpose is achieved by performing multiple division operations. Compared with adding too many equal division operations in one division, repeatedly performing multiple division operations can more effectively divide the target three-dimensional model into multiple different areas, greatly reducing the amount of data that needs to be calculated later.

[0072] Based on the above idea, the maximum number of divisions, that is, the preset number, can be set in advance. In this method, there are two judgment conditions for stopping the division operation. One is that the number of divisions that have been executed has reached the preset number; the other is that a triangle face set containing only one triangle face appeared during the last division. As long as any one of the above two judgment conditions is met, the division will be terminated and subsequent steps will be executed. It should be noted that the timing of the appearance of a triangle face set containing only one triangle face may be after a certain equal division in the division process. At this time, the subsequent equal division will be abandoned and the division will be terminated. After completing all division operations, all triangle face sets existing in the three-dimensional space are called minimum triangle face sets in this method.

[0073] The preset number of times can also be set according to specific needs. For example, the number of divisions can be regarded as the depth of the tree, and the final triangle face set is terminated when there is a triangle face set containing only one triangle face, and the preset number of times is determined by the tree depth formula. For example, assuming that the number of triangle faces is 3888, if it is divided in the form of an octree with a specified number of 3 and a specified number of 8, then the tree depth can be calculated to be 4, that is, the preset number is 4.

[0074] Each time a division operation is performed, it will be performed on all currently existing triangle face sets at the same time. The division operation will divide the divided triangle face set into a specified number of triangle face sets. The specific method of the division operation has been described in detail in step S104 and will not be repeated here. For example, assuming that the division rule is performed in the form of an octree, the preset number of times is 3, then when no division is performed at the beginning, there is only 1 triangle face set, that is, the target three-dimensional model itself; after 1 division, there are 8 triangle face sets; after 2 divisions, there are 64 triangle face sets; after 3 divisions, there are 512 triangle face sets. At this time, these 512 triangle face sets are all minimum triangle face sets.

[0075] S108: For each preset point, determine a target minimum triangular patch set with the shortest distance to the preset point, and determine a distance field value between the preset point and the target three-dimensional model according to the target minimum triangular patch set.

[0076] After all the division operations are completed in step S108, the implicit field value of the target three-dimensional model can be calculated in this step. In this method, the implicit field value is expressed by the distance field value. When calculating the distance field value, it is necessary to pre-set a number of preset points. The function of the preset points is to determine the positional relationship between the points in at least part of the area in the three-dimensional space and the target three-dimensional model by determining the distance field value between itself and the target three-dimensional model, and then determine the filling method of these points. The preset points can be set according to custom rules or randomly, and this manual does not make specific restrictions on this.

[0077] Based on the above idea, for each preset point, the shortest minimum triangle patch set with the shortest distance to the preset point can be found in each minimum triangle patch set. Generally, the distance between the preset point and each minimum triangle patch set can be directly calculated, and the minimum triangle patch set with the shortest distance can be selected.

[0078] Additionally, in order to further reduce the amount of data that needs to be calculated, when determining the minimum triangular face set with the shortest distance to a preset point in the present method, it is possible to specifically determine the triangular face set with the shortest distance to the preset point for each triangular face set obtained by the first division operation, and continue to determine the triangular face set with the shortest distance to the preset point in each triangular face set obtained by dividing the triangular face set, until the determined triangular face set is the minimum triangular face set, and the minimum triangular face set is determined as the target minimum triangular face set.

[0079] Compared with calculating the distance between the preset point and each minimum triangle patch set, in the above method, the distance between the larger triangle patch set nested in the outer layer and the preset point is calculated layer by layer, and only the triangle patch set with the smallest distance is retained, and other triangle patch sets are filtered out, and the same method is continued under the retained triangle patch set until the retained triangle patch set itself is the minimum triangle patch set, thereby quickly finding the triangle patch set with the minimum distance from the preset point. For example, suppose that 512 minimum triangle patch sets are obtained through 3 octree divisions. Then, in the process of finding the triangular face set with the shortest distance to the preset point, we only need to calculate the distance between the 8 triangular face sets obtained by the first division and the preset point, and retain the triangular face set with the shortest distance; then calculate the distance between the 8 triangular face sets obtained by the second division of the retained triangular face set and the preset point, and also retain the triangular face set with the shortest distance; finally, calculate the distance between the 8 minimum triangular face sets obtained by the third division of the retained triangular face set and the preset point, and select the minimum triangular face set with the shortest distance as the target minimum triangular face set. Compared with the 512 calculations required to directly calculate the distance between the preset point and the 512 minimum triangular face sets, the above method only requires calculating the distance between the triangular face sets and the preset point 24 times (8+8+8), which significantly reduces the required calculation amount.

[0080] There are many ways to determine the distance between a preset point and a triangular face set, and this specification provides a specific embodiment for reference. Specifically, for each triangular face included in the triangular face set, the centroid coordinates of the triangular face can be determined according to the vertex coordinates of the triangular face; the sphere center coordinates of the triangular face set can be determined according to the centroid coordinates of each triangular face included in the triangular face set; the vertex coordinates of each triangular face included in the triangular face set that are farthest from the sphere center coordinates are determined, and the distance between the vertex coordinates farthest from the sphere center coordinates and the sphere center coordinates is determined as the radius; the spherical bounding box of the triangular face set is constructed according to the sphere center coordinates and the radius; the minimum distance between the preset point and the spherical surface of the spherical bounding box of the triangular face set is determined as the distance between the preset point and the triangular face set.

[0081] In most cases, the distribution of triangles in each triangle set is irregular and cannot form a regular shape. Therefore, when determining the distance between a preset point and the triangle set in this method, the calculation of the irregular distance is converted into the calculation of the distance between the point and a regular sphere by pre-designing a spherical bounding box.

[0082] Based on this, when determining the distance between a preset point and a triangular face set, the spherical bounding box of the triangular face set can be constructed first. The spherical bounding box can actually be regarded as a hollow sphere, so the construction method is the same as that of constructing a sphere, and the center and radius of the spherical bounding box need to be determined. Among them, the method for determining the center of the sphere can be determined according to the position of each triangular face contained in this triangular face set. Specifically, the center of mass of each triangular face can be determined first using the three vertex coordinates of each triangular face. For example, assuming that the three vertex coordinates of a triangular face are (x1, y1, z1), (x2, y2, z2), and (x3, y3, z3). Then the center of mass of the triangular face , that is, the coordinate values ​​of the three vertices are averaged.

[0083] After determining the centroid of each triangle, the average value of the centroids of the triangles in the triangle set can be determined as the sphere center s of the triangle set. mean , the formula is as follows:

[0084]

[0085] Among them, s mean Represents the center of the triangle set, m represents the number of triangles in the triangle set, and n represents the nth triangle.

[0086] After determining the center of the spherical bounding box of the triangle face set, it is also necessary to determine the radius of the spherical bounding box. In order to ensure that the spherical bounding box can enclose all the triangle face sets, this method considers the distance from the determined center to the vertex coordinates of each triangle face set, and determines the longest distance as the radius, so that the spherical bounding box can cover all the triangle face sets.

[0087] After the spherical bounding box is constructed based on the determined sphere center and radius, the shortest distance between the spherical surface of the spherical bounding box and the preset point is determined as the distance between the preset point and the triangular facet set to which the spherical bounding box belongs.

[0088] By adopting the above method, the distance between the preset point and any triangle patch set can be determined, and finally the target minimum triangle patch set with the shortest distance to the preset point can be found. According to the determined target minimum triangle patch set, the distance field value between the preset point and the target three-dimensional model can be determined.

[0089] When determining the distance field value, specifically, the target triangular facet in the target minimum triangular facet set that is closest to the preset point is determined; the normal vector of the target triangular facet is determined; and the distance field value between the preset point and the target three-dimensional model is determined based on the normal vector of the target triangular facet and the distance between the preset point and the target triangular facet.

[0090] First, the target triangle with the shortest distance to the preset point can be found in the target minimum triangle set. In this method, there are also multiple ways to determine the distance between the preset point and a triangle. For example, the distance between the preset point and all points on the triangle can be directly calculated, and the shortest distance can be determined as the distance between the preset point and the triangle.

[0091] After determining the target triangle with the shortest distance to the preset point in the target minimum triangle set, the normal vector of this target triangle can be further determined, denoted as f n At this point, the distance field value between the preset point and the target 3D model can be determined based on the determined normal vector and the distance between the preset point and the target triangle patch. The specific formula is as follows:

[0092]

[0093] Among them, d s Represents the distance field value, p s Indicates the position of the preset point, c s Indicates the position of the point on the target triangle with the shortest distance to the preset point, f n represents the normal vector of the target triangle; sign is the sign function. The above formula means that the signed distance (p s -c s ) and the normal vector of the target triangle, and obtain d according to the positive and negative attributes of the dot product calculation result. s The final value of . When the dot product calculation result is greater than 0, d s The value of d is 1; when the dot product calculation result is less than 0, s The value of d is -1; when the dot product is equal to 0, s The value of is 0.

[0094] Applying the above mathematical formula to three-dimensional space, the distance field value d s The value of represents the positional relationship between the preset point and the target 3D model. s is 1, indicating that the preset point is outside the target 3D model; when d s When d is -1, it indicates that the preset point is inside the target 3D model; s When it is 0, it indicates that the preset point is on the surface of the target 3D model.

[0095] It should be noted that the above process only introduces a method for calculating the distance field value between a preset point and the target three-dimensional model. In actual application, there will be multiple preset points, and each preset point can determine the distance field value between it and the target three-dimensional model in the above method.

[0096] S110: Filling the target three-dimensional model according to the distance field value between each preset point and the target three-dimensional model.

[0097] According to the distance field value determined in step S108, the positional relationship between each point in the three-dimensional space and the target three-dimensional model is further obtained, and the filling of the target three-dimensional model can be completed.

[0098] When this method is used to fill a three-dimensional model, the target three-dimensional model can be evenly divided into multiple groups of triangle face sets with a small number of triangle face sets according to the length of the target three-dimensional model in each axis direction through multiple divisions, and unnecessary triangle face sets are filtered when calculating the implicit field value, and only a minimum triangle face set is retained for calculation to obtain the implicit field value and fill it. This method divides the three-dimensional model into spaces without traversing all the triangle face sets, and can quickly eliminate unnecessary triangle face sets in each calculation, and only a small number of triangle face sets are calculated, which greatly improves the calculation speed.

[0099] The above is the three-dimensional model filling method provided in this specification. Based on the same idea, this specification also provides a corresponding three-dimensional model filling device, such as Figure 2 shown.

[0100] Figure 2 A schematic diagram of a three-dimensional model filling device provided in this specification specifically includes:

[0101] An acquisition module 200 is used to acquire a target three-dimensional model to be filled and determine the position of each triangular facet included in the target three-dimensional model;

[0102] A determination module 202 is used to determine the length of the target three-dimensional model in each axis according to the position of each triangular facet;

[0103] A division module 204 is used to divide the target three-dimensional model according to the length of the three-dimensional model in each axis direction, and increase the number of divisions by one, wherein the initial value of the number of divisions is zero, and the division operation is to divide the target three-dimensional model evenly for a specified number of times to obtain a specified number of triangle face sets;

[0104] A loop module 206 is configured to, in response to the number of divisions not reaching the preset number and each triangle face set contains at least two triangle face sets, perform the division operation on each obtained triangle face set, and increase the number of divisions by one until the number of divisions reaches the preset number or any triangle face set obtained by division contains only one triangle face set, and determine each triangle face set obtained by the last execution of the division operation as a minimum triangle face set;

[0105] A calculation module 208 is used to determine, for each preset point, a target minimum triangular patch set with the shortest distance to the preset point, and determine a distance field value between the preset point and the target three-dimensional model according to the target minimum triangular patch set;

[0106] The filling module 210 is used to fill the target three-dimensional model according to the distance field value between each preset point and the target three-dimensional model.

[0107] Optionally, the acquisition module 200 is specifically used to determine the vertex coordinates of each triangular facet included in the three-dimensional model as the position of the triangular facet, wherein each triangular facet includes three vertices.

[0108] Optionally, the determination module 202 is specifically used to determine, for each axial direction, the maximum coordinate value and the minimum coordinate value in the vertex coordinates of each triangular facet on the axial direction, and determine the difference between the maximum coordinate value and the minimum coordinate value as the length of the target three-dimensional model on the axial direction.

[0109] Optionally, all triangular facets included in the target three-dimensional model are a triangular facet set, and an initial value of the number of triangular facet sets is one;

[0110] The division module 204 is specifically used to determine, for each equal division, for each currently existing triangular face set, the axial direction on which the longest length of the triangular face set is located, and equally divide the triangular face sets contained in the triangular face set along the axial direction on which the longest length is located, to obtain two triangular face sets whose number of triangular face sets differs by no more than one, until a specified number of equal divisions are completed and a specified number of triangular face sets are obtained.

[0111] Optionally, the calculation module 208 is specifically used to determine the triangular patch set with the shortest distance to the preset point for each triangular patch set obtained by the first division operation, and continue to determine the triangular patch set with the shortest distance to the preset point in each triangular patch set obtained by dividing the triangular patch set, until the determined triangular patch set is the minimum triangular patch set, and the minimum triangular patch set is determined as the target minimum triangular patch set.

[0112] Optionally, the calculation module 208 is specifically used to determine the centroid coordinates of each triangular facet included in the triangular facet set according to the vertex coordinates of the triangular facet; determine the center coordinates of the sphere of the triangular facet set according to the center coordinates of each triangular facet included in the triangular facet set; determine the vertex coordinates of each triangular facet included in the triangular facet set that are farthest from the center coordinates of the sphere, and determine the distance between the vertex coordinates farthest from the center coordinates of the sphere and the center coordinates of the sphere as the radius; construct a spherical bounding box of the triangular facet set according to the center coordinates of the sphere and the radius; determine the minimum distance between the preset point and the spherical surface of the spherical bounding box of the triangular facet set as the distance between the preset point and the triangular facet set.

[0113] Optionally, the calculation module 208 is specifically used to determine the target triangular facet in the target minimum triangular facet set that is closest to the preset point; determine the normal vector of the target triangular facet; and determine the distance field value between the preset point and the target three-dimensional model based on the normal vector of the target triangular facet and the distance between the preset point and the target triangular facet.

[0114] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 Provides a method for filling three-dimensional models.

[0115] This manual also provides Figure 3 The schematic structure diagram of the electronic device shown in FIG. Figure 3 As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0116] For the improvement of a technology, it can be clearly distinguished whether it is a hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or a software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow 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 logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). 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 are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0117] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0118] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may 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 a combination of any of these devices.

[0119] For the convenience of description, the above device is described in 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.

[0120] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt 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 codes.

[0121] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0122] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0123] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0124] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

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

[0126] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0127] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0128] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may 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.

[0129] This specification may 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 may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0130] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0131] The above description is only an embodiment of this specification and is not intended to limit this specification. For those skilled in the art, this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification should be included in the scope of the claims of this application.

Claims

1. A three-dimensional model filling method, characterized in that: include: Acquire a target three-dimensional model to be filled, and determine the position of each triangular facet included in the target three-dimensional model; Determine the length of the target three-dimensional model in each axis according to the position of each triangular facet; According to the length of the target three-dimensional model in each axis direction, the target three-dimensional model is divided, and the number of divisions is increased by one, wherein the initial value of the number of divisions is zero, and the division operation is to perform equal division for a specified number of times to obtain a specified number of triangular face sets; In response to the number of divisions not reaching the preset number and each triangle face set contains at least two triangle face sets, performing the division operation on each obtained triangle face set, and increasing the number of divisions by one until the number of divisions reaches the preset number or any triangle face set obtained during the division process contains only one triangle face set, and determining each triangle face set obtained by performing the division operation for the last time as a minimum triangle face set; For each preset point, determine a target minimum triangular patch set with the shortest distance to the preset point, and determine a distance field value between the preset point and the target three-dimensional model according to the target minimum triangular patch set; Filling the target three-dimensional model according to the distance field value between each preset point and the target three-dimensional model; Wherein, all the triangular facets contained in the target three-dimensional model are a triangular facet set, and the initial value of the number of triangular facet sets is one; The target three-dimensional model is divided into two parts, specifically comprising: For each equal division, for each currently existing triangle face set, determine the axis where the longest length of the triangle face set is located, and equally divide the triangles contained in the triangle face set along the axis where the longest length is located, and obtain two triangle face sets whose number of triangles differs by no more than one, until the specified number of equal divisions is completed and the specified number of triangle face sets are obtained; Determine the target minimum triangular face set with the shortest distance to the preset point, including: For each triangular face set obtained by the first division operation, determine the triangular face set with the shortest distance to the preset point, and continue to determine the triangular face set with the shortest distance to the preset point in each triangular face set obtained by dividing the triangular face set, until the determined triangular face set is the minimum triangular face set, and the minimum triangular face set is determined as the target minimum triangular face set.

2. The method according to claim 1, characterized in that Determining the position of each triangular facet included in the target three-dimensional model specifically includes: The vertex coordinates of each triangular facet included in the three-dimensional model are determined as the position of the triangular facet, wherein each triangular facet includes three vertices.

3. The method according to claim 2, characterized in that Determining the length of the target three-dimensional model in each axis according to the position of each triangular facet specifically includes: For each axial direction, the maximum coordinate value and the minimum coordinate value on the axial direction are determined in the vertex coordinates of each triangular facet, and the difference between the maximum coordinate value and the minimum coordinate value is determined as the length of the target three-dimensional model on the axial direction.

4. The method of claim 1, wherein determining the distance between the preset point and the triangular face set comprises: For each triangular facet included in the triangular facet set, determining the centroid coordinates of the triangular facet according to the vertex coordinates of the triangular facet; Determining the coordinates of the sphere center of the triangular face set according to the centroid coordinates of each triangular face included in the triangular face set; Determine the vertex coordinates of each triangular facet included in the triangular facet set, which vertex coordinates are farthest from the sphere center coordinates, and determine the distance between the vertex coordinates farthest from the sphere center coordinates and the sphere center coordinates as the radius; Constructing a spherical bounding box of the triangular facet set according to the spherical center coordinates and the radius; The minimum distance between the preset point and the spherical surface of the spherical bounding box of the triangular face set is determined as the distance between the preset point and the triangular face set.

5. The method according to claim 1, characterized in that Determining the distance field value between the preset point and the target three-dimensional model according to the target minimum triangular face set specifically includes: Determine the target triangular facet in the target minimum triangular facet set that is closest to the preset point; Determining a normal vector of the target triangle; The distance field value between the preset point and the target three-dimensional model is determined according to the normal vector of the target triangular face and the distance between the preset point and the target triangular face.

6. A three-dimensional model filling device, characterized in that: include: An acquisition module, used for acquiring a target three-dimensional model to be filled, and determining the position of each triangular facet included in the target three-dimensional model; A determination module, used to determine the length of the target three-dimensional model in each axial direction according to the position of each triangular facet; A division module, used for dividing the target three-dimensional model according to the length of the three-dimensional model in each axis direction, and increasing the number of divisions by one, wherein the initial value of the number of divisions is zero, and the division operation is to perform equal division for a specified number of times to obtain a specified number of triangular face sets; a loop module, configured to, in response to the number of divisions not reaching the preset number and each triangle face set containing at least two triangle face sets, perform the division operation on each obtained triangle face set, and increase the number of divisions by one until the number of divisions reaches the preset number or any triangle face set obtained by division contains only one triangle face set, and determine each triangle face set obtained by the last execution of the division operation as a minimum triangle face set; A calculation module, used for determining, for each preset point, a target minimum triangular face set with the shortest distance to the preset point, and determining a distance field value between the preset point and the target three-dimensional model according to the target minimum triangular face set; A filling module, used to fill the target three-dimensional model according to the distance field value between each preset point and the target three-dimensional model; Wherein, all the triangular facets contained in the target three-dimensional model are a triangular facet set, and the initial value of the number of triangular facet sets is one; The division module is specifically used to determine, for each equal division, for each currently existing triangular face set, the axial direction where the longest length of the triangular face set is located, and equally divide the triangular face sets included in the triangular face set along the axial direction where the longest length is located, to obtain two triangular face sets whose number of triangular face sets differs by no more than one, until a specified number of equal divisions are completed and a specified number of triangular face sets are obtained; The calculation module is specifically used to determine the triangular face set with the shortest distance to the preset point for each triangular face set obtained by the first division operation, and continue to determine the triangular face set with the shortest distance to the preset point among the triangular face sets obtained by dividing the triangular face set, until the determined triangular face set is the minimum triangular face set, and the minimum triangular face set is determined as the target minimum triangular face set.

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 geometric model surface element space division and BVH tree construction method based on Morton codes

    CN116310108A

  • Object three-dimensional structure modeling method and device and storage medium

    CN117934762A