CN115908695A - Model generation method and device and electronic equipment - Google Patents

Model generation method and device and electronic equipment Download PDF

Info

Publication number
CN115908695A
CN115908695A CN202211184378.2A CN202211184378A CN115908695A CN 115908695 A CN115908695 A CN 115908695A CN 202211184378 A CN202211184378 A CN 202211184378A CN 115908695 A CN115908695 A CN 115908695A
Authority
CN
China
Prior art keywords
model
processed
planes
direction axis
plane
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211184378.2A
Other languages
Chinese (zh)
Inventor
沈忠勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202211184378.2A priority Critical patent/CN115908695A/en
Publication of CN115908695A publication Critical patent/CN115908695A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The invention provides a model generation method, a model generation device and electronic equipment, wherein the method comprises the following steps: obtaining a model to be processed; setting a plurality of first planes perpendicular to a first direction axis on the model to be processed, and dividing the model to be processed based on the plurality of first planes to obtain a first structure; setting a plurality of second planes perpendicular to a second direction axis on the model to be processed, and dividing the model to be processed based on the plurality of second planes to obtain a second structure; and generating an object model with a waffle structure based on the first structure and the second structure. According to the mode, after the model to be processed is obtained, the model to be processed can be automatically segmented to obtain the model with the waffle structure, compared with a mode of manually manufacturing the model with the waffle structure, the mode automatically completes model manufacturing through a program, a large amount of labor and time are saved, and the efficiency of model manufacturing is improved.

Description

Model generation method and device and electronic equipment
Technical Field
The present invention relates to the field of model making technologies, and in particular, to a model generation method and apparatus, and an electronic device.
Background
In the virtual model creation, a hollow wafer model or a waffle-structured building or the like is generally created. In the related art, a user usually uses three-dimensional production software to manually draw a virtual model of a waffle structure, but the manual drawing mode is low in efficiency, and each model is unique and cannot be used universally, so that a large amount of manpower is consumed when the number of models is large.
Disclosure of Invention
The invention aims to provide a model generation method, a model generation device and electronic equipment, so as to improve the manufacturing efficiency of a model with a waffle structure.
In a first aspect, the present invention provides a model generation method, including: obtaining a model to be processed; setting a plurality of first planes perpendicular to a first direction axis on the model to be processed, and dividing the model to be processed based on the plurality of first planes to obtain a first structure; setting a plurality of second planes perpendicular to a second direction axis on the model to be processed, and dividing the model to be processed based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle; based on the first structure and the second structure, an object model having a waffle structure is generated.
In a second aspect, the present invention provides a model generation apparatus comprising: the model acquisition module is used for acquiring a model to be processed; the first segmentation module is used for setting a plurality of first planes vertical to a first direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of first planes to obtain a first structure; the second segmentation module is used for setting a plurality of second planes which are vertical to the second direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle; and the model generation module is used for generating a target model with a waffle structure based on the first structure and the second structure.
In a third aspect, the invention provides an electronic device comprising a processor and a memory, the memory storing machine-executable instructions capable of being executed by the processor, the processor executing the machine-executable instructions to implement the model generation method described above.
In a fourth aspect, the present invention provides a computer-readable storage medium having stored thereon computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the model generation method described above.
The embodiment of the invention has the following beneficial effects:
the invention provides a model generation method, a model generation device and electronic equipment, wherein a model to be processed is obtained; then, a plurality of first planes perpendicular to the first direction axis are arranged on the model to be processed, and the model to be processed is divided based on the plurality of first planes to obtain a first structure; setting a plurality of second planes perpendicular to a second direction axis on the model to be processed, and dividing the model to be processed based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle; then, based on the first structure and the second structure, an object model with a waffle structure is generated. According to the mode, after the model to be processed is obtained, the model to be processed can be automatically segmented to obtain the model with the waffle structure, compared with a mode of manually manufacturing the model with the waffle structure, the mode automatically completes model manufacturing through a program, a large amount of labor and time are saved, and the efficiency of model manufacturing is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention as set forth above.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a model generation method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another model generation method provided by an embodiment of the invention;
FIG. 3 is a schematic diagram of a model to be processed according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a closed polygon model according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a minimum circumscribed cuboid of a model to be processed according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a minimum coordinate position and a maximum coordinate position of a first directional axis provided by an embodiment of the present invention;
FIG. 7 is a schematic diagram of a plurality of first planes provided by an embodiment of the present invention;
FIG. 8 is a diagram illustrating an intersection of a first plane and a model to be processed in a processing result according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating a first structure obtained after a squeeze operation according to an embodiment of the present invention;
FIG. 10 is a flow chart of another model generation method provided by embodiments of the present invention;
FIG. 11 is a schematic view of a plurality of second planes provided by an embodiment of the present invention;
fig. 12 is a schematic diagram of an intersection of a second plane and a model to be processed in a processing result according to an embodiment of the present invention;
FIG. 13 is a diagram illustrating a second structure obtained after a squeeze operation according to an embodiment of the present invention;
FIG. 14 is a schematic illustration of the results of the overlap provided by an embodiment of the present invention;
FIG. 15 is a schematic diagram of a fourth structure provided in accordance with an embodiment of the present invention;
FIG. 16 is a diagram of an object model with a waffle structure, according to an embodiment of the invention;
fig. 17 is a schematic structural diagram of a model generation apparatus according to an embodiment of the present invention;
fig. 18 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the virtual model making, a hollow waffle model or some artistic waffle structure building appearance or ceiling, etc. is usually made. In the related technology, a user usually uses three-dimensional manufacturing software to manually draw a virtual model of a waffle structure, that is, the user manufactures a single piece of model which is spliced and then deformed and adapted to be a model of a target shape, but the manual drawing mode has low efficiency, and each model is unique and cannot be used universally, so that a large amount of manpower is consumed when the number of models is large; meanwhile, the artistic effect generated by the manually drawn model is easily affected by human factors, so that the effect is unstable.
Based on the above problems, embodiments of the present invention provide a model generation method and apparatus, and an electronic device, where the technology may be applied in a scenario of model making, and is a scenario of model making with a waffle structure. In order to facilitate understanding of the embodiment of the present invention, a detailed description is first given of a model generation method disclosed in the embodiment of the present invention, and as shown in fig. 1, the method includes the following specific steps:
and step S102, obtaining a model to be processed.
The model to be processed may be any model which needs to be processed and is input by a user, and the model to be processed may be a three-dimensional model drawn on drawing software by the user or a three-dimensional model stored in a preset file. Specifically, the method is realized on the preset software, a set of logic can be designed and packaged into a plug-in tool in the preset software, and the plug-in tool can output the target model with the waffle structure according to the input model to be processed. In some embodiments, the pre-set software may be houdini software or other software used by the user.
Note that the waffle structure is generally a structure having a plurality of concave-convex patterns of squares or diamonds.
Step S104, a plurality of first planes perpendicular to the first direction axis are arranged on the model to be processed, and the model to be processed is divided based on the plurality of first planes to obtain a first structure.
The first direction axis may be a Z-axis direction in a three-dimensional coordinate system, or may be an X-axis direction or a Y-axis direction, and the specific direction of the first direction axis is set according to research and development requirements. When a first plane perpendicular to the first direction axis is set on the model to be processed, a plurality of subdivision points may be placed on the first direction axis first, then a first plane perpendicular to the plane where the first direction axis is located is set on each subdivision point, so as to obtain a plurality of first planes, then the model to be processed is divided by using the plurality of first planes, so as to obtain the model to be processed whose surface is divided into strip-shaped structures, where the divided model to be processed is also the first structure.
Step S106, a plurality of second planes vertical to a second direction axis are arranged on the model to be processed, and the model to be processed is divided based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle.
The second direction axis is a direction axis different from the first direction axis in the three-dimensional coordinate system, and the first direction axis and the second direction axis form a preset angle, which is usually 90 degrees, but may be other angles set by the user. Specifically, the second direction axis may be a Z-axis direction in a three-dimensional coordinate system, or may also be an X-axis direction or a Y-axis direction, and the direction of the first direction axis and the direction of the second direction axis are specifically set according to research and development requirements.
When a second plane perpendicular to the second direction axis is set on the model to be processed, a plurality of subdivision points may be first placed on the second direction axis, then a second plane perpendicular to the plane where the second direction axis is located is set on each subdivision point, so as to obtain a plurality of second planes, then the model to be processed is divided by using the plurality of second planes, so as to obtain a model to be processed whose surface is divided into strip-shaped structures, and the divided model to be processed is also the second structure.
And S108, generating a target model with a waffle structure based on the first structure and the second structure.
The target model with the waffle structure can be obtained by performing comprehensive operation on the first structure and the second structure, the comprehensive operation can include merging the first structure and the second structure, taking an intersection part of the first structure and the second structure, and the like, and a specific operation mode of the comprehensive operation can be set according to research and development requirements, and is not particularly limited herein.
The embodiment of the invention provides a model generation method, which comprises the steps of firstly obtaining a model to be processed; further setting a plurality of first planes perpendicular to the first direction axis on the model to be processed, and dividing the model to be processed based on the plurality of first planes to obtain a first structure; then a plurality of second planes which are vertical to a second direction axis are arranged on the model to be processed, and the model to be processed is divided based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle; then, based on the first structure and the second structure, an object model with a waffle structure is generated. According to the mode, after the model to be processed is obtained, the model to be processed can be automatically segmented to obtain the model with the waffle structure, compared with a mode of manually manufacturing the model with the waffle structure, the mode automatically completes model manufacturing through a program, a large amount of labor and time are saved, and the efficiency of model manufacturing is improved.
The embodiment of the present invention further provides another model generation method, which is implemented on the basis of the above embodiment, and the method mainly describes a specific process of setting a plurality of first planes perpendicular to a first direction axis on a model to be processed, and segmenting the model to be processed based on the plurality of first planes to obtain a first structure (specifically, implemented by the following steps S204 to S208); as shown in fig. 2, the method comprises the following specific steps:
step S202, a model to be processed is obtained.
In specific implementation, after the model to be processed is obtained, the central position of the model to be processed needs to be moved to the central position of the world coordinate; and then converting the moved model to be processed into a closed polygonal model so as to replace the polygonal model with the model to be processed and execute the subsequent steps. Specifically, the center position of the model to be processed is moved to the center position of the world coordinate, which is beneficial to simplifying the subsequent processing of the model. The determination mode of the central position of the model to be processed comprises the following steps: and aiming at each axial direction, determining the average value of the maximum coordinate value and the minimum coordinate value of the model to be processed in the current axial direction as the central coordinate value of the current axial direction, and combining the central coordinate values of each axial direction to obtain the coordinate of the central position of the model to be processed. The center position of the world coordinates is also the position of coordinates (0, 0).
In practical applications, the center position of the model to be processed can be moved to the center position of the world coordinates through the matchsize node. The matchsize node is a built-in node of houdini software, and the node can reset the size and the center position of the model to be processed according to the input model to be processed.
In practical applications, after the central position of the model to be processed is moved to the central position of the world coordinates, the model to be processed needs to be converted into a VDB (Volume Database File) format through vddbfrompygons, so as to obtain a closed polygon model. The above-mentioned conversion of the moved model to be processed into the closed polygon model is to make the whole model become a closed whole model, and specifically, the volume elements of the model to be processed can be converted into a unified closed polygon model through the convertvdb node, and the convertvdb node can convert the VDB into a closed polygon. Fig. 3 is a schematic view of a model to be processed according to an embodiment of the present invention, in which the spherical shape with the support below in fig. 3 is the model to be processed; fig. 4 is a schematic diagram of a closed polygon model according to an embodiment of the present invention.
And step S204, determining the longest connecting line of the model to be processed on the first direction axis.
In a specific implementation, the step S204 is implemented by the following steps 10-12:
and step 10, generating a minimum external cuboid of the model to be processed.
And arranging a minimum external cuboid at the periphery of the model to be processed so as to surround the model to be processed. Specifically, a box which is adapted to the size of the model to be processed can be automatically generated through a preset node, and the box is also the minimum external cuboid of the model to be processed. In practical applications, the preset node may be a box node or other functions. Fig. 5 is a schematic diagram of a minimum circumscribed cuboid of the model to be processed, and the cuboid at the periphery of the model to be processed in fig. 5 is the minimum circumscribed cuboid.
And 11, determining the maximum coordinate position and the minimum coordinate position of the minimum circumscribed cuboid on the first direction axis.
During specific implementation, the maximum coordinate and the minimum coordinate of the minimum external cuboid on the first direction axis can be obtained through a preset program, the position of the maximum coordinate in the minimum external cuboid is determined as the maximum coordinate position, and the position of the minimum coordinate in the minimum external cuboid is determined as the minimum coordinate position. In particular, the amount of the solvent to be used,
in practical application, the maximum position coordinates (that is, the coordinate positions of the X axis, the Y axis, and the Z axis) of the first direction axis, the second direction axis, and the third direction axis of the minimum circumscribed cuboid and the position coordinates of the minimum first direction axis, the second direction axis, and the third direction axis may be obtained first, and then the maximum coordinate and the minimum coordinate of the first direction axis are extracted from the position coordinates, so as to obtain the maximum coordinate position and the minimum coordinate position on the first direction axis.
And step 12, determining a connecting line of the maximum coordinate position and the minimum coordinate position as the longest connecting line of the model to be processed on the first direction axis.
In specific implementation, the maximum coordinate position and the minimum coordinate position are connected through a preset program to obtain a line, and the line is the longest connecting line. The preset program comprises the following codes:
v@max=getbbox_max(0);
v@min=getbbox_min(0);
vector zp0=set(0,0,@max.z);
vector zp1=set(0,0,@min.z);
int np0=addpoint(0,zp0);
int np1=addpoint(0,zp1);
intnewprimz=addprim(0,"polyline",np0,np1);
setprimgroup(0,"pz",newprimz,1)。
wherein zp0= set (0, @ max.z) represents a maximum coordinate position at which the first directional axis is acquired; zp1= set (0, @ min.z) indicates that the minimum coordinate position of the first direction axis is acquired, and pz is an array in which link information of the maximum coordinate position and the minimum coordinate position is stored. Fig. 6 is a schematic diagram illustrating a minimum coordinate position and a maximum coordinate position of a first direction axis according to an embodiment of the present invention, where 8 and 9 points encircled by a box in fig. 6 are the minimum coordinate position and the minimum coordinate position.
Step S206, a plurality of subdivision points are set on the longest connection line, and a first plane perpendicular to the first direction axis is set on each subdivision point, so as to obtain a plurality of first planes.
During specific implementation, a plurality of subdivision points can be uniformly arranged on the longest connecting line, or a plurality of subdivision points can be non-uniformly arranged, and the rule for setting the subdivision points can be set according to research and development requirements; after obtaining the plurality of division points, a first plane perpendicular to the first direction axis is disposed at each division point.
In practical applications, the step S206 can be implemented by the following steps 20-21:
and step 20, averagely setting a plurality of subdivision points on the longest connecting line.
In a specific implementation, a response node can be added and its segments channel is written into ch ("/null 1/X") and then is connected to a null node (also called a virtual node); the sample node can sample the line for multiple times and evenly subdivide points on the line; x represents the number of subdivided points, i.e., the number of subdivided points, which can be input by the user, thereby controlling the number of model segmentation.
And step 21, copying a plurality of planes perpendicular to the first direction axis in the minimum circumscribed cuboid, and giving the copied planes to the subdivision points to obtain a first plane perpendicular to the first direction axis and arranged on each subdivision point.
Each subdivision point is provided with a first plane perpendicular to the first direction axis, and the size of the first plane is the same as that of a plane perpendicular to the first direction axis in the minimum circumscribed cuboid. Specifically, a plane perpendicular to the first direction axis in the minimum circumscribed cuboid may be moved to an origin position of world coordinates; and then copying the moved plane, and shifting the moved plane to the position of each subdivision point to obtain a first plane which is arranged on each subdivision point and is perpendicular to the first direction axis.
In practical applications, split _ prim _ by _ normal may be used on the smallest circumscribed cuboid of the model to be processed, so that the normal directions of the respective directional axes may be selected. The normal direction of the first direction axis is selected to obtain a surface on one side of the minimum circumscribed cuboid, namely the surface parallel to the normal direction of the first direction axis in the minimum circumscribed cuboid, and then the obtained plane is moved to the central position of world coordinates through the matchsize node.
The reason why the obtained plane is moved to the center of the world is that the plane needs to be copied later, the obtained plane is returned to the position of the center (coordinates (0, 0)) of the world, and the plane is copied without carrying displacement information. For example, if the center position of the plane is (0, 1, 0), all copied planes are shifted upward by one unit, and the shift is not wanted, so that the plane is copied after being returned to 0, thereby simplifying the operation.
Fig. 7 is a schematic diagram of a plurality of first planes provided by the embodiment of the present invention, where fig. 7 includes 9 subdivision points, which are numbered 0-8, and each subdivision point is provided with a first plane perpendicular to a first direction axis, where the first direction axis in fig. 7 is a Z axis.
Step S208, performing boolean operations on the plurality of first planes and the to-be-processed model to segment the to-be-processed model to obtain a first structure.
The boolean operations described above are digital symbolic logic deductions including union, intersection, subtraction, etc. operations that are introduced in graphics processing operations to make simple primitive graphics combinations produce new shapes. Specifically, boolean operations may be performed on the plurality of first planes and the model to be processed by using a bootean node (which may also be referred to as a boolean node).
In practical applications, the step S208 can be implemented by the following steps 30 to 31:
and step 30, overlapping the plurality of first planes and the model to be processed to obtain a processing result.
Step 31, determining a first structure based on the intersection of the first plane and the model to be processed in the processing result.
Specifically, the intersection of the first plane and the model to be processed in the processing result may be determined as the first structure, or the intersection of the first plane and the model to be processed in the processing result may be subjected to polygon extrusion operation according to a preset extrusion distance to obtain the first structure.
In a specific implementation, a Polyextrude node may be used to perform a polygon extrusion operation on an intersection of a first plane in a processing result and a plane to be processed, where the Polyextrude node has a function of extruding a plane, and distance is a parameter of the Polyextrude node, and the parameter is equivalent to a backlog distance and is used to control how much a distance (thickness) is extruded. The backlog distance can be manually controlled, and a user can set different distance values according to requirements, so that the personalized requirements of the model are facilitated.
In practical application, the backlog distance parameter is given to a newdiameter under a null node for control, all parameters which are required to be manually controlled subsequently are concentrated on the null node, the null node is conveniently controlled later, the parameters on the node can be freely adjusted by a user according to different use scenes, convenience is provided, and meanwhile, the degree of freedom is also considered. Fig. 8 is a schematic diagram illustrating an intersection of a first plane and a model to be processed in a processing result according to an embodiment of the present invention, and fig. 9 is a schematic diagram illustrating a first structure obtained after performing a squeeze operation according to an embodiment of the present invention.
Step S210, a plurality of second planes perpendicular to the second direction axis are arranged on the model to be processed, and the model to be processed is divided based on the plurality of second planes to obtain a second structure.
The manner of obtaining the second structure may be the same as that of obtaining the first structure, that is, replacing the first direction axis in steps S204-S210 with the first direction axis, to obtain a plurality of second planes perpendicular to the second direction axis, and then performing boolean operation on the plurality of second planes and the model to be processed to divide the model to be processed to obtain the second structure.
Step S212, generating an object model with a waffle structure based on the first structure and the second structure.
The model generation method comprises the steps of uniformly placing points on a single axis of a model to be processed, copying each point to a plane, extruding a polygon from the plane, performing the same treatment on the other axis after performing Boolean treatment on the original model, and performing comprehensive operation on the obtained result to generate a target model with a waffle structure, wherein the method abandons a manual modeling process and makes a tool to replace the modeling process, so that the model with the waffle structure can be quickly generated; especially when a large number of models of the same type are processed, the efficiency is higher.
The embodiment of the present invention further provides another model generation method, which is implemented on the basis of the above embodiment, and the method focuses on describing a specific process (implemented by steps S306 to S310 described below) in which a plurality of second planes perpendicular to a second direction axis are set on a model to be processed, the model to be processed is divided based on the plurality of second planes, so as to obtain a second structure, and a specific process (implemented by steps S312 to S316 described below) in which a target model having a waffle structure is generated based on a first structure and the second structure; as shown in fig. 10, the method includes the following specific steps:
step S302, a model to be processed is obtained.
Step S304, a plurality of first planes perpendicular to the first direction axis are arranged on the model to be processed, and the model to be processed is divided based on the plurality of first planes to obtain a first structure.
Step S306, determining the longest connecting line of the model to be processed on the second direction axis.
The first direction axis is a direction axis different from the second direction axis, and for example, the first direction axis may be a Z axis and the second direction axis may be an X axis. And arranging a minimum external cuboid at the periphery of the model to be processed to surround the model to be processed, then determining the maximum coordinate position and the minimum coordinate position of the minimum external cuboid on a second direction axis, and determining the connection line of the maximum coordinate position and the minimum coordinate position as the longest connection line of the model to be processed on the second direction axis.
In specific implementation, the maximum coordinate position and the minimum coordinate position of the minimum external cuboid on the second direction axis can be obtained through a second preset program. For example, the position coordinates of the maximum first direction axis, the maximum second direction axis, and the maximum third direction axis (that is, the coordinate positions of the X axis, the Y axis, and the Z axis) of the minimum circumscribed cuboid and the position coordinates of the minimum first direction axis, the maximum second direction axis, and the minimum third direction axis may be obtained first, and then the maximum coordinate and the minimum coordinate of the second direction axis may be extracted from the position coordinates, so as to obtain the maximum coordinate position and the minimum coordinate position on the second direction axis, and the maximum coordinate position and the minimum coordinate position may be connected to obtain the longest connection line, and the longest connection line may be set in the data Px for subsequent calling. The second preset program includes the following codes:
v@max=getbbox_max(0);
v@min=getbbox_min(0);
vector zp0=set(0,0,@max.z);
vector zp1=set(0,0,@min.z);
int np0=addpoint(0,zp0);
int np1=addpoint(0,zp1);
intnewprimz=addprim(0,"polyline",np0,np1);
setprimgroup(0,"pz",newprimz,1)。
wherein zp0= set (0, @ max.z) represents the maximum coordinate position of the second direction axis; zp1= set (0, @ min.z) denotes a minimum coordinate position where the second direction axis is acquired, and px is an array.
Step S308, a plurality of subdivision points are arranged on the longest connecting line, and a second plane perpendicular to the second direction axis is arranged on each subdivision point to obtain a plurality of second planes.
In specific implementation, a plurality of subdivision points may be uniformly or non-uniformly arranged on the longest connecting line, and the rule for setting the subdivision points may be set according to research and development requirements. In a specific implementation, a response node can be added and its segments channel can be written into ch ("/null 1/Y") and then be connected to a null node (also called a virtual node); where Y represents the number of subdivided points, that is, the number of subdivided points, which can be input by the user, thereby controlling the number of model division.
And a second plane perpendicular to the second direction axis is arranged on each subdivision point, and the size of the second plane is the same as that of a plane perpendicular to the second direction axis in the minimum circumscribed cuboid. Specifically, a plane perpendicular to the second direction axis in the minimum circumscribed cuboid may be moved to the origin position of the world coordinate; and then copying the moved plane, and shifting the moved plane to the position of each subdivision point to obtain a second plane which is arranged on each subdivision point and is perpendicular to the second direction axis. Fig. 11 is a schematic diagram of a plurality of second planes provided by an embodiment of the present invention. Fig. 11 includes 9 subdivision points, each of which is provided with a second plane perpendicular to the second direction axis, which is the X axis in fig. 11.
In practical applications, split _ prim _ by _ normal may be used on the minimum bounding cuboid of the model to be processed, so that the normal directions of the respective directional axes may be selected. The normal direction of the second direction axis is selected to obtain a surface on one side of the minimum circumscribed cuboid, namely the surface parallel to the normal direction of the second direction axis in the minimum circumscribed cuboid, and then the obtained plane is moved to the central position of world coordinates through the matchsize node.
Step S310, performing boolean operations on the plurality of second planes and the to-be-processed model to segment the to-be-processed model to obtain a second structure.
The boolean operations described above are logical deductions of digital symbolization, including union, intersection, subtraction, and the like. Specifically, overlapping a plurality of second surfaces and the model to be processed to obtain a processing result; and then determining a second structure based on the intersection of the second plane and the model to be processed in the processing result. During specific implementation, the intersection of the second plane and the model to be processed in the processing result may be determined as the second structure, or the intersection of the second plane and the model to be processed in the processing result may be subjected to polygon extrusion operation according to a preset extrusion distance to obtain the second structure.
In practical applications, a Polyextrude node may be used to perform a polygon extrusion operation on the intersection of the second plane in the processing result and the plane to be processed, where the Polyextrude node has a function of extruding a plane, and distance is a parameter of the Polyextrude node, and the parameter is equivalent to the packing distance and is used to control how much the distance (thickness) is extruded. The backlog distance can be manually controlled, and a user can set different distance values according to requirements, so that the individualized requirements of the model are facilitated; meanwhile, parameters are freely adjusted by users according to different use scenes, convenience is provided, and the degree of freedom is also considered. Fig. 12 is a schematic diagram illustrating an intersection of a second plane and a model to be processed in a processing result according to an embodiment of the present invention, and fig. 13 is a schematic diagram illustrating a second structure obtained after performing a squeeze operation according to an embodiment of the present invention.
Step S312, perform boolean operations on the first structure and the second structure to obtain a third structure.
The boolean operations may be addition, intersection, or intersection operations. In a specific implementation, the step S312 can be implemented by the following steps 40 to 41:
and step 40, performing overlapping operation on the first structure and the second structure to obtain an overlapping result.
Step 41, determining a third structure based on the intersection of the first structure and the second structure in the overlapping result.
In a specific implementation, the intersection part of the first structure and the second structure in the overlapping result may be set as a third structure; it may also be determined that the intersection of the first structure and the second structure in the overlapping results comprises a plurality of individual models; and setting an external cuboid for each individual model based on the side length control parameter to obtain a third structure.
FIG. 14 is a schematic diagram of the overlapped result, and it can be seen from FIG. 14 that the overlapped result contains a plurality of independent individual models; the method comprises the steps of setting an external cuboid for each individual model to surround the individual model, specifically, surrounding a box (the box is also the external cuboid) and adding a Peak node for each individual model, wherein the Peak node carries distance parameters (equivalent to side length control parameters), and the size of an embedded gap in the model can be controlled through the parameters. The Peak nodes can translate element planes, points, edges, end points and the like along the normal direction.
Step S314, performing a merging operation on the first structure and the second structure to obtain a fourth structure.
In a specific implementation, the merge node may be used to perform a merge operation on the first structure and the second structure, so as to obtain a fourth structure. Fig. 15 is a schematic diagram of a fourth structure.
And step S316, subtracting the third structure from the fourth structure to obtain the target model with the waffle structure.
In specific implementation, the sub model of the bootean node is used, and the third structure can be subtracted from the fourth structure to obtain the target model with the waffle structure. FIG. 16 is a schematic diagram of an object model with a waffle structure.
In practical application, the process of model generation provided by the embodiment of the invention can be packaged into an HDA (Houdini Digital Assets) tool, that is, a plug-in tool for packaging the process of model generation into Houdini software, the model can be output into a waffle structure only by directly inputting the model to be processed, and the size of the cells of the waffle structure can be freely collocated; the output model can be used immediately after being unpacked, the original model appearance does not need to be adapted again, manual splicing and assembling are not needed, the traditional manual manufacturing process is completely eliminated, the Houdini program is used for automation, and the model manufacturing efficiency is improved.
According to the model generation method, the traditional manual manufacturing process is completely eliminated, the model with the waffle structure is automatically generated by using a program, the production efficiency can be further improved, the manufacturing period required by production can be shortened, and the consistency of the production result can be further ensured because of the programming. In addition, the method can be used in any graphic interface platform, can be conveniently used in a mainstream engine, has no platform limitation, and reduces the adaptation problem in the development process.
For the above method embodiment, an embodiment of the present invention further provides a model generation apparatus, as shown in fig. 17, the apparatus includes:
and the model obtaining module 90 is used for obtaining the model to be processed.
The first segmentation module 91 is configured to set a plurality of first planes perpendicular to the first direction axis on the model to be processed, and segment the model to be processed based on the plurality of first planes to obtain a first structure.
A second segmentation module 92, configured to set a plurality of second planes perpendicular to the second direction axis on the to-be-processed model, and segment the to-be-processed model based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle.
And a model generating module 93, configured to generate a target model with a waffle structure based on the first structure and the second structure.
The model generation device firstly obtains a model to be processed; further setting a plurality of first planes perpendicular to the first direction axis on the model to be processed, and dividing the model to be processed based on the plurality of first planes to obtain a first structure; setting a plurality of second planes perpendicular to a second direction axis on the model to be processed, and dividing the model to be processed based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle; then, based on the first structure and the second structure, an object model with a waffle structure is generated. According to the mode, after the model to be processed is obtained, the model to be processed can be automatically segmented to obtain the model with the waffle structure, compared with a mode of manually manufacturing the model with the waffle structure, the mode automatically completes model manufacturing through a program, a large amount of labor and time are saved, and the efficiency of model manufacturing is improved.
Specifically, the first dividing module 91 includes: the longest connecting line determining unit is used for determining the longest connecting line of the model to be processed on the first direction axis; the plane setting unit is used for setting a plurality of subdivision points on the longest connecting line, and setting a first plane perpendicular to a first direction axis on each subdivision point to obtain a plurality of first planes; and the dividing unit is used for carrying out Boolean operation on the plurality of first planes and the model to be processed so as to divide the model to be processed to obtain a first structure.
Further, the longest connection line determining unit is further configured to: generating a minimum external cuboid of the model to be processed; determining the maximum coordinate position and the minimum coordinate position of the minimum external cuboid on the first direction axis; and determining the connecting line of the maximum coordinate position and the minimum coordinate position as the longest connecting line of the model to be processed on the first direction axis.
Further, the plane setting unit is further configured to: averagely setting a plurality of subdivision points on the longest connecting line; a plurality of planes perpendicular to the first direction axis in the minimum circumscribed cuboid are copied, and the copied planes are given to the subdivision points to obtain a first plane perpendicular to the first direction axis and arranged at each subdivision point.
In a specific implementation, the plane setting unit is further configured to: moving a plane perpendicular to a first direction axis in the minimum external cuboid to an original point position of world coordinates; and copying the moved plane, and shifting the moved plane to the position of each subdivision point to obtain a first plane which is arranged on each subdivision point and is perpendicular to the first direction axis.
Further, the dividing unit is configured to: overlapping the first planes and the model to be processed to obtain a processing result; and determining a first structure based on the intersection of the first plane and the model to be processed in the processing result.
Specifically, the dividing unit is further configured to: and performing polygon extrusion operation on the intersection of the first plane and the model to be processed in the processing result according to a preset extrusion distance to obtain a first structure.
In practical applications, the second segmentation module 92 is configured to: determining the longest connecting line of the model to be processed on the second direction axis; setting a plurality of subdivision points on the longest connecting line, and setting a second plane perpendicular to a second direction axis on each subdivision point to obtain a plurality of second planes; and performing Boolean operation on the plurality of second planes and the model to be processed to segment the model to be processed to obtain a second structure.
Further, the model generating module 93 is further configured to: performing Boolean operation on the first structure and the second structure to obtain a third structure; carrying out merging operation on the first structure and the second structure to obtain a fourth structure; and subtracting the third structure from the fourth structure to obtain the target model with the waffle structure.
In a specific implementation, the model generating module 93 is further configured to: performing overlapping operation on the first structure and the second structure to obtain an overlapping result; a third structure is determined based on an intersection of the first structure and the second structure in the overlapping result.
In a specific implementation, the model generating module 93 is further configured to: determining a plurality of individual models included in an intersection of the first structure and the second structure in the overlapping result; and setting an external cuboid for each individual model based on the side length control parameter to obtain a third structure.
Further, the apparatus further includes a model preprocessing module configured to: setting a plurality of first planes perpendicular to a first direction axis on the model to be processed, and moving the central position of the model to be processed to the central position of world coordinates before the model to be processed is divided based on the first planes to obtain a first structure; and converting the moved model to be processed into a closed polygonal model so as to replace the polygonal model with the model to be processed and execute the subsequent steps.
The model generating apparatus provided in the embodiment of the present invention has the same implementation principle and technical effect as those of the foregoing method embodiments, and for the sake of brief description, reference may be made to corresponding contents in the foregoing method embodiments for parts that are not mentioned in the apparatus embodiments.
An embodiment of the present invention further provides an electronic device, as shown in fig. 18, where the electronic device includes a processor and a memory, where the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the method for controlling adjustment of the object.
Further, the electronic device shown in fig. 18 further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected by the bus 102.
The memory 100 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile memory (non-volatile memory), such as at least one disk memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 18, but that does not indicate only one bus or one type of bus.
The processor 101 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 101. The processor 101 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100, and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the method for controlling and regulating the object, and specific implementation may refer to method embodiments and will not be described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal device, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (15)

1. A method of model generation, the method comprising:
obtaining a model to be processed;
setting a plurality of first planes perpendicular to a first direction axis on the model to be processed, and dividing the model to be processed based on the plurality of first planes to obtain a first structure;
setting a plurality of second planes perpendicular to a second direction axis on the model to be processed, and dividing the model to be processed based on the second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle;
generating a target model having a waffle structure based on the first structure and the second structure.
2. The method according to claim 1, wherein the step of setting a plurality of first planes perpendicular to a first direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of first planes to obtain a first structure comprises:
determining the longest connecting line of the model to be processed on the first direction axis;
setting a plurality of subdivision points on the longest connecting line, and setting a first plane perpendicular to the first direction axis on each subdivision point to obtain a plurality of first planes;
and performing Boolean operation on the plurality of first planes and the model to be processed to segment the model to be processed to obtain the first structure.
3. The method of claim 2, wherein the step of determining the longest connecting line of the model to be processed on the first direction axis comprises:
generating a minimum external cuboid of the model to be processed;
determining the maximum coordinate position and the minimum coordinate position of the minimum circumscribed cuboid on the first direction axis;
and determining a connecting line of the maximum coordinate position and the minimum coordinate position as the longest connecting line of the model to be processed on the first direction axis.
4. The method of claim 3, wherein said step of providing a plurality of subdivision points on said longest link and providing a first plane perpendicular to said first directional axis at each of said subdivision points, resulting in said plurality of first planes, comprises:
averagely setting a plurality of subdivision points on the longest connecting line;
and copying a plurality of planes perpendicular to the first direction axis in the minimum circumscribed cuboid, and giving the copied planes to the subdivision points to obtain a first plane perpendicular to the first direction axis and arranged on each subdivision point.
5. The method according to claim 4, wherein the step of duplicating a plurality of planes perpendicular to the first direction axis in the minimum bounding cuboid and giving the duplicated planes to the subdivision points to obtain a first plane perpendicular to the first direction axis disposed at each of the subdivision points comprises:
moving a plane perpendicular to the first direction axis in the minimum external cuboid to an origin position of world coordinates;
copying the moved plane, and shifting the moved plane to the position of each subdivision point to obtain a first plane which is arranged on each subdivision point and is perpendicular to the first direction axis.
6. The method according to claim 2, wherein the step of performing a boolean operation on the plurality of first planes and the model to be processed to segment the model to be processed to obtain the first structure comprises:
overlapping the plurality of first planes and the model to be processed to obtain a processing result;
and determining the first structure based on the intersection of the first plane and the model to be processed in the processing result.
7. The method of claim 6, wherein the step of determining the first structure based on the intersection of the first plane and the model to be processed in the processing result comprises:
and performing polygon extrusion operation on the intersection of the first plane and the model to be processed in the processing result according to a preset extrusion distance to obtain the first structure.
8. The method according to claim 1, wherein the step of setting a plurality of second planes perpendicular to the second direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of second planes to obtain a second structure comprises:
determining the longest connecting line of the model to be processed on the second direction axis;
setting a plurality of subdivision points on the longest connecting line, and setting a second plane perpendicular to the second direction axis on each subdivision point to obtain a plurality of second planes;
and performing Boolean operation on the plurality of second planes and the model to be processed to divide the model to be processed to obtain the second structure.
9. The method of claim 1, wherein the step of generating the object model having the waffle structure based on the first structure and the second structure comprises:
performing Boolean operation on the first structure and the second structure to obtain a third structure;
carrying out merging operation on the first structure and the second structure to obtain a fourth structure;
and subtracting the third structure from the fourth structure to obtain the target model with the waffle structure.
10. The method of claim 9, wherein the step of performing a boolean operation on the first structure and the second structure to obtain a third structure comprises:
performing overlapping operation on the first structure and the second structure to obtain an overlapping result;
determining the third structure based on an intersection of the first structure and the second structure in the overlapping result.
11. The method of claim 10, wherein the step of determining the third structure based on the intersection of the first structure and the second structure in the overlapping result comprises:
determining a plurality of individual models included in an intersection of the first structure and the second structure in the overlapping result;
and setting an external cuboid for each individual model based on side length control parameters to obtain the third structure.
12. The method according to claim 1, wherein before the step of providing a plurality of first planes perpendicular to the first direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of first planes to obtain the first structure, the method further comprises:
moving the central position of the model to be processed to the central position of the world coordinate;
and converting the moved model to be processed into a closed polygonal model so as to replace the polygonal model with the model to be processed to execute the subsequent steps.
13. An apparatus for model generation, the apparatus comprising:
the model acquisition module is used for acquiring a model to be processed;
the first segmentation module is used for setting a plurality of first planes which are vertical to a first direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of first planes to obtain a first structure;
the second segmentation module is used for setting a plurality of second planes which are vertical to a second direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of second planes to obtain a second structure; the second direction shaft and the first direction shaft form a preset angle;
and the model generation module is used for generating a target model with a waffle structure based on the first structure and the second structure.
14. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the model generation method of any one of claims 1 to 12.
15. A computer-readable storage medium having stored thereon computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the model generation method of any of claims 1 to 12.
CN202211184378.2A 2022-09-27 2022-09-27 Model generation method and device and electronic equipment Pending CN115908695A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211184378.2A CN115908695A (en) 2022-09-27 2022-09-27 Model generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211184378.2A CN115908695A (en) 2022-09-27 2022-09-27 Model generation method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN115908695A true CN115908695A (en) 2023-04-04

Family

ID=86483992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211184378.2A Pending CN115908695A (en) 2022-09-27 2022-09-27 Model generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN115908695A (en)

Similar Documents

Publication Publication Date Title
US11928391B2 (en) Hybrid surface modelling with subdivision surfaces and NURBS surfaces
CN110167756B (en) Build direction based partitioning for building solid objects by additive manufacturing
US10614178B2 (en) Scalable and precise fitting of NURBS surfaces to large-size mesh representations
US20150127301A1 (en) Updating A CAD Model To Reflect Global Or Local Shape Changes
CN111127637A (en) Data processing method and device of three-dimensional model and electronic equipment
CN112765695B (en) Support body generation method, 3D printer, computer device, and storage medium
CN113724401B (en) Three-dimensional model cutting method and device, computer equipment and storage medium
CN112560125B (en) Generation method, generation system and preprocessing system of lattice structure model
CN112070908B (en) Automatic splitting method for three-dimensional model, computer equipment and storage medium
JP2002245098A (en) Method and device for generating hexahedral mesh
US10083264B1 (en) Systems and methods for implicit surface modeling
CN109683858B (en) Data processing method and device
CN114202642A (en) Method and device for filling oversized holes in three-dimensional triangulation network model
CN113538695A (en) Method and device for quickly discretizing complex curved surface with arbitrary boundary and storage medium
CN113781642A (en) Three-dimensional model multi-level LOD generation method based on face reduction algorithm
CN115908695A (en) Model generation method and device and electronic equipment
CN113274734B (en) Virtual scene generation method and device and terminal equipment
US20220374556A1 (en) Parameterization of digital organic geometries
CN112380612B (en) Rapid design method, device, medium and terminal suitable for ship outfitting platform
CN104750691A (en) User-defined webpage generation method and user-defined webpage generation device
JP2020155044A (en) Program compiling device, program compiling method, and program compiling program
CN112560203A (en) Parameter processing method and device for mechanical part and server
KR102156336B1 (en) Method for reconstructing three-dimensional shape
CN111813400B (en) Action event processing method and device, electronic equipment and computer storage medium
JP2004160858A (en) Method and device for generating data for optical stereo lithography from result of structural analysis

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination