Boolean operation method, device and equipment suitable for non-fluid and medium
Through face intersection and face segmentation, the intersection difference attributes of non-manifold bodies are identified, and the problem of errors in the processing of non-manifold geometry is solved, and efficient and accurate Boolean calculation results are achieved.
Patent Information
- Application Number
- CN202411079496.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-06
AI Technical Summary
Traditional Boolean calculation methods are prone to calculation errors or inaccurate results when dealing with non-manifold geometry, especially when data is easily lost or errored during the conversion process.
Using the method of face intersection and face segmentation, at least two original non-manifolds intersect faces, divide their faces according to the intersection line, identify the target non-manifold, and analyze and judge the Boolean operation between it and the original non-manifold. Relationship, determines the results of the Boolean operation through intersection, difference and union operations.
The calculation efficiency, accuracy and robustness of Boolean operations of non-manifold geometry is improved, and errors and inaccurate results of traditional methods in non-manifold situations are avoided, so that complex non-manifold geometry can be effectively handled.
Smart Images

Figure CN119091431A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer graphics processing, and in particular to a Boolean operation method, device, equipment and medium suitable for non-manifold bodies. Background Art
[0002] Boolean operations have important applications in computer graphics, especially in 3D modeling and computational geometry. Traditional Boolean operation methods are mainly designed for manifold geometries, but when dealing with non-manifold geometries, calculation errors or inaccurate results often occur. When dealing with Boolean operations on non-manifold geometries, some software converts the non-manifold into a manifold, performs Boolean operations on the manifold, and then converts it back to the non-manifold. Doing so can easily lead to data loss and errors during the conversion process. Therefore, a new Boolean operation method is needed that can effectively deal with non-manifold geometries to improve the efficiency, accuracy, and robustness of the calculation. Summary of the invention
[0003] The main problem to be solved by the present invention is to provide a Boolean operation method suitable for non-manifold bodies, so as to solve the problem that calculation errors or inaccurate results are prone to occur when the existing Boolean operation method processes non-manifold geometric bodies.
[0004] In order to solve the above technical problems, a technical solution adopted by the present application is to provide a Boolean operation method applicable to non-manifold bodies, the method comprising the following steps:
[0005] Performing surface intersection on at least two original non-manifold bodies, wherein the surface intersection refers to intersecting the surface between one original non-manifold body and another original non-manifold body so that the two original non-manifold bodies partially overlap;
[0006] According to the intersection lines between all the faces in each original non-manifold body whose faces intersect, all the faces of each original non-manifold body are segmented to obtain a first type of face set, wherein the first type of face set includes the faces of each original non-manifold body after segmentation;
[0007] According to the first type of face set, identifying the target non-manifold body;
[0008] Analyze and determine the Boolean operation relationship between the target non-manifold body and the original non-manifold body.
[0009] In some embodiments, before performing surface intersection on at least two original non-manifold bodies, the steps include:
[0010] The subordinate relationship between the faces included in the original non-manifold body and the original non-manifold body is recorded to obtain a second type of face set, where the second type of face set includes all faces of the original non-manifold body.
[0011] In some embodiments, the step of identifying the target non-manifold body according to the first type of face set includes the steps of:
[0012] Step S311, selecting a first face from the first type face set, determining the edges of the first face, and determining a positively associated face having the smallest positive angle with the first face among the associated faces corresponding to each edge of the first face, to form a first group of positively associated face sets;
[0013] Step S312, selecting a first positive association surface from the first group of positive association surface sets, determining each edge of the first positive association surface, and determining a positive association surface having the smallest positive angle with the first association surface among association surfaces corresponding to each edge of the first positive association surface, to form a second group of positive association surface sets;
[0014] Step S313, repeating step S312 until all positively associated faces related to the first face are traversed and found, and a target non-manifold body positively associated with the first face is obtained;
[0015] Step S314, selecting other faces except the first face from the first face set in turn, executing steps S311 to S313, and obtaining target non-popular bodies that are positively associated with other faces respectively.
[0016] In some embodiments, the step of identifying the target non-manifold body according to the first type of face set includes the steps of:
[0017] Step S321, selecting a first face from the first type face set, determining the edges of the first face, and determining a reverse associated face having the smallest reverse angle with the first face among the associated faces corresponding to each edge of the first face, to form a first reverse associated face set;
[0018] Step S322, selecting a first reverse association face from the first group of reverse association face sets, determining the edges of the first reverse association face, and determining a reverse association face having the smallest reverse angle with the first association face among the association faces corresponding to each edge of the first reverse association face, to form a second group of reverse association face sets;
[0019] Step S323, repeating step S322 until all reverse-associated faces related to the first face are traversed and found, and a target non-manifold body reversely associated with the first face is obtained;
[0020] Step S324, selecting other faces except the first face from the first face set in turn, executing steps S321 to S323, and obtaining target non-popular bodies that are reversely associated with other faces respectively.
[0021] In some embodiments, the target non-manifold body includes a first target non-manifold body, a second target non-manifold body, and a third target non-manifold body; and the analyzing and determining the Boolean operation relationship between the target non-manifold body and the original non-manifold body further includes the following intersection operation steps:
[0022] If all faces of the first target non-manifold body are referenced by the second target non-manifold body and the third target non-manifold body, then the first target non-manifold body is the intersection of the original non-manifold bodies where the second target non-manifold body and the third target non-manifold body are located respectively.
[0023] In some embodiments, the target non-manifold body includes a first target non-manifold body and a second target non-manifold body; the analyzing and determining the Boolean operation relationship between the target non-manifold body and the original non-manifold body further includes the following difference operation steps:
[0024] If all the faces of the second target non-manifold body include at least two faces that originally belonged to different original non-manifold bodies, and one of the faces is only referenced by the second target non-manifold body, and the other face is referenced by both the second target non-manifold body and the first target non-manifold body, then the second target non-manifold body is the difference set of different original non-manifold bodies.
[0025] In some embodiments, the step of analyzing and determining the Boolean operation relationship between the target non-manifold body and the original non-manifold body includes the following union operation step:
[0026] Step S41, selecting a first outer side surface from the first type of face set, determining each edge of the first outer side surface, and determining a face having the largest angle with the in-plane direction of the first outer side surface among the associated faces corresponding to each edge of the first outer side surface, to form a first group of in-plane associated face sets;
[0027] Step S42, selecting a first in-plane associated face from the first group of in-plane associated face sets, determining each edge of the first in-plane associated face, and determining, among the associated faces corresponding to each edge of the first in-plane associated face, an in-plane associated face having the largest angle with the in-plane direction of the first in-plane associated face, to form a second group of in-plane associated face sets;
[0028] Step S43, repeat step S42, and continuously search for new in-plane associated surfaces until all in-plane associated surfaces related to the first outer side surface are traversed and found, and a target non-manifold body having an in-plane associated relationship with the first outer side surface is obtained. The obtained target non-manifold body is the union of at least two original non-manifold bodies.
[0029] The present application also provides a Boolean operation device applicable to non-manifold bodies, comprising:
[0030] A surface intersection unit, used for performing surface intersection on at least two original non-manifold bodies;
[0031] A face segmentation unit, configured to segment all faces of each original non-manifold body according to intersection lines between all faces in each original non-manifold body whose faces intersect, to obtain a first type of face set, wherein the first type of face set includes the faces of each original non-manifold body after segmentation;
[0032] an identification unit, configured to identify a target non-manifold body according to the first type of face set;
[0033] A judgment unit is used to analyze and judge the Boolean operation relationship between the target non-manifold body and the original non-manifold body.
[0034] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0035] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0036] The beneficial effects of the present invention are as follows: the present invention discloses a Boolean operation method, device, equipment and medium applicable to non-manifold bodies, the method comprising: intersecting at least two original non-manifold bodies; segmenting all faces of each original non-manifold body according to the intersection lines between all faces in each original non-manifold body with intersecting faces, obtaining a first-class face set, the first-class face set including the faces after segmentation of each original non-manifold body; identifying the target non-manifold body according to the first-class face set; analyzing and judging the Boolean operation relationship between the target non-manifold body and the original non-manifold body. Among them, by using the traversal property of searching the edge-face relationship of non-manifold geometry, the Boolean operation of non-manifold bodies is simplified to a simple process of face intersection-face segmentation-identifying the target non-manifold body-judging the intersection and union difference attributes of the target non-manifold body, and has strong robustness when dealing with complex situations with multiple intersection areas. Therefore, the Boolean operation method of the present invention can handle complex non-manifold geometries, avoid the errors and inaccurate results produced by traditional methods in non-manifold situations, and can effectively improve the efficiency, accuracy and robustness of calculations. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a flow chart of an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0038] Figure 2It is a structural schematic diagram of an original non-manifold body in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0039] Figure 3 It is another structural schematic diagram of an original non-manifold body in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0040] Figure 4 It is a first-view schematic diagram of two original non-manifold bodies after the surface intersection of two original non-manifold bodies in one embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0041] Figure 5 It is a second perspective schematic diagram of two original non-manifold bodies after the surface intersection of two original non-manifold bodies in one embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0042] Figure 6 It is a perspective schematic diagram of two original non-manifold bodies after the surface intersection in one embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0043] Figure 7 It is a perspective magnified image of the overlapping part of two original non-manifold bodies after the surface intersection in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0044] Figure 8 It is a first-view schematic diagram of the intersection operation result and the difference operation result obtained in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0045] Fig. 9 It is a second perspective schematic diagram of the intersection operation result and the difference operation result obtained in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0046] Fig.10 It is a third perspective schematic diagram of a difference set operation result obtained in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0047] Fig.11 is a fourth perspective schematic diagram of another difference set operation result obtained in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0048] Fig.12 is a perspective schematic diagram of a first-angle view of a union operation result obtained in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0049] Fig.13 is a perspective schematic diagram of a second viewing angle of a union operation result obtained in an embodiment of a Boolean operation method applicable to non-manifold bodies of the present application;
[0050] Fig.14 It is a structural block diagram of an embodiment of a Boolean operation device applicable to non-manifold bodies of the present application;
[0051] Fig.15 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;
[0052] Fig.16 It is a schematic block diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0053] In order to facilitate the understanding of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings and specific embodiments. Preferred embodiments of the present invention are provided in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0054] It should be noted that, unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more related listed items.
[0055] like Figure 1 As shown, a Boolean operation method applicable to non-manifold bodies of the present invention is shown, comprising the following steps:
[0056] Step S1: Perform surface intersection on at least two original non-manifold bodies.
[0057] It should be noted that the face intersection is to intersect the face of one original non-manifold body with the face of another original non-manifold body so that a part of the two original non-manifold bodies overlap, wherein each original non-manifold body is an independent closed body.
[0058] Furthermore, in a preferred embodiment, before performing surface intersection on at least two original non-manifold bodies, the subordinate relationship between the faces contained in each original non-manifold body and the original non-manifold body can be recorded to obtain a second type of face set, which includes all the faces of each original non-manifold body.
[0059] like Figure 2 and Figure 3As shown, the specific structure of the first original body 1 and the second original body 2 is shown. The first original body 1 and the second original body 2 are both original non-popular bodies, and the first original body 1 and the second original body 2 include six faces respectively, wherein the first original body 1 includes relative a1 face 11 and a6 face 16, a2 face 12 and a4 face 14, a3 face 13 and a5 face 15, and the second original body 2 includes relative b1 face 21 and b6 face 26, b2 face 22 and b4 face 24, b3 face 23 and b5 face 25.
[0060] Therefore, the second type of face set includes all the faces of the first primitive body 1 and the second primitive body 2, that is, A2 = {a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, b6}, where A2 represents the second type of face set, a1~a6 represent a1 faces 11~a6 faces 16 of the first primitive body 1, and b1~b6 represent b1 faces 21~b6 faces 26 of the second primitive body 2.
[0061] like Figure 4-Figure 6 As shown, the results obtained from different viewing angles after the first primitive body 1 and the second primitive body 2 are intersected by plane, and the white dotted line in the figure is the intersection line between the planes of the first primitive body 1 and the second primitive body 2. Figure 4 and Figure 5 The figure shows the intersection lines between different faces that can be directly seen from different viewing angles after the first primitive body 1 and the second primitive body 2 intersect with each other. Figure 6 The intersection lines between all faces of the first primitive body 1 and the second primitive body 2 are shown. Figure 6 For perspective drawings, the a3 surface 13 and the b3 surface 23 are marked with black solid line frames of different thicknesses, and the b2 surface 22 is marked with a black dotted line frame, which can effectively prevent misidentification of the surfaces corresponding to the labels.
[0062] Step S2: segment all faces of each original non-manifold body according to the intersection lines between all faces in each original non-manifold body whose faces intersect, and obtain a first type of face set, wherein the first type of face set includes the faces of each original non-manifold body after segmentation.
[0063] like Figure 6 As shown, according to the white dotted line shown in the figure, that is, the intersection line between all the faces in the first primitive body 1 and the second primitive body 2 where the faces intersect, all the faces of the first primitive body 1 and the second primitive body 2 are segmented to obtain a first type of face set.
[0064] Specific, combined Figure 7-Figure 9After the first primitive body 1 and the second primitive body 2 are intersected, for each face with an intersection line in the second type of face set, two new faces are obtained by splitting them through two intersection lines. Among them, for the b1 surface 21, the first intersection line f1 and the second intersection line f2 are used to split, and the c1 surface 31 and the e1 surface 51 are obtained; for the a2 surface 12, the second intersection line f2 and the third intersection line f3 are used to split, and the c2 surface 32 and the d2 surface 42 are obtained; for the b3 surface 23, the third intersection line f3 and the fourth intersection line f4 are used to split, and the c3 surface 33 and the e3 surface 53 are obtained; for the a6 surface 16, the fourth intersection line f4 and the fifth intersection line f5 are used to split, and the c6 surface 36 and the d6 surface 46 are obtained; for the b4 surface 24, the fifth intersection line f5 and the sixth intersection line f6 are used to split, and the c4 surface 34 and the e4 surface 54 are obtained; for the a5 surface 15, the sixth intersection line f6 and the first intersection line f1 are used to split, and the c5 surface 35 and the d5 surface 45 are obtained.
[0065] Secondly, replace each intersecting face corresponding to the second type face set with the corresponding two new faces, and the first type face set can be obtained, that is:
[0066] A1={a1,c2,d2,a3,a4,c5,d5,c6,d6,c1,e1,b2,c3,e3,c4,e4,b5,b6},
[0067] A1 represents the first type of face set. Therefore, the first type of face set includes new faces obtained by segmenting faces with intersection lines between the first primitive body 1 and the second primitive body 2, and faces without intersection lines between the first primitive body 1 and the second primitive body 2.
[0068] It should be noted that the segmented surfaces still retain the subordinate relationship with the original non-manifold body. For example, the newly obtained c1 surface 31 and e1 surface 51 still belong to the second original body 2.
[0069] In this process, all faces of the original non-manifold bodies are segmented through the intersection lines between all faces in multiple original non-manifold bodies with intersecting faces, and the new faces obtained after segmentation are used to replace the corresponding faces with intersection lines in the second type of face set, thereby obtaining the first type of face set, and multiple target non-manifold bodies can be further identified based on the first type of face set.
[0070] In some other embodiments, it is not necessary to first obtain the second type of face set. All faces of the original non-manifold body can be directly segmented using intersection lines, and the first type of face set can be obtained by obtaining new faces obtained by segmenting faces without intersection lines and faces with intersection lines between multiple original non-manifold bodies.
[0071] Step S3: Identify the target non-manifold body according to the first type of face set.
[0072] like Figure 6-Figure 9 As shown, the overlapping surfaces of the first original body 1 and the second original body 2 are defined as the intersection surfaces, including the c1 surface 31, the c2 surface 32, the c3 surface 33, the c4 surface 34, the c5 surface 35 and the c6 surface 36. Figure 6 and Figure 7 It should be noted that, based on the center 10 of the overlapping part when the first original body 1 and the second original body 2 intersect, and taking the intersecting surface obtained after surface segmentation as a reference, the direction close to the center 10 is defined as the positive direction, and the target non-popular body associated with the positive direction can be identified according to the intersecting surface; the direction away from the center 10 is defined as the reverse direction, and the target non-popular body associated with the reverse direction can be identified according to the intersecting surface.
[0073] In this embodiment, step S3 includes the step of identifying the target non-popular body of positive association. Specifically, it includes the following sub-steps:
[0074] Step S311, selecting a first face from the first type face set, determining the edges of the first face, and determining a positively associated face having the smallest positive angle with the first face among the associated faces corresponding to each edge of the first face, to form a first group of positively associated face sets;
[0075] Step S312, selecting a first positive association surface from the first group of positive association surface sets, determining each edge of the first positive association surface, and determining a positive association surface having the smallest positive angle with the first association surface among association surfaces corresponding to each edge of the first positive association surface, to form a second group of positive association surface sets;
[0076] Step S313, repeating step S312 until all positively associated faces related to the first face are traversed and found, and a target non-manifold body positively associated with the first face is obtained;
[0077] Step S314, selecting other faces except the first face from the first type face set in turn, executing steps S311 to S313, and obtaining target non-popular bodies positively associated with other faces respectively.
[0078] For example, Figure 8 and Fig. 9As shown, the c1 surface 31 is selected as the first surface, the four edges of the c1 surface 31 are determined, and for each edge, a positively associated surface with the smallest positive angle with the c1 surface 31 is determined, which are the c2 surface 32, the c3 surface 33, the c4 surface 34 and the c5 surface 35, respectively. These four surfaces form a first group of positively associated surface sets; the c2 surface 32 is selected from the first group of positively associated surface sets as the first positively associated surface, the four edges of the c2 surface 32 are determined, and for each edge, a positively associated surface with the smallest positive angle with the c2 surface 32 is determined. The connected faces are c1 face 31, c3 face 33, c5 face 35 and c6 face 36, and these four faces constitute the second set of positively associated faces; similarly, all faces in the first set of positively associated faces are traversed to find all the positively associated faces related to c1 face 31, which are c2 face 32, c3 face 33, c4 face 34, c5 face 35 and c6 face 36, and these five faces are combined with c1 face 31 to obtain a target non-manifold body positively associated with c1 face 31, namely the first target body 3.
[0079] It should be noted that in the process of identifying the target non-manifold body, the used surfaces of the identified target non-manifold body will be recorded, and the forward and reverse directions of a surface will be used at most once. Therefore, the present application will not result in the same target non-manifold body being identified repeatedly, thereby improving efficiency and avoiding repeated identification.
[0080] In this embodiment, step S3 also includes the step of identifying the reversely associated target non-popular body. Specifically, it includes the following sub-steps:
[0081] Step S321, selecting a first face from the first type face set, determining the edges of the first face, and determining a reverse associated face with the smallest reverse angle with the first face among the associated faces corresponding to each edge of the first face, to form a first reverse associated face set;
[0082] Step S322, selecting a first reverse association face from the first group of reverse association face sets, determining the edges of the first reverse association face, and determining a reverse association face having the smallest reverse angle with the first association face among the association faces corresponding to each edge of the first reverse association face, to form a second group of reverse association face sets;
[0083] Step S323, repeating step S322 until all reverse-associated faces related to the first face are traversed and found, and a target non-manifold body reversely associated with the first face is obtained;
[0084] Step S324, selecting other faces except the first face from the first type face set in turn, executing steps S321 to S323, and obtaining target non-popular bodies that are reversely associated with other faces respectively.
[0085] For example, Figure 8-Figure 10As shown, the c1 surface 31 is selected as the first surface, and the four edges of the c1 surface 31 are determined. For each edge, a surface associated with the c1 surface 31 is determined, which are the c3 surface 33, the c4 surface 34, the d2 surface 42 and the d5 surface 45. Among them, the reverse-associated surfaces with the smallest reverse angle associated with the c1 surface 31 are the d2 surface 42 and the d5 surface 45, and these two surfaces form a first set of reverse-associated surface sets; the d2 surface 42 is selected as the first reverse-associated surface from the first set of reverse-associated surface sets, and the six edges of the d2 surface 42 are determined. For each edge, a reverse-associated surface with the smallest reverse angle associated with the d2 surface 42 is determined. The connected faces are a1 face 11, a3 face 13, c1 face 31, c3 face 33, c5 face 35 and d6 face 46, and these six faces constitute the second set of reverse-associated faces; similarly, all faces in the first set of reverse-associated faces are traversed to find all reverse-associated faces related to c1 face 31, which are a1 face 11, a3 face 13, a4 face 14, c3 face 33, c4 face 34, d2 face 42, d5 face 45 and d6 face 46, and these eight faces are combined with c1 face 31 to obtain a target non-manifold body reversely associated with c1 face 31, namely the second target body 4.
[0086] Correspondingly, the step of identifying the third target 5 is similar to the step of identifying the second target 4, and will not be described in detail here.
[0087] In this process, a plurality of independent closed bodies which do not intersect each other but are interconnected can be obtained, namely, a first target body 3, a second target body 4 and a third target body 5, which are convenient for subsequent analysis and judgment.
[0088] Step S4: Analyze and determine the Boolean operation relationship between the target non-manifold body and the original non-manifold body.
[0089] It should be noted that reference means that a referenceable face belongs to the face that constitutes the corresponding target non-manifold body. The face that can be directly seen on a target non-manifold body is the front side of the referenceable face, and if the referenceable face is referenced by another target non-manifold body at the same time, the face that can be directly seen on the other target non-manifold body and corresponds to the referenceable face is the back side of the referenceable face.
[0090] The target non-manifold body includes a first target non-manifold body, a second target non-manifold body and a third target non-manifold body, and the corresponding step S4 includes an intersection operation, and the specific operation of the intersection operation is:
[0091] If all faces of the first target non-manifold body are referenced by the second target non-manifold body and the third target non-manifold body, then the first target non-manifold body is the intersection of the original non-manifold bodies where the second target non-manifold body and the third target non-manifold body are located respectively.
[0092] Combination Figure 8-Figure 10, taking c1 face 31 as an example, if the face that can be directly seen by the first target body 3 is the front face of c1 face 31, then the face that can be directly seen by the second target body 4 is the back face of c1 face 31, that is, c1 face 31 of the first target body 3 is referenced by the second target body 4. For the other faces of the first target body 3, by analogy, it can be obtained that the six faces of the first target body 3 are all referenced by the second target body 4 and the third target body 5, and the first target body 3 is the intersection of the first original body 1 (where the second target body 4 is located) and the second original body 2 (where the third target body 5 is located).
[0093] Wherein, step S4 also includes a difference set operation, and the specific operation of the difference set operation is:
[0094] If all the faces of the second target non-manifold body contain at least two faces that originally belonged to different original non-manifold bodies, and one of the faces is only referenced by the first newly obtained target non-manifold body, and the other face is referenced by both the second target non-manifold body and the first target non-manifold body, then the second target non-manifold body is the difference set of different original non-manifold bodies.
[0095] like Figure 8-Figure 10 As shown, since the segmented faces still retain the subordinate relationship with the original non-manifold body, the nine faces corresponding to the second target body 4 include the d2 face 42 originally belonging to the first original body 1 and the c4 face 34 originally belonging to the second original body 2, and the d2 face 42 is only referenced by the second target body 4, while the c4 face 34 is referenced by both the second target body 4 and the first target body 3. Therefore, the second target body 4 is the difference set of the first original body 1 clipped by the second original body 2.
[0096] Combination Fig.11 The nine faces of the third target body 5 include the e4 face 54 originally belonging to the second original body 2 and the c2 face 32 originally belonging to the first original body 1, and the e4 face 54 is only referenced by the third target body 5, while the c2 face 32 is referenced by both the third target body 5 and the first target body 3. Therefore, the third target body 5 is the difference set of the second original body 2 clipped by the first original body 1.
[0097] Since the first original body 1 and the second original body 2 are interconnected after the face intersection, the intersection line at the face intersection associates multiple faces, and the outer contour of the non-manifold geometry divided after the face intersection is identified, and the non-manifold body composed of the closed space formed by this outer contour is the union of the first original body 1 and the second original body 2, that is, the fourth target body 6. Therefore, step S4 also includes a union operation.
[0098] The specific operation of the union operation is:
[0099] Step S41, selecting a first outer side surface from the first type of face set, determining the edges of the first outer side surface, and determining a face having the largest angle with the in-plane direction of the first outer side surface among the associated faces corresponding to each edge of the first outer side surface, to form a first group of in-plane associated face sets;
[0100] Step S42, selecting a first in-plane associated face from the first group of in-plane associated face sets, determining the edges of the first in-plane associated face, and determining an in-plane associated face having the largest angle with the in-plane direction of the first in-plane associated face among the associated faces corresponding to each edge of the first in-plane associated face, to form a second group of in-plane associated face sets;
[0101] Step S43, repeat step S42, and continuously search for new in-plane associated surfaces until all in-plane associated surfaces related to the first outer side surface are traversed and found, and a target non-manifold body having an in-plane associated relationship with the first outer side surface is obtained. The obtained target non-manifold body is the union of at least two original non-manifold bodies.
[0102] In this embodiment, when selecting the first outer side surface from the first type of face set, a ray is emitted from a certain point on the first primitive body 1 and the second primitive body 2 after the faces intersect, passing through the first primitive body 1 and the second primitive body 2, and the face that the ray finally passes through is the outer side surface, which can be selected as the first outer side surface. It should be noted that the face with the largest in-plane direction angle of the first outer side surface, that is, the in-plane associated face, all belong to the outer side surface. The in-plane direction is the direction of the corresponding face toward the inside of the target non-manifold body, and the in-plane direction angle is the angle between a certain outer side surface and the adjacent face opening toward the inside of the target non-manifold body, so that the adjacent face with the largest in-plane direction angle also belongs to the outer side surface. The in-plane association relationship refers to the association relationship between adjacent outer side surfaces.
[0103] For example, Fig.12 and Fig.13As shown, the a1 surface 11 is selected as the first outer surface, and the four edges of the a1 surface 11 are determined. For each edge, an in-plane associated surface with the largest angle with the in-plane direction of the a1 surface 11 is determined, which are the a3 surface 13, the d2 surface 42, the d5 surface 45 and the a4 surface 14. These four surfaces form a first group of in-plane associated surface sets; the a3 surface 13 is selected from the first group of in-plane associated surface sets as the first in-plane associated surface, and the four edges of the a3 surface 13 are determined. For each edge, an in-plane associated surface with the largest angle with the in-plane direction of the a3 surface 13 is determined, which are the a1 surface 11, the d2 surface 42, the d5 surface 45 and the a4 surface 14. , d6 face 46 and a4 face 14, these four faces constitute the second set of in-plane associated face sets; and so on, traverse all faces in the first set of in-plane associated face sets, find all in-plane associated faces related to a1 face 11, which are a3 face 13, a4 face 14, b2 face 22, b5 face 25, b6 face 26, d2 face 42, d5 face 45, d6 face 46, e1 face 51, e3 face 53 and e4 face 54, combine these eleven faces with a1 face 11, and obtain a target non-manifold body with an in-plane association relationship with a1 face 11, that is, the fourth target body 6. This fourth target body 6 is composed of the outer contours of the first original body 1 and the second original body 2 after the faces intersect, that is, the union of the first original body 1 and the second original body 2.
[0104] In this process, the intersection and difference properties of the multiple target non-manifold bodies are determined through the association relationship between the multiple faces, thereby determining the Boolean operation relationship between the target non-manifold body and the original non-manifold body.
[0105] It should be noted that, in the above-mentioned embodiments, Boolean operations are mainly performed on the first primitive body 1 and the second primitive body 2 with intersecting surfaces, and in some other embodiments, Boolean operations may be performed on primitive non-manifold bodies with multiple intersecting surfaces. The specific operations are similar to the Boolean operations on the first primitive body 1 and the second primitive body 2 with intersecting surfaces, and will not be repeated here.
[0106] Based on the same inventive concept, Fig.14 As shown, the present application also provides a Boolean operation device suitable for non-manifold bodies, comprising:
[0107] A surface intersection unit 101, used for performing surface intersection on at least two original non-manifold bodies;
[0108] A face segmentation unit 102 is used to segment all faces of each original non-manifold body according to intersection lines between all faces in each original non-manifold body where the faces intersect, to obtain a first type of face set, wherein the first type of face set includes faces of each original non-manifold body after segmentation;
[0109] An identification unit 103, configured to identify a target non-manifold body according to the first type of face set;
[0110] The judging unit 104 is used to analyze and judge the Boolean operation relationship between the target non-manifold body and the original non-manifold body.
[0111] In the present application, other technical features in the above-mentioned Boolean operation device applicable to non-manifold bodies are the same as the features disclosed in the above-mentioned method embodiment, and will not be repeated here.
[0112] Based on the same inventive concept, the present application also provides an electronic device, including:
[0113] A processor, a memory and a communication circuit, wherein the processor is connected to the memory and the communication circuit respectively;
[0114] The communication circuit is used for communication connection, the memory is used for storing a computer program, and the processor is used for executing the computer program to implement the above-mentioned Boolean operation method.
[0115] See also Fig.15 The electronic device described in the embodiment of the present application may specifically include a processor 210 and a memory 220. The memory 220 is coupled to the processor 210.
[0116] The processor 210 is used to control the operation of the electronic device. The processor 210 may also be referred to as a CPU (Central Processing Unit). The processor 210 may be an integrated circuit chip having the ability to process signals. The processor 210 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 210 may also be any conventional processor, etc.
[0117] The memory 220 is used to store computer programs, and may be a RAM, a ROM, or other types of storage terminals. Specifically, the memory 220 may include one or more computer-readable storage media, which may be non-transitory or transient. The memory 220 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage terminals, flash memory storage terminals. In some embodiments, the non-transitory computer-readable storage medium in the memory 220 is used to store at least one program code.
[0118] The processor 210 is used to execute the computer program stored in the memory 220 to implement the methods described in the various method embodiments of the present application.
[0119] In some embodiments, the electronic device may further include: a peripheral terminal interface 230 and at least one peripheral terminal. The processor 210, the memory 220 and the peripheral terminal interface 230 may be connected via a bus or a signal line. Each peripheral terminal may be connected to the peripheral terminal interface 230 via a bus, a signal line or a circuit board. Specifically, the peripheral terminal includes: at least one of a radio frequency circuit 240, a display screen 250, an audio circuit 260 and a power supply 270.
[0120] The peripheral terminal interface 230 may be used to connect at least one peripheral terminal related to I / O (Input / output) to the processor 210 and the memory 220. In some embodiments, the processor 210, the memory 220, and the peripheral terminal interface 230 are integrated on the same chip or circuit board; in some other implementations, any one or two of the processor 210, the memory 220, and the peripheral terminal interface 230 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0121] The radio frequency circuit 240 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 240 communicates with the communication network and other IoT devices through electromagnetic signals, and the radio frequency circuit 240 is the communication circuit of the electronic device. The radio frequency circuit 240 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 240 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, an operator identity module card, and the like. The radio frequency circuit 240 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 240 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0122] The display screen 250 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 250 is a touch display screen, the display screen 250 also has the ability to collect touch signals on the surface or above the surface of the display screen 250. The touch signal can be input to the processor 210 as a control signal for processing. At this time, the display screen 250 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 250 can be one, set on the front panel of the electronic device; in other embodiments, the display screen 250 can be at least two, respectively set on different surfaces of the electronic device or in a folding design; in other embodiments, the display screen 250 can be a flexible display screen, set on a curved surface or a folding surface of the electronic device. Even, the display screen 250 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 250 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).
[0123] The audio circuit 260 may include a microphone and a speaker. The microphone is used to collect sound waves from the operator and the environment, and convert the sound waves into electrical signals and input them into the processor 210 for processing, or input them into the radio frequency circuit 240 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged in different parts of the electronic device. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 210 or the radio frequency circuit 240 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 260 may also include a headphone jack.
[0124] The power supply 270 is used to power various components in the electronic device. The power supply 270 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 270 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0125] For a detailed description of the functions and execution processes of each functional module or component in the electronic device embodiment of the present application, reference can be made to the description in the above-mentioned method embodiments of the present application, which will not be repeated here.
[0126] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the various embodiments of the electronic devices described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0127] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0128] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0129] Based on the same inventive concept, the present application also provides a computer-readable storage medium storing a computer program, which can be executed by a processor to implement the above-mentioned Boolean operation method.
[0130] See also Fig.16 , if the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium 300. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions / computer programs to enable an IoT device (which can be a personal computer, server, or network terminal, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks, and electronic terminals such as computers, mobile phones, laptops, tablet computers, cameras, etc. having the above-mentioned storage media.
[0131] The description of the execution process of the program data in the computer-readable storage medium can refer to the description in the above-mentioned method embodiments of the present application, and will not be repeated here.
[0132] It can be seen that the present invention discloses a Boolean operation method, device, equipment and medium suitable for non-manifold bodies, the method comprising: intersecting at least two original non-manifold bodies; segmenting all faces of each original non-manifold body according to the intersection lines between all faces in each original non-manifold body with intersecting faces, and obtaining a first type of face set, the first type of face set including the faces after segmentation of each original non-manifold body; identifying the target non-manifold body according to the first type of face set; analyzing and judging the Boolean operation relationship between the target non-manifold body and the original non-manifold body. Among them, by using the traversal property of searching the edge-face relationship of non-manifold geometry, the Boolean operation of non-manifold bodies is simplified to a simple process of face intersection-face segmentation-identifying the target non-manifold body-judging the intersection and union difference attributes of the target non-manifold body, and has strong robustness when dealing with complex situations with multiple intersection areas. Therefore, the Boolean operation method of the present invention can handle complex non-manifold geometries, avoid the errors and inaccurate results produced by traditional methods in non-manifold situations, and can effectively improve the efficiency, accuracy and robustness of calculations.
[0133] The above are only embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in other related technical fields, are included in the patent protection scope of the present invention.
Claims
1. A Boolean operation method applicable to non-manifold bodies, characterized in that: The method comprises the following steps: Performing surface intersection on at least two original non-manifold bodies, wherein the surface intersection refers to intersecting the surface between one original non-manifold body and another original non-manifold body so that the two original non-manifold bodies partially overlap; According to the intersection lines between all the faces in each of the original non-manifold bodies whose faces intersect, all the faces of each of the original non-manifold bodies are segmented to obtain a first type of face set, wherein the first type of face set includes the faces of each of the original non-manifold bodies after segmentation; According to the first type of face set, identifying the target non-manifold body; Analyze and determine the Boolean operation relationship between the target non-manifold body and the original non-manifold body.
2. The Boolean operation method according to claim 1, characterized in that: Before performing surface intersection of at least two original non-manifold bodies, the method comprises the following steps: The subordinate relationship between the faces included in the original non-manifold body and the original non-manifold body is recorded to obtain a second type of face set, where the second type of face set includes all faces of the original non-manifold body.
3. The Boolean operation method according to claim 1, characterized in that: The step of identifying a target non-manifold body according to the first type of face set comprises the following steps: Step S311, selecting a first face from the first type face set, determining the edges of the first face, and determining a positively associated face having the smallest positive angle with the first face among the associated faces corresponding to each edge of the first face, to form a first group of positively associated face sets; Step S312, selecting a first positively associated surface from the first group of positively associated surface sets, determining each edge of the first positively associated surface, and determining a positively associated surface having the smallest positive angle with the first positively associated surface among the associated surfaces corresponding to each edge of the first positively associated surface, to form a second group of positively associated surface sets; Step S313, repeating step S312 until all positively associated faces related to the first face are traversed and found, and a target non-manifold body positively associated with the first face is obtained; Step S314, selecting other faces except the first face from the first face set in turn, executing steps S311 to S313, and obtaining target non-popular bodies that are positively associated with the other faces respectively.
4. The Boolean operation method according to claim 1, characterized in that: The step of identifying a target non-manifold body according to the first type of face set comprises the following steps: Step S321, selecting a first face from the first type face set, determining the edges of the first face, and determining a reverse associated face having the smallest reverse angle with the first face among the associated faces corresponding to each edge of the first face, to form a first reverse associated face set; Step S322, selecting a first reverse association face from the first group of reverse association face sets, determining the edges of the first reverse association face, and determining a reverse association face having the smallest reverse angle with the first reverse association face among the association faces corresponding to each edge of the first reverse association face, to form a second group of reverse association face sets; Step S323, repeating step S322 until all reverse-associated faces related to the first face are traversed and found, and a target non-manifold body reversely associated with the first face is obtained; Step S324, selecting other faces except the first face from the first face set in turn, executing steps S321 to S323, and obtaining target non-popular bodies that are reversely associated with the other faces respectively.
5. The Boolean operation method according to claim 3 or 4, characterized in that: The target non-manifold body includes a first target non-manifold body, a second target non-manifold body and a third target non-manifold body; the analysis and determination of the Boolean operation relationship between the target non-manifold body and the original non-manifold body also includes the following intersection operation steps: If all faces of the first target non-manifold body are referenced by the second target non-manifold body and the third target non-manifold body, then the first target non-manifold body is the intersection of the original non-manifold bodies where the second target non-manifold body and the third target non-manifold body are located respectively.
6. The Boolean operation method according to claim 3 or 4, characterized in that: The target non-manifold body includes a first target non-manifold body and a second target non-manifold body; the analysis and determination of the Boolean operation relationship between the target non-manifold body and the original non-manifold body also includes the following difference operation steps: If all the faces of the second target non-manifold body include at least two faces that originally belonged to different original non-manifold bodies, and one of the faces is only referenced by the second target non-manifold body, and the other face is referenced by both the second target non-manifold body and the first target non-manifold body, then the second target non-manifold body is the difference set of different original non-manifold bodies.
7. The Boolean operation method according to claim 3 or 4, characterized in that: The analyzing and determining the Boolean operation relationship between the target non-manifold body and the original non-manifold body includes the following union operation steps: Step S41, selecting a first outer side surface from the first type of face set, determining each edge of the first outer side surface, and determining a face having the largest angle with the in-plane direction of the first outer side surface among the associated faces corresponding to each edge of the first outer side surface, to form a first group of in-plane associated face sets; Step S42, selecting a first in-plane associated face from the first group of in-plane associated face sets, determining each edge of the first in-plane associated face, and determining, among the associated faces corresponding to each edge of the first in-plane associated face, an in-plane associated face having the largest angle with the in-plane direction of the first in-plane associated face, to form a second group of in-plane associated face sets; Step S43, repeat step S42 until all in-plane associated surfaces related to the first outer side surface are traversed and found, and a target non-manifold body having an in-plane associated relationship with the first outer side surface is obtained, and the obtained target non-manifold body is the union of at least two original non-manifold bodies.
8. A Boolean operation device suitable for non-manifold bodies, characterized in that: include: A surface intersection unit, used for performing surface intersection on at least two original non-manifold bodies; A face segmentation unit, configured to segment all faces of each original non-manifold body according to intersection lines between all faces in each original non-manifold body whose faces intersect, to obtain a first type of face set, wherein the first type of face set includes the faces of each original non-manifold body after segmentation; an identification unit, configured to identify a target non-manifold body according to the first type of face set; A judgment unit is used to analyze and judge the Boolean operation relationship between the target non-manifold body and the original non-manifold body.
9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
