Disclosure of Invention
The present disclosure provides a three-dimensional model generating method and apparatus based on a porous structure, and an electronic device, so as to partially solve the above-mentioned problems in the prior art.
The technical scheme adopted in the specification is as follows:
The specification provides a three-dimensional model generation method based on a porous structure, which comprises the following steps:
Obtaining porous array data, cell model data and cell size data corresponding to a target three-dimensional model to be constructed, wherein the cell model corresponding to the cell model data is basic cells for constructing the target three-dimensional model, the porous array data is used for representing the arrangement mode of the cell model corresponding to the cell model data in the target three-dimensional model, the cell size data is used for representing the shape and occupied size of the cell model corresponding to the cell model data in the target three-dimensional model, the cell model data is tree structure data and is used for representing the internal space structure of the cell model corresponding to the cell model data based on the tree structure data, the tree structure data comprises a sub-node list of the non-leaf node and a Boolean operation type of the sub-node of the non-leaf node in the cell model data, the node data of the leaf node comprises the leaf node corresponding to the sub-node and a basic model structure model, and the basic model structure comprises at least a rectangular bar structure model and a basic model structure;
Constructing the cell model according to the cell model data and the cell size data;
and constructing the target three-dimensional model according to the porous array data and the cell model.
Optionally, the constructing the cell model according to the cell model data and the cell size data specifically includes:
determining a basic model construction rule corresponding to each leaf node in the cell model data, and generating a basic three-dimensional model corresponding to the leaf node according to the basic model construction rule, basic model parameters and the cell size data corresponding to the leaf node, wherein the basic model construction rule is used for determining the shape and the boundary of the basic three-dimensional model corresponding to the leaf node according to the basic model parameters corresponding to the leaf node;
And constructing the cell model according to the node data of each non-leaf node in the cell model data and the basic three-dimensional model corresponding to each leaf node.
Optionally, the constructing the cell model according to the node data of each non-leaf node in the cell model data and the basic three-dimensional model corresponding to each leaf node specifically includes:
Determining a combined three-dimensional model corresponding to each non-leaf node except the root node according to the node data of each non-leaf node except the root node in the cell model data and the basic three-dimensional model corresponding to each leaf node;
and determining a combined three-dimensional model corresponding to the root node according to node data corresponding to the root node in the cell model data and the three-dimensional model corresponding to the child node of the root node, and taking the combined three-dimensional model corresponding to the root node as the cell model.
Optionally, each non-leaf node except the root node in the cell model data includes a first type node, the relative node depth of the child node corresponding to the first type node is 1, and for each child node in the cell model data, the relative node depth of the child node is used for indicating the node level distance between the leaf node in the branch where the child node is located and the parent node of the child node;
According to the node data of each non-leaf node except the root node in the cell model data and the basic three-dimensional model corresponding to each leaf node, determining the combined three-dimensional model corresponding to each non-leaf node except the root node specifically comprises the following steps:
and aiming at each first type node in the cell model data, carrying out Boolean operation processing on the basic three-dimensional model corresponding to each child node of the first type node according to the basic three-dimensional model corresponding to each child node of the first type node and the Boolean operation type corresponding to the first type node to obtain a combined three-dimensional model corresponding to the first type node.
Optionally, each non-leaf node except the root node in the cell model data further includes a second type node, and the relative node depth non-uniformity of the child nodes corresponding to the second type node is 1;
According to the node data of each non-leaf node except the root node in the cell model data and the basic three-dimensional model corresponding to each leaf node, determining the combined three-dimensional model corresponding to each non-leaf node except the root node specifically comprises the following steps:
and aiming at each second type node in the cell model data, carrying out Boolean operation processing on the three-dimensional model corresponding to each sub-node of the second type node according to the three-dimensional model corresponding to each sub-node of the second type node and the Boolean operation type corresponding to the second type node to obtain a combined three-dimensional model corresponding to the second type node.
Optionally, the constructing the target three-dimensional model according to the porous array data and the cell model specifically includes:
And determining the arrangement mode of the cell models in the target three-dimensional model according to the porous array data, and arranging and combining the cell models according to the arrangement mode to construct the target three-dimensional model corresponding to the cell models.
Optionally, the method further comprises:
acquiring coordinate point information input by a user based on the target three-dimensional model;
Determining a position predicted value of a coordinate point corresponding to the coordinate point information for the target three-dimensional model according to the target three-dimensional model and the coordinate point information, wherein the position predicted value is used for representing the distance between the coordinate point and the nearest model surface in the target three-dimensional model and the position information is used for representing the coordinate point inside or outside the target three-dimensional model;
and executing the target task according to the position predicted value corresponding to the coordinate point.
The present specification provides a three-dimensional model generation device based on a porous structure, comprising:
The device comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring porous array data, cell model data and cell size data corresponding to a target three-dimensional model to be constructed, the cell model corresponding to the cell model data is basic cells for constructing the target three-dimensional model, the porous array data is used for representing the arrangement mode of the cell model corresponding to the cell model data in the target three-dimensional model, the cell size data is used for representing the shape and occupied size of the cell model corresponding to the cell model data in the target three-dimensional model, the cell model data is tree structure data and is used for representing the internal space structure of the cell model corresponding to the cell model data based on the tree structure data, the tree structure data comprises a sub-node list of the non-leaf node and a Boolean operation type of the sub-node of the non-leaf node, the node data comprises a leaf type corresponding to the leaf node and a rectangular parameter model base structure model, and a basic structure model structure at least comprises a basic model structure;
the cell construction module is used for constructing the cell model according to the cell model data and the cell size data;
and the model construction module is used for constructing the target three-dimensional model according to the porous array data and the cell model.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described three-dimensional model generation method based on a porous structure.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above three-dimensional model generation method based on a porous structure when executing the program.
The above-mentioned at least one technical scheme that this specification adopted can reach following beneficial effect:
From the above-mentioned method, in the three-dimensional model generating method based on a porous structure provided in the present specification, a cell model corresponding to the cell model data may be constructed according to the obtained cell model data and cell size data. And finally, constructing a target three-dimensional model corresponding to the cell model according to the determined cell model and the porous array data acquired before.
From the above, it can be seen that the three-dimensional model generating method based on porous structure provided in the present disclosure can determine the corresponding cell model according to the cell model data and the cell size data. And then, according to the porous array data, the cell models are arranged and combined to obtain corresponding target three-dimensional models. The method can be used for efficiently constructing the target three-dimensional model with the complex topological structure or the combination of a plurality of basic models through the implicit modeling technology, so that the resource waste and the redundant time consumption caused by manually designing and constructing the complex topological structure are avoided to a great extent, and the execution efficiency of the task executed based on the target three-dimensional model is improved to a certain extent.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present specification more apparent, the technical solutions of the present specification will be clearly and completely described below with reference to specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a three-dimensional model generating method based on a porous structure provided in the present specification, which includes the following steps:
s101, acquiring porous array data, cell model data and cell size data corresponding to a target three-dimensional model to be constructed.
The current three-dimensional model technology is mature and widely applied in various fields, and in the field of additive manufacturing, the design and research of a three-dimensional model of a porous structure are extremely important. The implicit modeling technology is a relatively common modeling method, a geometric model is implicitly defined through a specific mathematical function, for example, model representation and construction are carried out through a symbol distance function (SIGN DISTANCE function, SDF), and the modeling efficiency of a porous structure model can be effectively improved. However, most of the existing technologies are only suitable for basic porous structures, the construction of a complex topological structure porous model formed by combining basic structures cannot be realized, and the complex topological structure porous model at the present stage often needs to be manually combined and constructed manually during construction, so that manpower resources and time cost are extremely consumed, and the treatment efficiency is low. Therefore, how to construct a three-dimensional model of a porous structure with a complex structure with high efficiency is a critical problem.
For this reason, the present specification provides a three-dimensional model generating method based on a porous structure, where the execution subject adopted in the method provided in the present specification may be a terminal device such as a desktop computer, a notebook computer, or a server. In addition, the execution subject of the present specification may be a subject in the form of software, such as a client installed in a terminal device, or the like. For convenience of explanation, the three-dimensional model generating method based on the porous structure provided will be explained below with the terminal device as the execution subject.
Based on the above, the terminal device applying the three-dimensional model generating method based on the porous structure provided in the present specification can construct a cell model in the target three-dimensional model according to the cell model data and the cell size data, and then can construct the target three-dimensional model with the porous structure according to the porous array data and the constructed cell model.
The application scenario of the target three-dimensional model generated by the terminal device applying the method in the specification can be determined according to actual requirements. For example, in the field of medical research, a terminal device applying the method in the present specification may construct a cell model formed by combining various types of basic three-dimensional models according to cell size data and cell model data, and further may construct a target three-dimensional model formed by constructing the cell model according to porous array data. The target three-dimensional model having a porous structure obtained by this method can be applied to a scaffold material or the like in the medical field, for example, a bone graft material or the like requiring an appropriate porosity. The high-efficiency and high-precision generation process of the target three-dimensional model can effectively ensure the generation efficiency and practicability of special construction materials in the field of medical research, thereby promoting the progress of the medical field and helping to solve the intractable medical problem.
For another example, in the field of building materials, a terminal device to which the method in the present specification is applied may construct a cell model obtained by performing operations such as boolean transformation on a basic three-dimensional model based on cell model data and cell size data. And then constructing a corresponding target three-dimensional model according to the porous array data. The constructed target three-dimensional model can be used as an internal filling material of a building material, such as porous insulating bricks, plates and the like, which not only maintains the original stable structure but also has the light weight characteristic. The method can effectively improve the design and manufacturing efficiency of the porous building material, greatly reduce the cost of manpower resources and time, and further improve the propulsion efficiency of building tasks to a certain extent.
In the present specification, the terminal device may acquire porous array data, cell model data, and cell size data corresponding to the target three-dimensional model to be constructed.
The cell model corresponding to the cell model data is a basic cell corresponding to a target three-dimensional model constructed later, the porous array data is used for representing a specific arrangement mode of the cell model in the target three-dimensional model, and the cell size data is used for representing the shape of the cell model in the target three-dimensional model and the size of the occupied size range.
Specifically, the data type corresponding to the cell model data may be tree structure data. In the cell model data with the tree structure, the node data corresponding to each leaf node specifically may include a basic model type and a basic model parameter corresponding to the leaf node. The basic model types can be specifically divided into but not limited to a rod structure model, a plate structure model and a cuboid structure model, and the node data of each leaf node can comprise any one of the basic model types and corresponding basic model parameters.
The basic model parameters are specifically understood as specific model parameters of a basic model type corresponding to each leaf node, for example, when the basic model type is a rod structure model, the basic model parameters corresponding to the leaf nodes may include coordinate data of two end vertices of the rod structure model in a cell space of a cell size data corresponding plan, and a rod radius corresponding to the rod structure model.
When the basic model type is a plate structure model, the basic model parameters corresponding to the leaf nodes may include coordinate data of vertices corresponding to the plate structure model in a cell space of a plan corresponding to the cell size data (for example, coordinate data of four vertices corresponding to a rectangular plate structure model), and thickness of the plate structure model.
When the basic model type is a cuboid structure model, the basic model parameters corresponding to the leaf nodes can comprise coordinate data of diagonal double-end vertexes of any group of the cuboid structure model in a cell space of a plan corresponding to the cell size data.
Regarding node data of non-leaf nodes, in the cell model data of a tree structure, the node data corresponding to each non-leaf node contains a child node list of all child nodes of the non-leaf node and Boolean operation types aiming at all child nodes of the leaf node.
The boolean operation type is used for indicating what type of boolean operation is performed on all child nodes corresponding to the non-leaf nodes by the terminal equipment when the combined three-dimensional model corresponding to the non-leaf nodes is determined subsequently. The boolean operation types may include, but are not limited to, inter alia, intersection operations, union operations, difference operations for at least two three-dimensional models, and offset operations and shell-out operations for a single three-dimensional model. The node data of each non-leaf node may include any of the boolean operation types described above. And the terminal equipment can carry out Boolean processing on the three-dimensional model corresponding to each child node of the non-leaf node based on the corresponding Boolean operation type in the subsequent process so as to obtain a combined three-dimensional model corresponding to the non-leaf node.
Regarding the cell size data and the porous array data mentioned above, the cell size data may be specifically used to represent a cell model and a cell space range size and a space shape type corresponding to each node in the cell model data, for example, a rectangular parallelepiped type cell space and a length, width, height, etc. corresponding to a rectangular parallelepiped type cell space, a cylindrical type cell space and a height, bottom radius, etc. corresponding to a cylindrical type cell space. The multi-hole array data can be used for representing the arrangement number of cell models of the three-dimensional coordinate system of the target three-dimensional model to be generated in the x-axis, the y-axis and the z-axis.
It should be noted that, the cell model data, cell size data, and specific data format and data language of the porous array data are not strictly limited, and may be flexibly set according to actual application scenarios and requirements. For a convenient understanding of the specific data content and structure of the above cell model data, cell size data, and porous array data, the following is exemplified by JS key data (JavaScript Object Notation, JSON) format cell model data, cell size data, and porous array data, which are referred to as follows:
"lattice": {
"cell_size": [1, 1, 1],
"period_count": [1, 1, 1],
"models": {
"op_union": {
"type": "op_union",
"models": [
{
"op_union": {
"type": "op_union",
"models": [
{
"cylinder": {
"points": [
[0, 0, 0],
[0.5, 0.5, 0.5]
],
"radius": 0.05
}
},
{
"cylinder": {
"points": [
[0, 0, 0],
[-0.5, 0.5, 0.5]
],
"radius": 0.05
}
}
]
}
}
]
}
}
}
The cell_size may be specifically used to represent cell size data corresponding to a cell model, and the example defaults to a cuboid structure for a cell space corresponding to the cell model, where three values in the corresponding array represent sizes of the cell space corresponding to the cell model in an x-axis, a y-axis and a z-axis respectively. The period_count may be specifically used to represent the porous array data corresponding to the cell model, where three values in the corresponding array are respectively used to represent the number of the cell model arranged on the x-axis, the y-axis and the z-axis when the target three-dimensional model is subsequently constructed.
Each models in the above example may be specifically used to represent each node in the corresponding cellular model data of the cellular model, where the first models is the root node in the cellular model data, and the non-leaf node models includes models of all the child nodes corresponding to the first node and includes an operation identifier that is used to represent the boolean operation type op_x, for example, "op_ union" in the above example represents performing a union operation on the child nodes. The above example includes two leaf nodes, the corresponding basic model types are rod structure model cylinder, points in the corresponding specific node data are used to represent coordinate data of double-end vertices of the rod structure model in the cell space corresponding to the cell size data, and radius can be used to represent the radius of the rod structure model.
S102, constructing the cell model according to the cell model data and the cell size data.
In this specification, the terminal device may construct a cell model corresponding to the cell model data according to the acquired cell model data and cell size data.
Specifically, for each leaf node in the cell model data, the terminal device may determine a basic model construction rule preset in advance for a basic model type corresponding to the leaf node. And then, constructing rules and basic model parameters according to the basic model corresponding to the leaf node, and generating a basic three-dimensional model corresponding to the leaf node.
In the present specification, corresponding basic model construction rules are preset for different basic model types corresponding to each leaf node, and the basic model construction rules may be used to determine the shape and boundary of a basic three-dimensional model corresponding to the leaf node according to basic model parameters corresponding to the leaf node, specifically may be, for example, a symbol distance function (SIGN DISTANCE function, SDF) corresponding to a basic model type, and the basic model construction rules corresponding to a rod structure model may be the shortest distance between any coordinate point in a cell space where the rod structure model is located and the surface of the rod structure model. The specific calculation method can be to calculate a vector cross-multiplying module from any coordinate point to the vertexes at two ends of the rod structure model, divide the linear distance between the vertexes at two ends, and determine the vertical distance between the coordinate point and the central axis of the rod structure model. Then, subtracting the radius of the rod structure model to obtain the shortest distance between the coordinate point and the surface of the rod structure model, namely, a sign distance value, wherein if the coordinate point is outside the rod structure model, the sign distance value is positive, otherwise, the sign distance value is negative, and if the sign distance value is 0, the sign distance value is 0.
When the basic model type is a plate structure model, taking the above sign distance function as an example, the corresponding basic model construction rule may be a shortest distance from any coordinate point in the cell space where the plate structure model is located to the surface of the plate structure model. The specific calculation method comprises the steps of determining the normal vector corresponding to the plate structure model, and then calculating the linear distance from the coordinate point to the plane of the plate structure model and the shortest distance from the coordinate point to each side length of the plate structure model. When the coordinate point is inside the plate structure, the terminal device can directly take the linear distance from the coordinate point to the plane of the plate structure model as the shortest distance from the coordinate point to the surface of the plate structure model, and when the coordinate point is outside the plate structure, the terminal device can take the minimum value between the linear distance from the coordinate point to the plane of the plate structure model and the shortest distance from the coordinate point to each side length of the plate structure model as the shortest distance from the coordinate point to each side length of the plate structure model. Similarly, the plate structure model is negative on the inside, positive on the outside, and 0 on the surface.
When the basic model type is a cuboid structure model, the symbol distance function is still taken as an example, and the corresponding basic model construction rule can be the shortest distance from any coordinate point in the cell space where the cuboid structure model is located to the surface of the cuboid structure model. The specific calculation method may be to determine the distance (for example dx, dy, dz) between any coordinate point in the cell space and the center point of the cuboid structure model on each coordinate axis, and the half-size of the cuboid structure model on three coordinate axes. And judging the size relation between the distance between the coordinate point and the center point of the cuboid structure model on each coordinate axis and the half-size of the cuboid structure model on the corresponding coordinate axis, if the distance between the coordinate point and the center point of the cuboid structure model on each coordinate axis is larger than the corresponding half-size, determining the difference value and reserving the difference value as the redundant distance, and if the distance between the coordinate point and the center point of the cuboid structure model on each coordinate axis is smaller than or equal to the corresponding half-size, determining the redundant distance to be 0. And determining the shortest distance from the coordinate point to the surface of the cuboid structure model according to the square sum of the redundant distances corresponding to the three coordinate axes. Similarly, the inside of the rectangular parallelepiped structure model is negative, the outside is positive, and the surface is 0.
Based on the basic model construction rule preset for each basic model type described above, the terminal device may construct a basic three-dimensional model corresponding to each leaf node according to the basic model construction rule corresponding to each leaf node, the basic model parameters and the acquired cell size data, and each coordinate point in the cell space corresponding to each leaf node and containing the basic three-dimensional model may correspond to a symbol distance value (SDF value) determined by the coordinate point based on the corresponding basic model construction rule.
Then, the terminal device may determine the basic three-dimensional model corresponding to each leaf node in the cell model data and the node data corresponding to each non-leaf node in the cell model data, so as to generate a cell model corresponding to the cell model data.
Specifically, the terminal device may determine, according to the basic three-dimensional model corresponding to each leaf node in the cell model data, a combined three-dimensional model corresponding to each non-leaf node other than the root node. And then, determining a three-dimensional model corresponding to the root node according to the node data corresponding to the root node in the cell model data and the three-dimensional model corresponding to the child node of the root node, and taking the three-dimensional model corresponding to the root node as a cell model corresponding to the cell model data.
In the present specification, each non-leaf node except the root node in the cell model data is divided into two types, namely a first type node and a second type node, and the two non-leaf nodes are different in relative node depth of the corresponding child nodes. Whereas the relative node depth is used to denote the node level distance of a leaf node in the branch where a child node of a non-leaf node is located from the parent node of the child node. The relative node depth of the sub-nodes corresponding to the first type node is 1, and the relative node depth of the sub-nodes corresponding to the second type node is not 1, which can be simply understood that all the sub-nodes of the non-leaf node with the type of the first type node are leaf nodes, and all the sub-nodes of the non-leaf node with the type of the second type node are leaf nodes, and can be all the non-leaf nodes or part of the non-leaf nodes.
For a first type node in the cell model data, the terminal device may perform boolean operation processing on the base three-dimensional model corresponding to each child node of the first type node according to the base three-dimensional model corresponding to each child node (i.e., each leaf node) of the first type node and the boolean operation type in the node data corresponding to the first type node, so as to obtain a combined three-dimensional model corresponding to the first type node.
For each second type node in the cell model data, the child nodes of the non-leaf nodes may only include the non-leaf nodes, or may include both the leaf nodes and the non-leaf nodes, i.e., the three-dimensional model corresponding to the child nodes is a basic three-dimensional model or a combined three-dimensional model. The terminal equipment can perform Boolean operation processing on the three-dimensional model corresponding to each sub-node according to the three-dimensional model corresponding to each sub-node of the second class node and the Boolean operation type corresponding to the non-second class node to obtain a combined three-dimensional model corresponding to the second class node.
Then, the terminal equipment can perform Boolean operation processing on the three-dimensional model corresponding to each child node of the root node according to the three-dimensional model corresponding to each child node of the root node and the Boolean operation type in the node data corresponding to the root node, so as to obtain the three-dimensional model corresponding to the root node, and further take the three-dimensional model corresponding to the root node as the cell model corresponding to the cell model data.
It should be noted that, regarding the specific implementation method for performing the boolean operation on each three-dimensional model, the boolean operation may be directly performed on the corresponding three-dimensional model instance to obtain the three-dimensional model after the boolean operation. In addition, the symbol distance functions corresponding to the three-dimensional models to be boolean may be combined according to the boolean operation type, and the updated symbol distance values (SDF values) after boolean processing for the coordinate points in the same cell space may be redetermined. The specific implementation method of the Boolean processing operation is not strictly limited in the specification, and can be flexibly adjusted according to actual application scenes and requirements.
For example, for the boolean operation type being an intersection operation, the terminal device may use a point-by-point minimum value between symbol distance values of any coordinate point in the cell space for two or more three-dimensional models as a symbol distance value corresponding to the coordinate point after the boolean operation. For the boolean operation type, the terminal device may use a point-by-point maximum value between symbol distance values of any coordinate point in the cell space for two or more three-dimensional models as a symbol distance value corresponding to the coordinate point after the boolean operation.
When the boolean operation type is a difference set operation, the corresponding three-dimensional models may be divided into a subtracted model and a reduced model, and the difference set operation may be understood as specifically subtracting the reduced model from the subtracted model to obtain a new three-dimensional model. The terminal device may determine the complement model corresponding to the reduction model in the cell space, and then perform the intersection operation on the reduced model and the complement model, so as to update the symbol distance value corresponding to each coordinate point in the cell space.
When the boolean operation type is offset operation, the terminal device may adjust the symbol distance value corresponding to each coordinate point in the cell space according to the magnitude of the offset value and the corresponding coordinate axis. When the boolean operation type is the outward shell drawing operation, the terminal equipment can firstly carry out the offset processing on the three-dimensional model according to the shell drawing thickness corresponding to the shell drawing operation to obtain the offset three-dimensional model. Then, the terminal equipment can perform the difference set processing on the original three-dimensional model and the offset three-dimensional model, the original three-dimensional model is used as a reduced number model, the offset three-dimensional model is used as a reduced number model, and the original three-dimensional model is subtracted from the offset three-dimensional model to obtain a shell extraction model corresponding to the three-dimensional model.
The above description is mainly described from the viewpoint of model construction, in the process of constructing a corresponding cell model according to cell model data, the terminal device may perform traversal analysis on the cell model data in a tree structure, and step-by-step downward data traversal from node data of the root node, where a specific traversal manner may be, for example, depth-First-Search (DFS).
And (3) performing node data traversal, wherein the terminal equipment can firstly judge whether the node is a leaf node or a non-leaf node, and when the node is a non-leaf node, determining the Boolean operation type op_x corresponding to the non-leaf node and the SUB-node list sub_nodes= [ S1, S2, S3, S4. ]. When the node is a leaf node, determining a base MODEL TYPE MODEL_TYPE and a base MODEL parameter MODEL_PARAM corresponding to the leaf node.
When the combined three-dimensional model of the non-leaf node is determined, traversing a SUB-node list sub_nodes of the non-leaf node, and performing Boolean operation on the three-dimensional model of each SUB-node according to a Boolean operation type op_x corresponding to the non-leaf node to obtain a result R= [ R1, R2, R3.. Rn ], wherein R is a set of model examples corresponding to the SUB-node of the non-leaf node. And sequentially performing model combination to determine a three-dimensional model corresponding to the root node, and taking the three-dimensional model as a cell model corresponding to the cell model data.
S103, constructing the target three-dimensional model according to the porous array data and the cell model.
In the present specification, the terminal device may construct a target three-dimensional model composed of a plurality of cell models arranged and combined according to the cell model determined through the above steps and the porous array data obtained previously.
Specifically, the above steps also refer to that the porous array data obtained before includes the number of arrangement of the cell model in the positive direction of each coordinate axis of the three-dimensional coordinate system in the target three-dimensional model. The terminal equipment can arrange and combine the cell models according to the arrangement quantity of the basic cells in the positive directions of all coordinate axes of the three-dimensional coordinate system in the porous array data, and finally a target three-dimensional model corresponding to the cell models is obtained.
In addition to the above, after determining the target three-dimensional model corresponding to the cell model through the above steps, the terminal device may further determine, according to coordinate point information input by the user, a symbol distance value of a symbol distance field corresponding to the target three-dimensional model, where the symbol distance field corresponds to the coordinate point information corresponding to the coordinate point in the target three-dimensional model. The sign distance value is also mentioned in the above step, and may be specifically used to indicate the distance between the coordinate point and the nearest model surface in the target three-dimensional model, and sign information, where sign information indicates whether the coordinate point is inside or outside the target three-dimensional model, and the inside is negative, and the outside is positive.
The determined symbol distance value may be used to perform a task, and specifically may be the determined symbol distance value is returned to the terminal device used by the user, so that the terminal device used by the user may perform a corresponding target task according to the received symbol distance value.
The specific task type and task content of the target task are not strictly limited in the specification, and the edge smoothing processing may be performed on the target three-dimensional model based on determining the symbol distance value corresponding to each coordinate point in the target three-dimensional model, or the boolean operation may be performed on the target three-dimensional model again according to the symbol distance value corresponding to each coordinate point, so as to obtain the target three-dimensional model after the boolean operation is updated, or the symbol distance value corresponding to each coordinate point may be used to solve real-time rendering techniques, such as ray tracing or rasterization, so that more efficient and accurate shadow, reflection and refraction effects may be provided when the target three-dimensional model is rendered.
In order to facilitate understanding of the overall flow and trend of the above three-dimensional model generating method based on a porous structure, explanation will be given below with a flow-trend chart of the three-dimensional model generating method based on a porous structure, as shown in fig. 2.
Fig. 2 is a flow chart of a three-dimensional model generating method based on a porous structure provided in the present specification.
As shown in fig. 2, the terminal device may determine, according to the obtained basic model type and basic model parameters corresponding to each leaf node in the cell model data and the cell size data, a basic three-dimensional model corresponding to each leaf node in the cell model data based on a basic model construction rule corresponding to the basic model type. Then, the terminal equipment can generate a cell model corresponding to the cell model data according to the node data of each non-leaf node and the basic three-dimensional model corresponding to each leaf node, and sequentially and upwards perform model construction from each leaf node to finally obtain a three-dimensional model corresponding to the root node in the cell model data as the cell model.
Finally, the terminal equipment can construct a target three-dimensional model according to the acquired porous array data and the determined cell model. In addition, the user can also acquire the symbol distance value of the corresponding coordinate point returned by the terminal equipment in the target three-dimensional model by inputting the coordinate information of any coordinate point in the target three-dimensional model, so that the user can execute the subsequent corresponding target task according to the symbol distance value of the coordinate point.
From the above, it can be seen that the three-dimensional model generating method based on porous structure provided in the present disclosure can determine the corresponding cell model according to the cell model data and the cell size data. And then, according to the porous array data, the cell models are arranged and combined to obtain corresponding target three-dimensional models. The method can be used for efficiently constructing the target three-dimensional model with the complex topological structure or the combination of a plurality of basic models through the implicit modeling technology, so that the resource waste and the redundant time consumption caused by manually designing and constructing the complex topological structure are avoided to a great extent, and the execution efficiency of the task executed based on the target three-dimensional model is improved to a certain extent.
The foregoing is a method of one or more implementations of the present disclosure, and based on the same concept, the present disclosure further provides a corresponding three-dimensional model generating device based on a porous structure, as shown in fig. 3.
Fig. 3 is a schematic diagram of a three-dimensional model generating device based on a porous structure provided in the present specification, including:
The obtaining module 301 is configured to obtain porous array data, cell model data, and cell size data corresponding to a target three-dimensional model to be constructed, where the cell model corresponding to the cell model data is a basic cell for constructing the target three-dimensional model, the porous array data is configured to represent an arrangement mode of the cell model corresponding to the cell model data in the target three-dimensional model, the cell size data is configured to represent a shape and an occupied size of the cell model corresponding to the cell model data in the target three-dimensional model, the cell model data is tree structure data, and is configured to represent an internal space structure of the cell model corresponding to the cell model data based on the tree structure data, the tree structure data includes, for each non-leaf node in the cell model data, a sub-node list of the non-leaf node and a boolean operation type for the sub-node of the non-leaf node, and for each leaf node in the cell model data, the node data of the node includes the leaf node and the corresponding leaf node type, and the basic model structure includes at least a leaf structure model, and a basic model structure;
A cell construction module 302, configured to construct the cell model according to the cell model data and the cell size data;
the model building module 303 is configured to build the target three-dimensional model according to the porous array data and the cell model.
Optionally, the cell construction module 302 is specifically configured to determine, for each leaf node in the cell model data, a basic model construction rule corresponding to the leaf node, and generate a basic three-dimensional model corresponding to the leaf node according to the basic model construction rule, the basic model parameter and the cell size data corresponding to the leaf node, where the basic model construction rule is configured to determine, according to the basic model parameter corresponding to the leaf node, a shape and a boundary of the basic three-dimensional model corresponding to the leaf node, and construct the cell model according to node data of each non-leaf node in the cell model data and the basic three-dimensional model corresponding to each leaf node.
Optionally, the cell construction module 302 is specifically configured to determine, according to node data of each non-leaf node except a root node in the cell model data and a basic three-dimensional model corresponding to each leaf node, a combined three-dimensional model corresponding to each non-leaf node except the root node, determine, according to node data corresponding to the root node in the cell model data and a three-dimensional model corresponding to a child node of the root node, a combined three-dimensional model corresponding to the root node, and use the combined three-dimensional model corresponding to the root node as the cell model.
Optionally, each non-leaf node except the root node in the cell model data includes a first type node, the relative node depth of the child node corresponding to the first type node is 1, and for each child node in the cell model data, the relative node depth of the child node is used for indicating the node level distance between the leaf node in the branch where the child node is located and the parent node of the child node;
The cell construction module 302 is specifically configured to, for each first type node in the cell model data, perform boolean operation processing on the base three-dimensional model corresponding to each child node of the first type node according to the base three-dimensional model corresponding to each child node of the first type node and the boolean operation type corresponding to the first type node, so as to obtain a combined three-dimensional model corresponding to the first type node.
Optionally, each non-leaf node except the root node in the cell model data further includes a second type node, and the relative node depth non-uniformity of the child nodes corresponding to the second type node is 1;
the cell construction module 302 is specifically configured to, for each second type node in the cell model data, perform boolean operation processing on the three-dimensional model corresponding to each child node of the second type node according to the three-dimensional model corresponding to each child node of the second type node and the boolean operation type corresponding to the second type node, so as to obtain a combined three-dimensional model corresponding to the second type node.
Optionally, the model building module 303 is specifically configured to determine an arrangement manner of the cell models in the target three-dimensional model according to the porous array data, and perform permutation and combination on the cell models according to the arrangement manner, so as to build a target three-dimensional model corresponding to the cell models.
Optionally, the model building module 303 is specifically configured to obtain coordinate point information input by a user based on the target three-dimensional model, determine, according to the target three-dimensional model and the coordinate point information, a position prediction value of a coordinate point corresponding to the coordinate point information for the target three-dimensional model, where the position prediction value is used to represent a distance between the coordinate point and a surface of a nearest model in the target three-dimensional model and position information, and the position information is used to represent that the coordinate point is inside or outside the target three-dimensional model, and execute a target task according to the position prediction value corresponding to the coordinate point.
The present specification also provides a computer-readable storage medium storing a computer program operable to execute the three-dimensional model generating method based on a porous structure provided in fig. 1 described above.
The present specification also provides a schematic structural diagram of an electronic device corresponding to fig. 1 shown in fig. 4. At the hardware level, as shown in fig. 4, the electronic device includes a processor, an internal bus, a network interface, a memory, and a nonvolatile storage, and may of course include hardware required by other services. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to realize the three-dimensional model generating method based on the porous structure as described in the above figure 1.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable GATE ARRAY, FPGA)) is an integrated circuit whose logic functions are determined by user programming of the device. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented with "logic compiler (logic compiler)" software, which is similar to the software compiler used in program development and writing, and the original code before being compiled is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but HDL is not just one, but a plurality of 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), and VHDL (Very-High-SPEED INTEGRATED Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application SPECIFIC INTEGRATED Circuits (ASICs), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, 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. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or cell described in the above embodiments may be implemented by a computer chip or entity or by an article of manufacture having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, 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.
For convenience of description, the above devices are described as being functionally divided into various cells, respectively. Of course, the functions of each cell may be implemented in the same piece or pieces of software and/or hardware when implementing the present description.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer 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 disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.