CN107564103B - Boolean parallel operation method of three-dimensional plane entity - Google Patents

Boolean parallel operation method of three-dimensional plane entity Download PDF

Info

Publication number
CN107564103B
CN107564103B CN201710711666.1A CN201710711666A CN107564103B CN 107564103 B CN107564103 B CN 107564103B CN 201710711666 A CN201710711666 A CN 201710711666A CN 107564103 B CN107564103 B CN 107564103B
Authority
CN
China
Prior art keywords
list
entity
point
face
turning
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.)
Active
Application number
CN201710711666.1A
Other languages
Chinese (zh)
Other versions
CN107564103A (en
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.)
Xidian University
Original Assignee
Xidian University
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 Xidian University filed Critical Xidian University
Priority to CN201710711666.1A priority Critical patent/CN107564103B/en
Publication of CN107564103A publication Critical patent/CN107564103A/en
Application granted granted Critical
Publication of CN107564103B publication Critical patent/CN107564103B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention relates to a Boolean operation method of a three-dimensional plane entity, which has the following basic idea: for each surface in the entity A, if the surface is completely outside the entity B, the surface is stored, if the surface is coplanar with the surface of the entity B in the same direction and is not an inner ring surface, the two surfaces carry out two-dimensional Boolean-union operation, the operation result is stored, if the surface does not belong to the two conditions, the entity B is cut by the surface to obtain a section polygon, the two-dimensional Boolean difference operation is carried out by the surface and the section polygon, and the operation result is stored; exchanging the entity A and the entity B, and performing the same treatment; and performing post-processing of deleting repeated surfaces, deleting suspended surfaces and combining surfaces on the stored result to finally obtain a Boolean parallel operation result of the entity A and the entity B. The method has the advantages of simplicity, feasibility, strict algorithm logic, good geometric completeness, small algorithm operand and the like, and can be used for three-dimensional entity modeling in the fields of CAD, CAM, CAE, computer animation, virtual reality, 3D printing and the like.

Description

Boolean parallel operation method of three-dimensional plane entity
Technical Field
The invention belongs to the technical field of computer graphics, and relates to a Boolean operation method of three-dimensional plane entities, in particular to a method for obtaining a new three-dimensional entity by Boolean operation of two three-dimensional plane entities.
Background
The Boolean parallel operation is one of the core algorithms of the Boolean operation of the three-dimensional plane entity, and can be used for three-dimensional entity modeling in the fields of CAD, CAM, CAE, computer animation, virtual reality, 3D printing and the like.
With the continuous development of computer graphics, especially the rapid development of three-dimensional visualization, virtual reality technology, 3D printing technology, etc., the three-dimensional modeling technology with independent intellectual property rights has become an urgent need in many fields, and the three-dimensional entity modeling technology based on boolean operations is the most important one. The boolean operations of the three-dimensional entities include a union operation, a difference operation, and an intersection operation. In modeling practice, the amount of overhead computation is used very little and the sum and difference computations are used much more. The solid Boolean operation is a main means for constructing a solid model, and has wide application in the aspects of model main body shape formation, model seamless connection, model splicing and the like. Furthermore, since the two-dimensional boolean operation is the basis of the three-dimensional boolean operation, it is considered that the difference operation (-) of the two-dimensional graphs a and B can be converted into a sum operation (+) i.e., a-B = a + (-B), and thus the sum operation is the basis of the difference operation. From the theoretical and practical aspects, the method has important academic significance and application value for the research of the three-dimensional entity Boolean's union operation.
Three-dimensional solid Boolean operations are well established in commercial software, but the implementation methods are rarely seen in the open literature. From a practical point of view, the BRep (boundary representation) method is a main implementation of three-dimensional boolean operations. The BRep method is to define a three-dimensional entity by using points, edges, surfaces, rings and mutual adjacent relations among the points, the edges, the surfaces, the boundary lines, the intersecting lines and the like of the entity are all given explicitly, and entities participating in Boolean operation, entities processed by geometric elements in the operation and entities obtained by the operation all adopt a BRep form. Since a surface can be approximated by a plane, boolean operations between planar entities are the basis for implementing modeling of complex entities, including surfaces.
The research on the BRep-form-based three-dimensional entity boolean operations is less published at present. The document "computer graphics" (published by Qinghua university, 8.1995, author: sun Guan) introduces a 'intersection sharing, classifying and merging' irregular three-dimensional body Boolean operation method proposed by Muuss and Butler in 1991, namely, intersection of the surfaces is firstly performed, two surface rings are topologically reconstructed by using Euler operator with an intersection line as a boundary, then geometric elements of points, edges and rings on each body are compared and classified with the other body to determine whether the geometric elements are in the other body or on the boundary, and finally geometric element classification results are cut according to the type of the union, intersection and difference operation to determine which elements are kept as results and which elements are discarded; the article 'Boolean arithmetic algorithm and realization based on entity model' (Shandong science and technology university Master academic thesis, 2007 5 months, author: chen Hui) aiming at two simple three-dimensional forms, adopts a Boolean arithmetic idea of 'sharing, classifying and merging' similar to Muuss and Butler to realize the mutual operation, realizes the difference operation based on the conversion relation between the mutual operation result and the difference operation and the mutual operation, and then combines to obtain the parallel operation of the two forms based on the mutual difference operation results of the two forms, namely, the mutual dependence between the operations, the difference operation dependence on the mutual operation, and the parallel operation dependence on the mutual operation and the two difference operations; the thesis "three-dimensional Boolean operation algorithm and implementation based on dimension reduction" (Shanghai university Master academic thesis, 2008. 2. Month, author: zhou Zhichao) proposes that the result of three-dimensional Boolean operation consists of a reserved surface and a modified surface, wherein the modified surface is obtained by traditional two-dimensional Boolean operation on a cut plane and a section plane, the acquisition methods of the reserved surface and the modified surface are different according to the types (sum, cross and difference) of the three-dimensional Boolean operation, and the three-dimensional Boolean operation and the two-dimensional Boolean operation of the article are both an operation type corresponding to an algorithm; the patent "a boolean operation method for three-dimensional planar entities" (ZL 201410369841.X, 1 month in 2017, inventor Xu Shejiao, etc.) proposes a boolean operation method for three-dimensional entities based on the determination of the inside and outside relations of shapes and the operation of two-dimensional inside clipping and outside clipping. The basic idea is that the result of Boolean operation of two three-dimensional plane entities A and B is composed of a reserved surface and a modified surface, four shared information linked lists A _ out _ B, A _ in _ B, B _ out _ A, B _ in _ A used for Boolean operation of the two entities are generated through internal and external relation judgment, internal cutting and external cutting operation, and then the Boolean operation result is formed by the shared information linked lists according to the Boolean operation type. This patent has the following problems: firstly, the condition that the surfaces of two plane entities are coplanar in the same direction is not considered, which can cause errors when the two entities are merged, so that the merging modeling which is frequently used in engineering can not be carried out; the second algorithm has redundant calculation, for example, A _ in _ B, B _ in _ A is not used for the union operation, A _ out _ B, B _ out _ A is not used for the intersection operation, A _ in _ B, B _ out _ A is not used for the difference operation A-B, and A _ out _ B, B _ in _ A is not used for the difference operation B-A. It can be seen that the following problems exist in the prior research results: (1) algorithm completeness lacks powerful theoretical support; (2) the algorithm is complex, and the realization difficulty is high; and (3) the algorithm is not efficient and has large calculation amount.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide a Boolean parallel operation method of a three-dimensional plane entity, which has simple algorithm, complete algorithm and small algorithm operation amount, aiming at the parallel operation in Boolean operation of the three-dimensional plane entity.
The purpose of the invention is realized as follows: a Boolean operation method of a three-dimensional plane entity is characterized by comprising the following steps: at least comprises the following steps:
step 101: sequentially reading the surface data of two entities A and B participating in operation, wherein the surface, ring, edge and Point information of the entity A is respectively stored in an A _ Face _ list, an A _ Loop _ list, an A _ Line _ list and an A _ Point _ list chain table, and the surface, ring, edge and Point information of the entity B is respectively stored in a B _ Face _ list, a B _ Loop _ list, a B _ Line _ list and a B _ Point _ list chain table; the solid surface is a plane polygon, which can have only one outer ring, or one outer ring and one or more inner rings;
step 102: setting a swap flag and a Boolean difference operation flag sub _ flag of an entity A and an entity B, defining and operating a result storage chain table Body _ list, and setting swap = false and sub _ flag = false;
step 103: marking the surfaces of the entity A and the entity B, if the surfaces are inner annular surfaces, marking the surfaces as non-0, and if the surfaces are non-inner annular surfaces, marking the surfaces as 0; the inner ring surface is a surface of which one edge on the outer ring is the other edge on the inner ring;
step 104: traversing the linked lists A _ Point _ list, A _ Line _ list, A _ Loop _ list and A _ Face _ list to obtain enclosure box values A.min.X, A.min.Y, A.min.Z, A.max.X, A.max.Y and A.max.Z of the entity A; traversing the linked lists B _ Point _ list, B _ Line _ list, B _ Loop _ list and B _ Face _ list to obtain bounding box values B.min.X., B.min.Y, B.min.Z, B.max.X, B.max.Y and B.max.Z of the entity B;
step 105: judging whether the bounding box of the entity A is separated from the bounding box of the entity B, if not, turning to the step 106, and if so, turning to the step 117;
step 106: traversing the linked lists A _ Point _ list, A _ Line _ list, A _ Loop _ list and A _ Face _ list of the entity A, and taking one surface F of the entity A A
Step 107: section F A Whether or not outside of entity B, if face F A Go to step 118 outside entity B, otherwise go to step 108;
step 108: traversing the linked lists B _ Point _ list, B _ Line _ list, B _ Loop _ list and B _ Face _ list of the entity B, and taking a surface F of the entity B B
Step 109: section F A Dough kneading F B Whether the coplanar surfaces are in the same direction and not inner annular surfaces, if the condition is met, turning to step 115, and if the condition is not met, turning to step 110; homodromous coplanar refers to two or more faces geometrically located on a plane and having the same direction of the external normal vector;
step 110: noodles F A Enlarged surface and surface F B Intersecting, wherein an intersecting line Duan Bao exists in a linked list A _ inter _ B; face F A The enlarged surface of (A) is defined as being in contact with F A On a plane and with a sufficiently large edge length (10) 6 ) The square surface of (2);
step 111: judging whether the surface of the entity B is processed or not, if not, turning to the step 108, and if so, turning to the step 112;
step 112: performing end-to-end connection on line segments in the linked list A _ inter _ B to construct a ring, and storing the constructed ring in a linked list Loop _ list; sum of the F planes with the normal vectors of the loops in Loop _ list A Comparing the directions of the normal vectors, if the directions are the same, the vertex sequence of the ring is not changed, otherwise, the vertex sequence of the ring is arranged in a reverse direction; finding out an inner ring in the Loop _ list, and reversely arranging the vertex of the inner ring in sequence; the finally obtained Loop _ list is the used surface F A The data of the section polygon F obtained by cutting the entity B on the expanded surface; clearing the linked list A _ inter _ B;
step 113: setting a boolean difference operation flag sub _ flag = true;
step 114: giving a cross-sectional polygon F to a face F B
Step 115: opposite face F A Dough kneading F B Performing parallel operation on the two-dimensional polygons, and storing operation results in a linked list _ out _ respectively; the linked list _ out _ stores partial results of three-dimensional parallel operation of the entity A and the entity B;
step 116: judging whether the surface of the entity A is processed or not, if so, turning to a step 119, and if not, turning to a step 106;
step 117: the method comprises the steps of enabling a linked list A _ out _ B = A _ Face _ list, enabling the linked list B _ out _ A = B _ Face _ list, combining the two linked lists A _ out _ B, B _ out _ A into the linked list Body _ list, and outputting and operating a result linked list Body _ list;
step 118: saving faces F of entity A A Go to linked list _ out _ go to step 116;
step 119: judging whether the swap flag swap is true, if so, going to step 122, and if not, going to step 120;
step 120: copying data in the linked list _ out _ into the linked list A _ out _ B, and clearing the linked list _ out _;
step 121: exchanging data of the entity A and the entity B, namely copying the information of the face, the ring, the edge and the point of the entity B to the entity A, copying the information of the face, the ring, the edge and the point of the entity A to the entity B, and juxtaposing swap = true, and going to step 103;
step 122: copying data in the linked list _ out _ into the linked list B _ out _ A, and clearing the linked list _ out _;
step 123: merging the data of the linked list A _ out _ B and the linked list B _ out _ A into the Body _ list, performing post-processing, and deleting the repeated surface and the hanging surface;
step 124: combining two or more surfaces which are coplanar in the same direction and have superposed line segments into one surface;
step 125: and outputting and operating a result linked list Body _ list.
In step 103, the surfaces of the entity a and the entity B are marked, if the surfaces are inner ring surfaces, the surfaces are marked as non-zero, and if the surfaces are non-inner ring surfaces, the surfaces are marked as zero, including the following steps:
step 201: reading surface information of an entity A from a linked list A _ Plane _ list, defining a variable count for marking a surface, wherein the initial value of the count is 0, and marking all the surfaces as the count initially;
step 202: let variable count = count +1;
step 203: reading one surface according to the storage sequence of the surfaces in the entity A;
step 204: judging whether the surface has an inner ring, if so, turning to step 205, and if not, turning to step 213;
step 205: taking out an inner ring according to the storage sequence, and pressing the vertex data of the inner ring into a linked list pt _ list;
step 206: reading one surface according to the storage sequence of the surfaces in the entity A;
step 207: judging whether the face mark value is not 0, if the condition is satisfied, turning to step 210, and if the condition is not satisfied, turning to step 208;
step 208: judging whether the outer ring vertex of the surface is in a linked list pt _ list, if not, turning to a step 210, otherwise, turning to a step 209;
step 209: let the face flag value be count;
step 210: judging whether the surface of the entity A is traversed or not, if so, turning to step 211, and if not, turning to step 206;
step 211: clearing the linked list pt _ list, and performing 1 adding operation on the mark value count;
step 212: judging whether the inner ring of the surface is traversed or not, if so, turning to the step 213, and if not, turning to the step 205;
step 213: judging whether the surface of the entity A is traversed or not, if so, turning to step 214, and if not, turning to step 203;
step 214: and (3) executing the steps 201 to 213 on the entity B, converting the data of the entity A in the steps into the data of the entity B, and marking the surface of the entity B.
In step 107, a cross section F is determined A Whether or not it is outside of entity B, includes the following stepsThe method comprises the following steps:
step 301: solving axial bounding boxes B.max.X, B.max.Y, B.max.Z, B.min.X, B.min.Y and B.min.Z of the entity B; finding the surface F A Axial bounding box F A .max.X、F A .max.Y、F A .max.Z、F A .min.X、F A .min.Y、F A .min.Z;
Step 302: judgment of F A If not, go to step 303, and if so, go to step 309;
step 303: judgment of F A If min.x is greater than b.max.x, if not, go to step 304, if true, go to step 309;
step 304: judgment of F A If not, go to step 305, and if yes, go to step 309;
step 305: judgment of F A If min.y is greater than b.max.y, if not, go to step 306, if true, go to step 309;
step 306: judgment of F A If not, go to step 307, if true, go to step 309;
step 307: judgment of F A If min.z is greater than b.max.z, if not, go to step 308, if true, go to step 309;
step 308: face F A Not necessarily outside entity B;
step 309: face F A Outside of entity B.
In step 109, shown, a face F is determined A Flour F B Whether homodromous coplane and neither is the interior anchor ring face includes the following step:
step 401: reading marked faces F A Flour F B Data;
step 402: section F A Dough kneading F B If the flag values are all zero, go to step 403, otherwise go to step 409;
step 403: respectively obtain the surfaces F A Dough kneading F B Unit of (2)A normal vector sum;
step 404: judging whether the sums are equal, if so, turning to the step 405, and if not, turning to the step 409;
step 405: from face F A Dough kneading F B Respectively taking a vertex on the outer ring of the point, ensuring that the two points are not the same point, and respectively recording the taken points as a point PotA and a point PotB;
step 406: using the point PotA and the point PotB as a straight line to calculate the direction vector;
step 407: section F A If the unit normal vector and the direction vector are vertical, turning to step 408, otherwise, turning to step 409;
step 408: face F A Dough kneading F B Coplanar in the same direction and not an inner ring surface;
step 409: face F A Dough kneading F B Not meeting homonymy coplanarity and not being an internal ring surface.
In step 115, shown, the opposite face F A Dough kneading F B Performing the parallel operation of the two-dimensional polygons, and storing the operation result in a linked list _ out _ comprises the following steps:
step 501: reading surface F A Dough kneading F B The data of (a);
step 502: section F A Dough kneading F B If the position relationship of the outer ring is intersected, go to step 503, if not, go to step 517;
step 503: definition of the marking surface F A Dough kneading F B Whether there is an intersection on the inner ring of (2) or not]And Cinner _ label [ 2 ]]The array size is respectively face F A Flour F B The number of inner rings of (2), initializing the array Minner _ label [ ]]And Cinner _ label [ 2 ]]All flag values of (a) are 0; judging the intersection relationship, and if the inner ring has an intersection point, making the mark values of the inner rings corresponding to the two surfaces be 1;
step 504: define save planes F separately A Dough kneading F B Array dataP of the vertices of (1), intersection information, and intersection in-out attribute]And dataQ [ 2 ]]Definition plane F A Go out of the dot array out Point 2](ii) a Firstly, flour F A Dough kneading F B The vertexes are stored in the array dataP [ 2 ]]<xnotran> dataQ [ </xnotran>]Setting the attribute value to 0, then finding the intersection point of two face rings, and judging the in-out attribute of the intersection point, if the intersection point is in point, its attribute value is 1, if the intersection point is out point, its attribute value is-1, inserting the intersection point and its attribute value into array dataP 2 according to the position of intersection point on the ring]And dataQ [ 2 ]]Performing the following steps; while mixing the noodles F A The out point of (A) is stored in the array out _ point [ 2 ]]Performing the following steps; the intersection being the "point of entry" means that the face F is at that point A Edge of (2) enters the surface F B The intersection point being "out point" means that the plane F is at that point A Is away from the face F B
Step 505: judging whether the Boolean difference operation flag sub _ flag is true, if true, turning to step 516, and if not, turning to step 506;
step 506: judging plane F A Dough kneading F B If there is an inner ring, go to step 515 if there is an inner ring, if there is no inner ring, go to step 507;
step 507: taking out a point from the point array out _ point [ ], and assigning a point variable PotTmp;
step 508: at the surface F A Array data _ P [ 2 ]]Finding out corresponding exit points in sequence;
step 509: this point is stored in the temporary result loop chain table looptmp. Point _ list, in dataP 2]From the point to the backward, if the vertex is encountered, the vertex is stored in the linked list looptmp B Array of (2) (dataQ [, ]]Find the corresponding point in (1), and store in the linked list looptmp. Point _ list, then in dataQ [, ]]The traversal is continued from the point to the back, the vertex is met and stored in a linked list looptmp B The point of entry then enters the plane F A Array of DataP [ 2 ]]Finding out the corresponding point;
step 510: judging whether the point is the same as the point PotTmp, if so, turning to step 511, and if not, turning to step 509;
step 511: storing points in the linked list loopTmp.Point _ list in the ring linked list tmpFace _ list, and clearing the linked list loopTmp.Point _ list;
step 512: section F A Go out of the dot array out Point 2]Whether the traversal is finished or not is judged, if the traversal is finished, the step is carried out to step 513, and if the traversal is not finished, the step is carried out to step 507;
step 513: the normal vector of each ring in the ring chain table tmpFace _ list is obtained, and the sum face F of the normal vector is judged A Whether the directions of the outer normal vectors are the same or not, if the directions are the same, the outer ring is formed, and if the directions are different, the inner ring is formed;
step 514: constructing a surface linked list according to the storage sequence of the outer ring and the inner ring, and storing the result into a parallel operation result linked list _ out _;
step 515: according to the array Minner _ label]And Cinner _ label [ 2 ]]Mark value judgment face F in (1) A Corresponding non-intersecting inner ring and surface F B The problem of removing and retaining the corresponding non-intersection inner ring is divided into the following two cases: in the first case, if the face F A In the plane F of the inner ring B The outer ring of (2), the inner ring remains if the face F A In the plane F of the inner ring B Inside the outer ring of (1) and in the plane F B If the inner ring is outside, the inner ring is not retained, if the face F A Inner ring of (F) B The inner ring is reserved; in the second case, if the face F B In the plane F of the inner ring A The outer ring of (2), the inner ring remains if the face F B Inner ring in the face F A Inside the outer ring of (1) and in the plane F A If the inner ring is outside, the inner ring is not retained, if the face F B In the plane F of the inner ring A The inner ring is reserved; storing the reserved environment protection in a ring linked list tmpFace _ list;
step 516: flour F B <xnotran> dataQ [ </xnotran>]The middle vertex and the intersection point are reversely arranged, set sub _ flag = false, and go to step 506;
517: section F A Dough kneading F B If the outer ring position relationship of (2) is separated, go to step 518, if not, go to step 519;
step 518: flour F A Inner and outer rings and face F B The inner and outer rings of the parallel operation are stored in a parallel operation result linked list _ out _ respectively;
step 519: if face F A Is in the plane F B The inner part of the outer ring is a storage surface F B If the plane F is in the parallel operation result linked list _ out A Outer ring of (2) is in the face F B The outer part of the outer ring, the retaining surface F A Go to the union operation result linked list _ out _ in step 503.
In step 123, post-processing is performed to remove the duplicate plane and the suspension plane, including the following steps:
step 601: taking out a surface F from the linked list body _ list;
step 602: traversing the other surfaces except the surface F in the body _ list of the linked list, if the surface F is repeated with the surface F 1 Then delete face F 1
Step 603: judging whether the surfaces in the body _ list are traversed or not, if so, turning to the step 604, and if not, turning to the step 601;
step 604: traversing the surfaces in the body _ list once, and storing the vertexes of all the surfaces in a point linked list pt _ list;
step 605: sequentially taking a face FF in the body _ list, setting a Boolean mark label, and juxtaposing label = false;
step 606: defining a variable count as the occurrence frequency of each vertex of the external ring of the surface FF in a linked list pt _ list;
step 607: taking a vertex on the outer ring of the surface FF, counting the number of times of occurrence count in pt _ list, and when count =1, letting label = true;
step 608: judging whether all vertexes on the FF outer ring are taken out or not; if the data is completely fetched, go to step 609, if the data is not completely fetched, go to step 607;
step 609: judging whether label is equal to true, if so, turning to step 612, and if not, turning to step 610;
step 610: judging whether the face in the body _ list is taken out completely, if so, finishing the algorithm, and if not, turning to the step 611;
step 611: let label = false, take out a surface from body _ list in order, give surface FF, go to step 607;
step 612: the surface FF is a suspension surface, the surface FF is deleted from the body _ list, and simultaneously label = false is made, and a linked list pt _ list is emptied; the hanging surface is a surface without an adjacent surface on at least one edge of the ring;
step 613: traversing the surfaces in the body _ list once, and storing vertexes of all the surfaces in a pt _ list of a point chain table;
step 614: and traversing the body _ list again, taking one of the surfaces in sequence and assigning the surface FF to the surface FF, and turning to the step 607.
In the step 124 shown, two or more surfaces that are coplanar and have coincident line segments are combined into one surface, which includes the following steps:
step 701: defining a linked list Plane _ list for storing all surfaces meeting the same-direction coplanar condition, defining a result linked list tmpPlane _ list after storage surface combination, and defining a side chain list Line _ list;
step 702: taking a surface F in the body _ list, and solving a unit normal vector of the surface F;
step 703: taking the next surface of the F surfaces according to the storage sequence and recording the next surface as F surface 1 Calculating the surface F 1 The unit normal vector of (1);
step 704: judging plane F and plane F 1 Whether the two surfaces are coplanar in the same direction, if so, turning to step 705, otherwise, turning to step 706;
step 705: flour F 1 Storing the list into Plane _ list, and deleting the surface F in body _ list 1
Step 706: judging whether the surfaces in the body _ list are completely taken, if so, turning to step 708, and if not, turning to step 707;
step 707: from face F 1 Taking one surface backward and giving it to the surface F 1 Calculating the surface F 1 Go to step 704;
step 708: judging whether the number of the surfaces stored in the Plane _ list is greater than or equal to 1, if the condition is met, turning to a step 709, and if the condition is not met, turning to the step 714;
step 709: storing the surface F into a linked list Plane _ list, and deleting the surface F in the body _ list;
step 710: storing the edges of all surfaces in the Plane _ list into an edge chain table Line _ list, deleting all superposed Line segments in the chain table Line _ list, and emptying the chain table Plane _ list;
step 711: connecting Line segments in the Line _ list end to construct a face ring;
step 712: short Line segments which are collinear in the surface ring constructed in the Line _ list and have repeated points are combined to form long Line segments;
step 713: storing the construction surface ring in the Line _ list into a linked list tmpPlane _ list;
step 714: taking the next surface after the surface F in the body _ list, assigning the next surface to the surface F, and calculating a unit normal vector of the surface F;
step 715: judging whether the faces in the body _ list are completely taken, if so, turning to a step 716, and if not, turning to a step 717;
step 716: adding the surfaces in the surface chain table tmpPlane _ list into the body _ list;
step 717: the next surface to the previous surface F is taken and given to the surface F 1 Obtaining a flour F 1 Go to step 704.
The invention has the following advantages:
(1) The proposed three-dimensional entity Boolean parallel operation algorithm is clear and simple in thought, high in algorithm modularization degree and easy to realize;
(2) The Boolean parallel operation algorithm has strict logic and high algorithm robustness;
(3) The Boolean parallel operation algorithm has high efficiency and small operation amount.
Drawings
FIG. 1 is a general flow chart of the present invention;
FIG. 2 is a flow chart of labeling faces of entity A and entity B;
FIG. 3 is a flow chart of determining whether a face of entity A is outside of entity B;
FIG. 4 is a flow chart of determining that the faces of entity A and entity B are co-planar in the same direction and neither is an inner annular face;
FIG. 5 is a flow chart of two-dimensional polygon merging operations for two surfaces;
FIG. 6 is a flow chart of deletion of duplicate and hanging surfaces present in the result of a union of two entities;
FIG. 7 is a flow chart for merging coplanar surfaces with coincident line segments present in the results of the two entity mergers;
FIG. 8 (a) is an exemplary diagram of a Boolean union operation performed by entity A and entity B;
FIG. 8 (B) is an exemplary diagram of a sectional polygon obtained when one surface of the solid A is cut through the solid B;
FIG. 9 (a) is a schematic and exemplary illustration of the case where the inner annular face of entity A and the non-inner annular face of entity B are heterodromously coplanar;
FIG. 9 (B) is a cross-sectional view of entity A cut through entity B;
FIG. 9 (c) is a cross-section taken from entity A and cut through entity B in FIG. 9 (B);
FIG. 9 (d) is a cross-sectional illustration of entity B with the non-inner annular surface cut through entity A;
FIG. 9 (e) is a cross-section taken through the non-inner annular surface of the solid B of FIG. 9 (d) and the non-inner annular surface;
FIG. 10 (a) is a sought and illustrated view of the case where the inner annular face of entity A and the non-inner annular face of entity B are co-planar in the same direction;
FIG. 10 (B) is a cross-sectional illustration of an inner annular surface of entity A truncated to entity B;
FIG. 10 (c) is a cross-section taken from the inner annular surface of the solid A of FIG. 10 (B) and taken through the solid B;
FIG. 10 (d) is an exemplary diagram of a cross-section of entity B with the non-inner circular surface truncated by entity A;
FIG. 10 (e) is a cross-section taken at the cut-away portion of the non-inner annular surface of the solid A of the solid B of FIG. 10 (d) and a view of the non-inner annular surface.
Detailed Description
The three-dimensional plane entity of the invention adopts a BRep expression form, namely points, edges, surfaces, rings and mutual adjacent relations between the points, the edges, the surfaces, the rings and the rings define the three-dimensional plane entity, wherein the vertex sequence of the outer ring of the surfaces is specified to be in a counterclockwise direction, and the vertex sequence of the inner ring of the surfaces is specified to be in a clockwise direction. The solid surface is a planar polygon, which may have only one outer ring, or may have one outer ring and one or more inner rings. The solid surface is divided into an inner ring surface and an non-inner ring surface, wherein the inner ring surface is a surface with one edge on the outer ring being one edge on the inner ring of the other surface.
The homodromous coplanarity in the invention refers to two or more surfaces which are geometrically positioned on a plane and have the same direction of the external normal vector, and the heterodromous coplanarity refers to two or more surfaces which are geometrically positioned on a plane and have opposite directions of the external normal vector; the repetitive surface refers to two surfaces satisfying the following three conditions: the unit normal vectors of two surfaces are the same, two surfaces are positioned on a plane geometrically, and all vertexes of the two surfaces are respectively the same; the hanging surface is a surface on which at least one edge of the ring has no adjacent surface.
Referring to fig. 1, the boolean union operation of two three-dimensional planar entities of the present invention includes the following steps:
step 101: sequentially reading the surface data of two entities A and B participating in operation, wherein the surface, ring, edge and Point information of the entity A are respectively stored in A _ Face _ list, A _ Loop _ list, A _ Line _ list and A _ Point _ list lists, the surface, ring, edge and Point information of the entity B are respectively stored in B _ Face _ list, B _ Loop _ list, B _ Line _ list and B _ Point _ list lists, referring to FIG. 8 (a), the entity A has 10 surfaces, wherein 6 non-inner surfaces and 4 inner surfaces, 6 non-inner ring surfaces are {1-2-6-5-1, 9-10-11-12-9}, {3-4-8-7-3, 13-16-15-14-13}, {2-3-7-6-2}, {1-5-8-4-1}, {1-4-3-2-1}, {5-6-7-8-5}, respectively, 4 inner ring surfaces are {12-11-15-16-12}, {9-13-14-10-9}, {9-12-16-13-9}, {10-14-15-11-10}, respectively, and 6 non-inner ring surfaces of the entity B are {1' -2' -6' -5' -1' }, {3' -4' -8' -7' -3' }, {2' -7' -6' -2' }, and {1' -5' -1' -4' -1' -6' -1' } {1'-4' -3'-2' -1'}, {5' -6'-7' -8'-5' };
step 102: setting swap flags swap and Boolean difference operation flags sub _ flag of an entity A and an entity B, defining and operating a result storage linked list Body _ list, and setting swap = false and sub _ flag = false;
step 103: marking the surfaces of the entity A and the entity B, if the surfaces are inner annular surfaces, marking the surfaces as non-0, and if the surfaces are non-inner annular surfaces, marking the surfaces as 0;
in step 103, the method for marking the faces of the entity a and the entity B, referring to fig. 2, includes the following steps:
step 201: reading the surface information of the entity A from the linked list A _ Plane _ list, defining a variable count for marking the surface, wherein the initial value of the count is 0, and initially marking all the surfaces as the count;
step 202: let variable count = count +1;
step 203: reading one surface according to the storage sequence of the surfaces in the entity A;
step 204: judging whether the surface has an inner ring, if so, turning to step 205, and if not, turning to step 213;
step 205: taking out an inner ring according to the storage sequence, pressing the vertex data of the inner ring into a linked list pt _ list, referring to fig. 8 (a), pressing the inner ring on the upper bottom surface of the entity A into the linked list pt _ list, wherein the inner ring is {9-10-11-12-9};
step 206: reading one surface according to the storage sequence of the surfaces in the entity A;
step 207: judging whether the face mark value is not 0, if the condition is satisfied, turning to step 210, and if the condition is not satisfied, turning to step 208;
step 208: judging whether the outer ring vertex of the surface is in the linked list pt _ list, if not, turning to the step 210, otherwise, turning to the step 209;
step 209: let the face flag value be count;
step 210: judging whether the surface of the entity A is traversed or not, if so, turning to a step 211, and if not, turning to a step 206;
step 211: clearing the linked list pt _ list, and performing 1 adding operation on the mark value count;
step 212: judging whether the inner ring of the surface is traversed or not, if so, turning to the step 213, and if not, turning to the step 205;
step 213: judging whether the surface of the entity A is traversed or not, if so, turning to step 214, and if not, turning to step 203; through the above steps, referring to FIG. 8 (a), the four inner ring surfaces {12-11-15-16-12}, {9-13-14-10-9}, {9-12-16-13-9}, {10-14-15-11-10} of entity A are marked as 1; if the entity has n inner rings, the corresponding marking value count is progressively marked to n, and the marking values of all the inner ring surfaces belonging to the same inner ring are the same;
step 214: and (5) executing the steps 201 to 213 on the entity B, converting the data of the entity A in the steps into the data of the entity B, and marking the surface of the entity B. Referring to fig. 8 (a), all planes of the entity B are non-inner ring planes, and the label values of all the planes are 0.
Step 104: traversing the linked lists A _ Point _ list, A _ Line _ list, A _ Loop _ list and A _ Face _ list to obtain bounding box values A.min.X, A.min.Y, A.min.Z, A.max.X, A.max.Y and A.max.Z of the entity A; traversing the linked lists B _ Point _ list, B _ Line _ list, B _ Loop _ list and B _ Face _ list to obtain bounding box values B.min.X, B.min.Y, B.min.Z, B.max.X, B.max.Y and B.max.Z of the entity B; referring to fig. 8 (a), the bounding box values a.min.x, a.min.y, a.min.z of entity a are the x, y, z coordinate values of vertex 4, respectively, and a.max.x, a.max.y, a.max.z are the x, y, z coordinate values of vertex 6, respectively; the bounding box values of the entity B, B.min.X, B.min.Y and B.min.Z are the x, y and z coordinate values of the vertex 4 'respectively, and B.max.X, B.max.Y and B.max.Z are the x, y and z coordinate values of the vertex 6' respectively;
step 105: judging whether the bounding box of the entity A is separated from the bounding box of the entity B, if not, turning to the step 106, and if so, turning to the step 117;
step 106: traversing the linked lists A _ Point _ list, A _ Line _ list, A _ Loop _ list and A _ Face _ list of the entity A, and taking one surface F of the entity A A
Step 107: section F A Whether or not outside of entity B, if face F A Go to step 118 outside entity B, otherwise go to step 108;
in step 107, the section F is judged A Method of being outside of entity B, with reference to fig. 3, comprising the following steps:
step 301: solving axial bounding boxes B.max.X, B.max.Y, B.max.Z, B.min.X, B.min.Y and B.min.Z of the entity B; finding the surface F A Axial bounding box F A .max.X、F A .max.Y、F A .max.Z、F A .min.X、F A .min.Y、F A .min.Z;
Step 302: judgment of F A If not, go to step 303, and if so, go to step 309;
step 303: judgment of F A If min.x is greater than b.max.x, if not, go to step 304, if true, go to step 309;
step 304: judgment of F A If not, go to step 305, and if yes, go to step 309;
step 305: judgment of F A If min.y is greater than b.max.y, if not, go to step 306, if true, go to step 309;
step 306: judgment of F A If not, go to step 307, if true, go to step 309;
step 307: judgment of F A If min.z is greater than b.max.z, if not, go to step 308, if true, go to step 309;
step 308: face F A Not necessarily outside entity B;
step 309: face F A Outside of entity B. Referring to FIG. 8 (a), it is judged that the planes {1-4-3-2-1}, {1-5-8-4-1} are outside of the entity B.
Step 108: traversing the linked lists B _ Point _ list, B _ Line _ list, B _ Loop _ list and B _ Face _ list of the entity B, and taking one surface F of the entity B B
Step 109: judging plane F A Flour F B Whether the coplanar surfaces are in the same direction and not inner annular surfaces, if the condition is met, turning to step 115, and if the condition is not met, turning to step 110;
in step 109, the surface F is judged A Dough kneading F B The method for determining whether the coplanar surfaces are coplanar and not inner annular surfaces refers to fig. 4, and comprises the following steps:
step 401: reading marked surfaces F A Flour F B Data;
step 402: section F A Dough kneading F B If the flag values are all zero, go to step 403, otherwise go to step 409;
step 403: respectively obtain the surfaces F A Dough kneading F B The unit normal vector sum of (1);
step 404: judging whether the sums are equal, if so, turning to the step 405, and if not, turning to the step 409;
step 405: from side F A Dough kneading F B Respectively taking a vertex on the outer ring of the point, ensuring that the two points are not the same point, and respectively recording the taken points as a point PotA and a point PotB;
step 406: using the point PotA and the point PotB as a straight line to calculate the direction vector;
step 407: section F A Whether the unit normal vector and the direction vector are vertical or not is judged, namely whether the sum is equal to 0 or not is judged, if the unit normal vector and the direction vector are vertical, the step 408 is carried out, and if the unit normal vector and the direction vector are not vertical, the step 409 is carried out;
step 408: face F A Dough kneading F B Coplanar in the same direction and not an inner ring surface; referring to FIG. 8 (a), it is determined that the top surfaces {1-2-6-5-1, 9-10-11-12-9} of entity A and {1' -2' -6' -5' -1' } of entity B belong to the same plane and are not inner planes;
step 409: face F A Dough kneading F B Not meeting homonymy coplanarity and not being an internal ring surface.
Step 110: noodles F A Enlarged surface and surface F B Intersecting line Duan Bao exists in linked list A _ inter _ B, and face F A The enlarged surface of (A) is defined as being in contact with F A On a plane and with a sufficiently large edge length (10) 6 ) The square surface of (2); referring to FIG. 8 (B), the intersection line segment of entity B is truncated by the plane {2-3-7-6-2} of entity A to be {9-10}, {10-11'}, {11' -10'}, and {10' -9};
step 111: judging whether the surface of the entity B is processed or not, if not, turning to the step 108, and if so, turning to the step 112;
step 112: the segments in the linked list A _ inter _ B are connected end to construct a ring, and the segments are connected end to endThe constructed ring is stored in a linked list Loop _ list; sum of the F planes with the normal vectors of the loops in Loop _ list A Comparing the normal vector directions, if the directions are the same, the vertex sequence of the ring is not changed, otherwise, the vertex sequence of the ring is reversely arranged; finding out an inner ring in the Loop _ list, and arranging the vertexes of the inner ring in a reverse order; the Loop _ list obtained finally is the use face F A The data of the section polygon F obtained by cutting the entity B on the expanded surface; clearing the linked list A _ inter _ B; referring to FIG. 8 (B), the ring formed by the line segments in A _ inter _ B connected end to end is {9-10-11'-10' -9}; the profile polygon F stored in the Loop _ list is {9-10-11'-10' -9};
and step 113: setting a boolean difference operation flag sub _ flag = true;
step 114: giving a cross-sectional polygon F to a face F B
Step 115: opposite face F A Dough kneading F B Performing parallel operation on the two-dimensional polygons, and storing the operation result in a linked list _ out _ in; the linked list _ out _ stores partial results of three-dimensional parallel operation of the entity A and the entity B;
in step 115, the opposite surface F A Dough kneading F B The method for performing the two-dimensional polygon union operation, referring to fig. 5, includes the following steps:
step 501: reading surface F A Dough kneading F B The data of (a);
step 502: section F A Dough kneading F B If the position relationship of the outer ring is intersected, go to step 503, if not, go to step 517;
step 503: definition of the marking surface F A Dough kneading F B Whether there is an intersection on the inner ring of (2) or not]And Cinner _ label [ 2 ]]The array size is respectively face F A Dough kneading F B The number of inner rings of (2), initializing the array Minner _ label [ ]]And Cinner _ label [ 2 ]]All flag values of (a) are 0; judging the intersection relationship, and if the inner ring has an intersection point, making the mark values of the inner rings corresponding to the two surfaces be 1; referring to FIG. 8 (a), the inner ring {9-10-11-12-9} of the plane {1-2-6-5-1, 9-10-11-12-9} is labeled as 0, and referring to FIG. 9 (a), the inner ring {9-10-11-12-9} of the plane {1-2-6-5-1, 9-10-11-12-9} is labeled as 1;
step 504: define save planes F separately A Flour F B The vertex, intersection information, and the intersection entrance/exit attribute of (1)]<xnotran> dataQ [ </xnotran>]Definition plane F A Go out of the dot array out Point 2](ii) a Firstly, flour F A Dough kneading F B The vertexes are stored in the array dataP [ 2 ]]<xnotran> dataQ [ </xnotran>]Wherein the attribute value is set to 0, then the intersection point of the two planar rings is obtained, and the in-out attribute of the intersection point is determined, wherein if the intersection point is the in-point, the attribute value is 1, if the intersection point is the out-point, the attribute value is-1, the intersection point and the attribute value are inserted into the array dataP [ 2 ], [ where the intersection point is located on the ring]And dataQ [ 2 ]]Performing the following steps; while mixing the noodles F A The out point of (A) is stored in the array out _ point [ 2 ]]Performing the following steps; the intersection being the "point of entry" means that the face F is at that point A Edge of (F) enters the face F B The intersection point is the "out point" which means that the surface F is at the point A Is away from the surface F B (ii) a Referring to FIG. 8 (a), top surface F of entity A A {1-2-6-5-1, 9-10-11-12-9} and Top face F of entity B B When the two-dimensional Boolean-union operation is performed {1' -2' -6' -5' -1' }, the intersection points of the plane rings are 9 and 11, and the plane F is oriented to the plane F A The intersection 9 is an entry point having an attribute value of 1, the intersection 11 is an exit point having an attribute value of-1, and the plane F after the entry point is inserted A Array of (1) (dataP 2)]Is {1-2-9-6-11-5, 9-10-11-12}, face F B Array of (2) (dataQ [, ]]Is {1'-9-2' -6'-5' -11}, face F A Go out of the dot array out Point 2]Is {11};
step 505: judging whether the Boolean difference operation flag sub _ flag is true, if true, turning to step 516, and if not, turning to step 506;
step 506: section F A Dough kneading F B If an inner ring exists, go to step 515, if no inner ring exists, go to step 507;
step 507: taking out a point from the point array out _ point [ ], and assigning a point variable PotTmp;
step 508: at the surface F A Array data _ P [ 2 ]]Finding out corresponding exit points in sequence;
step 509: this point is stored in the temporary result loop chain table looptmp. Point _ list, in dataP 2]Where the traversal continues from that point backward, encounteringThe top point is stored in the linked list loopTmp. Point _ list, and the entering point is encountered to enter the face F B Array of (2) (dataQ [, ]]Find the corresponding point in (1), and store in the linked list looptmp. Point _ list, then in dataQ [, ]]The traversal is continued from the point backward, the vertex is met and stored in the linked list looptmp B The point of entry then enters the plane F A Array of (1) (dataP 2)]Finding out the corresponding point;
step 510: judging whether the point is the same as the point PotTmp, if so, turning to step 511, and if not, turning to step 509;
step 511: storing points in the linked list loopTmp.Point _ list in the ring linked list tmpFace _ list, and clearing the linked list loopTmp.Point _ list;
step 512: section F A The out point array of (1) out _ point]Whether the traversal is finished or not is judged, if the traversal is finished, the step is carried out to step 513, and if the traversal is not finished, the step is carried out to step 507; referring to FIG. 8 (a), plane F A {1-2-6-5-1, 9-10-11-12-9} and face F B The {1'-2' -6'-5' -1'} results {11-5-1-2-9-2' -6'-5' -11} from step 507 to step 512 are stored in a circular linked list tmpFace _ list;
step 513: the normal vector of each ring in the ring chain table tmpFace _ list is obtained, and the sum face F of the normal vector is judged A Whether the directions of the outer normal vectors are the same or not, if the directions are the same, the outer ring is formed, and if the directions are different, the inner ring is formed; referring to FIG. 8 (a), plane F A {1-2-6-5-1, 9-10-11-12-9} and face F B When {1' -2' -6' -5' -1' } is performed and operated, after the step 512 and the step 515, the loops stored in the loop chain table tmpFace _ list are {9-10-11-12-9}, {11-5-1-2-9-2' -6' -5' -11}, and the outer loop is {11-5-1-2-9-2' -6' -5' -11} and the inner loop is {9-10-11-12-9} according to the normal vector judgment of the loops in the step;
step 514: constructing a surface linked list according to the storage sequence of the outer ring and the inner ring, and storing the result into a parallel operation result linked list _ out _; referring to FIG. 8 (a), plane F A {1-2-6-5-1, 9-10-11-12-9} and face F B {1'-2' -6'-5' -1'} storing the result of the merging operation {11-5-1-2-9-2' -6'-5' -11, 9-10-11-12-9} in a merging operation result linked list _ out \;
step 515: according to numberSet Minner _ label [ solution ]]And Cinner _ label [ 2 ]]Mark value judgment face F in (1) A Corresponding non-intersecting inner ring and surface F B The problem of removing and retaining the corresponding non-intersection inner ring is divided into the following two cases: in the first case, if the face F A In the plane F of the inner ring B The outer ring of (2), the inner ring remains if the face F A In the plane F of the inner ring B Inside the outer ring of (1) and in the plane F B If the inner ring is outside, the inner ring is not retained, if the face F A In the plane F of the inner ring B The inner ring is reserved; in the second case, if the face F B In the plane F of the inner ring A The outer ring of (2), the inner ring remains if the face F B Inner ring in the face F A Inside the outer ring of (1) and in the plane F A If the inner ring is outside, the inner ring is not retained, if the face F B In the plane F of the inner ring A The inner ring is reserved; storing the reserved environment protection in a ring linked list tmpFace _ list; referring to FIG. 8 (a), the plane F of the entity A A Inner ring {9-10-11-12-9} of {1-2-6-5-1, 9-10-11-12-9} is in face F of entity B B Outside the outer loop of {1'-2' -6'-5' -1}, the loop {9-10-11-12-9} is kept in the loop chain table tmpFace _ list;
step 516: flour F B <xnotran> dataQ [ </xnotran>]The middle vertex and the intersection point are reversely arranged, set sub _ flag = false, and go to step 506; referring to FIG. 8 (b), plane F of entity A A Cutting off the entity B by {2-3-7-6-2}, obtaining a section polygon F with the step 110 and the step 112 as {9-10-11'-10' -9}, and obtaining a face F with the step 113 and the step 114 B Is 9-10-11'-10' -9, after entering step 115, face F A {2-3-7-6-2} and face F B (9-10-11 '-10' -9) when the two-dimensional Boolean-parallel operation is performed, the intersection points of the face rings are 9 and 10 (points 6 and 7 do not count in the intersection point), and the plane F is the intersection point A The intersection 10 is an entry point having an attribute value of 1, the intersection 9 is an exit point having an attribute value of-1, and the surface F after the entry point is inserted A Array of (1) (dataP 2)]Is {2-3-10-7-6-9}, face F B Array of (2) (dataQ [, ]]Is {9-9 (intersection) -10-11'-10' }, face F A Go out of the dot array out Point 2]Is 9, after step 516, plane F is performed B Array dataQ [ 2 ]]Is {10'-11' -10-10 (intersection) -9}; through the steps ofAfter the step 506 is finished, the ring stored in the ring link table tmpFace _ list is {9-2-3-10-9}; after the steps 512, 513 and 514, the result {9-2-3-10-9} of the current combining operation is stored in the linked list _ out _ after;
517: section F A Dough kneading F B If the outer ring position relationship of (2) is separated, go to step 518, if not, go to step 519;
step 518: flour F A Inner and outer rings and face F B The inner and outer rings of the parallel operation are stored in a parallel operation result linked list _ out _ respectively;
step 519: if face F A Is in the plane F B The inner part of the outer ring is a storage surface F B If the plane F is in the parallel operation result linked list _ out A Is in the plane F B The outer part of the outer ring, the retaining surface F A Go to the union operation result linked list _ out _ in step 503.
Step 116: judging whether the surface of the entity A is processed or not, if so, turning to a step 119, and if not, turning to a step 106;
step 117: the method comprises the steps of enabling a linked list A _ out _ B = A _ Face _ list, enabling the linked list B _ out _ A = B _ Face _ list, combining the two linked lists A _ out _ B, B _ out _ A into the linked list Body _ list, and outputting and operating a result linked list Body _ list;
step 118: saving faces F of entity A A In the linked list _ out _ go to step 116;
step 119: judging whether the swap flag is true, if so, going to step 122, and if not, going to step 120;
step 120: copying data in the linked list _ out _ into the linked list A _ out _ B, and clearing the linked list _ out _; referring to fig. 8 (a) and table 1, table 1 shows the results of two linked lists a _ out _ B and B _ out _ a generated when the entity a and the entity B shown in fig. 8 (a) perform the boolean operation. The surfaces stored in the linked list A _ out _ B are {11-5-1-2-9-2'-6' -5'-11, 9-10-11-12-9}, {10-3-4-8-12-8' -7'-3' -10, 13-16-15-14-13}, {9-2-3-10-9}, {1-5-8-4-1}, {1-4-3-2-1}, {12-8-5-11-12}, {12-11-15-16-12}, {9-13-14-10-9}, {9-12-16-13-9}, and {10-14-15-11-10};
table 1 is as follows:
Figure BDA0001382832300000171
step 121: exchanging data of the entity A and the entity B, namely copying the face, the ring, the edge and the point information of the entity B to the entity A, copying the face, the ring, the edge and the point information of the entity A to the entity B, and then switching to the step 103, and then juxtaposing swap = true;
step 122: copying data in the linked list _ out _ into the linked list B _ out _ A, and clearing the linked list _ out _; referring to fig. 8 (a) and table 1, the planes stored in the linked list B _ out _ a are {11-5-1-2-9-2'-6' -5'-11, 9-10-11-12-9}, {10-3-4-8-12-8' -7'-3' -10, 13-16-15-14-13}, {2'-3' -7'-6' -2'}, {11-5' -8'-12-11}, {10-3' -2'-9-10}, and {5' -6'-7' -8'-5' };
step 123: merging the data of the linked list A _ out _ B and the linked list B _ out _ A into the Body _ list, performing post-processing, and deleting the repeated surface and the hanging surface; referring to FIG. 8 (a) and Table 1, the Body _ list stored planes obtained by merging the chain A _ out _ B and the chain B _ out _ A are {11-5-1-2-9-2'-6' -5'-11, 9-10-11-12-9}, {10-3-4-8-12-8' -7'-3' -10, 13-16-15-14-13}, {9-2-3-10-9}, {1-5-8-4-1}, {1-4-3-2-1}, {12-8-5-11-12}, {12-11-15-16-12}, and {9-13-14-10-9}, {9-12-16-13-9}, {10-14-15-11-10}, {11-5-1-2-9-2'-6' -5'-11, 9-10-11-12-9}, {10-3-4-8-12-8' -7'-3' -10, 13-16-15-14-13}, {2'-3' -7'-6' -2'}, {11-5' -8'-12-11}, {10-3' -2'-9-10}, {5' -6'-7' -8'-5' };
in step 123, a post-processing method is performed to delete the duplicate noodles and the hanging noodles, and with reference to fig. 6, the method includes the following steps:
step 601: taking out a surface F from the linked list body _ list;
step 602: traversing other surfaces except the surface F in the body _ list of the linked list, if a repeated surface F with the surface F exists 1 Then delete face F 1 (ii) a Referring to FIG. 8 (a) and Table 1, the Body \/list stored surfaces {11-5-1-2-9-2'-6' -5'-11, 9-10-11-12-9}, {10-3-4-8-12-8' -7'-3' -10, 13-16-15-14-13} are each repeated once and deleted, and the Body _ list stored surface after deleting the repeated surface is the surface in which the Body _ list is stored{11-5-1-2-9-2'-6'-5'-11、9-10-11-12-9}、{10-3-4-8-12-8'-7'-3'-10、13-16-15-14-13}、{9-2-3-10-9}、{1-5-8-4-1}、{1-4-3-2-1}、{12-8-5-11-12}、{12-11-15-16-12}、{9-13-14-10-9}、{9-12-16-13-9}、{10-14-15-11-10}、{2'-3'-7'-6'-2'}、{11-5'-8'-12-11}、{10-3'-2'-9-10}、{5'-6'-7'-8'-5'};
Step 603: judging whether the surfaces in the body _ list are traversed or not, if so, turning to the step 604, and if not, turning to the step 601;
step 604: traversing the surfaces in the body _ list once, and storing vertexes of all the surfaces in a pt _ list of a point chain table;
step 605: sequentially taking a face FF in the body _ list, setting a Boolean mark label, and juxtaposing label = false;
step 606: defining a variable count as the number of times of each vertex of the external ring of the surface FF appearing in a linked list pt _ list;
step 607: taking a vertex on the outer ring of the surface FF, counting the number count of times of occurrence in pt _ list, and when the count =1, letting label = true; referring to FIGS. 9 (a) and 9 (B), the inner ring plane {9-9' -10' -10-9} of entity A and the plane {1' -5' -8' -4' -1' } of entity B are heterodromous and coplanar, and the inner ring plane F is used A {9-9'-10' -10-9} truncation of the entity B, resulting in a profile F of {1'-4' -8'-5' -1}, which is assigned to the face F B Using flour F A {9-9'-10' -10-9} and face F B (ii) performing two-dimensional Boolean difference operation on {1' -4' -8' -5' -1' }, and referring to FIG. 9 (c), obtaining a plane by the operation as {1' -9-9' -4' -1' }; after exchanging entity A and entity B, use face F of entity B (i.e. entity A after exchange) A {1' -5' -8' -4' -1' } cut the section F obtained by cutting the entity A (i.e. the exchanged entity B), referring to FIGS. 9 (d) and 9 (e), the section F is {10-13-14-10' -10}, {17-9-9' -18-17}, and the section F is assigned to the face F B Using flour F A {1' -5' -8' -4' -1' } and face F B Performing two-dimensional Boolean difference operation on {10-13-14-10'-10}, {17-9-9' -18-17}, wherein the planes obtained by the operation are {1'-10-10' -4'-1' }, {13-5'-8' -14-13}; referring to FIG. 9 (c) and FIG. 9 (e), in the two difference operation results, the plane {1' -10-10' -4' -1' } is a suspension plane because the plane {9-9' -10' -10-9} of the entity A and the plane {1' -5' -8' -4' -1' } of the entity B are coplanar in opposite directions,therefore, a hanging surface is generated, the count values of the vertexes 1', 10', 4' of the hanging surface are 3, 1, 3 respectively, and the count =1 must be found in the count values of the vertexes of the hanging surface; for continuous suspended surfaces connected end to end, firstly, suspended surfaces with a count value of 1 in the body _ list are judged and deleted, then the linked list pt _ list is emptied, all vertexes of the rest surfaces in the body _ list are pressed into the linked list pt _ list again, then the count value of each vertex of each surface is counted again, and then suspended surfaces with a count value of 1 in the body _ list are judged and deleted until no suspended surface exists in the body _ list;
step 608: judging whether all vertexes on the FF outer ring are taken out or not; if the step is finished, go to step 609, and if the step is not finished, go to step 607;
step 609: judging whether label is equal to true, if so, turning to step 612, and if not, turning to step 610;
step 610: judging whether the face in the body _ list is taken out completely, if so, finishing the algorithm, and if not, turning to the step 611;
step 611: let label = false, take out a surface from body _ list in order, assign to surface FF, go to step 607;
step 612: the surface FF is a suspension surface, the surface FF is deleted from the body _ list, and meanwhile label = false is made, and a linked list pt _ list is emptied;
step 613: traversing the surfaces in the body _ list once, and storing the vertexes of all the surfaces in a point linked list pt _ list;
step 614: and traversing the body _ list again, taking one of the surfaces in sequence and assigning the surface to the surface FF, and going to step 607.
Step 124: combining two or more surfaces which are coplanar in the same direction and have superposed line segments into one surface;
in step 124, a method for combining two or more surfaces which are coplanar in the same direction and have superposed line segments into one surface includes the following steps:
as shown in fig. 7, step 701: defining a linked list Plane _ list for storing all surfaces meeting the same-direction coplanar condition, defining a result linked list tmpPlane _ list after storage surface combination, and defining a side linked list Line _ list; refer to FIGS. 10 (a) andFIG. 10 (B), the inner ring plane {9-9' -10' -10-9} of the entity A and the plane {2' -3' -7' -6' -2' } of the entity B belong to the same direction and are coplanar, and the merging result will generate the plane of the overlapped line segments, which needs to be merged into a large plane; with faces F of the entity A A {9-9'-10' -10-9} truncation of the entity B gives the profile F {2'-3' -7'-6' -2'}, which is assigned to the face F {2' -3'-7' -6'-2' } B Using flour F A {9-9'-10' -10-9} and face F B (ii) performing two-dimensional Boolean difference operation on {2'-3' -7'-6' -2'}, and obtaining faces {9-9' -3'-2' -9} by operation with reference to FIG. 10 (c); after exchanging entity A and entity B, use face F of entity B (i.e. entity A after exchange) A Cutting the entity A (i.e. the exchanged entity B) to obtain a section F, which is shown in FIG. 10 (d) and FIG. 10 (e), and is 15-16-9'-9-15 and 10-10' -14-13-10, and assigning the section F to the surface F B Flour F A {2' -3' -7' -6' -2' } and face F B Performing two-dimensional Boolean difference operation on {15-16-9'-9-15}, {10-10' -14-13-10}, wherein the planes obtained by the operation are {2'-3' -10'-10-2' }, {13-14-7'-6' -13}; referring to fig. 10 (c) and 10 (e), three planes {9-9'-3' -2'-9}, {2' -3'-10' -10-2'}, {13-14-7' -6'-13} of the two difference operation results are stored in the body _ list, where the planes {9-9' -3'-2' -9} and the planes {2'-3' -10'-10-2' } have a coincident line segment {2'-3' };
step 702: taking a surface F in the body _ list, and solving a unit normal vector of the surface F;
step 703: taking the next surface of the F surfaces according to the storage sequence and recording the next surface as F surface 1 Calculating the surface F 1 The unit normal vector of (1);
step 704: judging plane F and plane F 1 Whether the two surfaces are coplanar in the same direction, if so, turning to step 705, otherwise, turning to step 706;
step 705: flour F 1 Storing the list into Plane _ list, and deleting the surface F in body _ list 1 (ii) a Referring to fig. 10 (c) and 10 (e), the surfaces {9-9' -3' -2' -9}, {2' -3' -10' -10-2' } and {13-14-7' -6' -13} in the body _ list belong to the same-direction coplanar surfaces and need to be stored in the linked list Plane _ list;
step 706: judging whether the surface in the body _ list is taken out completely, if so, turning to step 708, and if not, turning to step 707;
step 707: from the surfaceF 1 Taking one surface backward and giving it to the surface F 1 Calculating the surface F 1 Go to step 704;
step 708: judging whether the number of the surfaces stored in the Plane _ list is greater than or equal to 1, if the condition is satisfied, turning to step 709, and if the condition is not satisfied, turning to step 714;
step 709: storing the surface F into a linked list Plane _ list, and deleting the surface F in the body _ list;
step 710: storing the edges of all the surfaces in the Plane _ list into a side chain table Line _ list, deleting all the superposed Line segments in the chain table Line _ list, and emptying the chain table Plane _ list;
step 711: connecting Line segments in the Line _ list end to construct a face ring;
step 712: short Line segments which are collinear in the face ring constructed in the Line _ list and have repeated points are combined into a long Line segment;
step 713: storing the construction surface ring in the Line _ list into a linked list tmpPlane _ list; referring to fig. 10 (c) and (e), through steps 710 to 712, the overlapped line segments {2'-3' } are deleted, and the combined planes {9-9'-10' -10-9}, {13-14-7'-6' -13} are stored in the linked list tmpPlane _ list;
step 714: taking the next plane after the plane F in the body _ list, assigning the next plane to the plane F, and calculating a unit normal vector of the plane F;
step 715: judging whether the faces in the body _ list are completely taken, if so, turning to a step 716, and if not, turning to a step 717;
step 716: adding the surface in the surface chain table tmpPlane _ list into the body _ list;
step 717: given the next surface to the previous surface F 1 Calculating the surface F 1 Go to step 704.
Step 125: and outputting and operating a result linked list Body _ list.
The parts of the embodiment not described in detail and the english abbreviations are common general knowledge in the industry and can be searched on the internet, which is not described herein.

Claims (6)

1. A Boolean operation method of a three-dimensional plane entity is characterized by comprising the following steps: for each surface in an entity A, if the surface is completely outside an entity B, storing the surface, if the surface and the surface of the entity B are coplanar in the same direction and are not inner ring surfaces, performing two-dimensional Boolean-combination operation on the two surfaces, storing an operation result, and if the surface does not belong to the two conditions, cutting the entity B by using the surface to obtain a section polygon, performing two-dimensional Boolean difference operation on the surface and the section polygon, and storing the operation result; exchanging the entity A and the entity B, and performing the same treatment; and (3) carrying out post-processing of deleting repeated surfaces, deleting suspended surfaces and surface combination on the stored result to finally obtain a Boolean parallel operation result of the entity A and the entity B, wherein the post-processing specifically comprises the following steps:
step 101: sequentially reading the surface data of two entities A and B participating in operation, wherein the information of the surface, the ring, the edge and the Point of the entity A is respectively stored in an A _ Face _ list, an A _ Loop _ list, an A _ Line _ list and an A _ Point _ list, and the information of the surface, the ring, the edge and the Point of the entity B is respectively stored in a B _ Face _ list, a B _ Loop _ list, a B _ Line _ list and a B _ Point _ list; the solid surface is a plane polygon, which can have only one outer ring, or one outer ring and one or more inner rings;
step 102: setting a swap flag and a Boolean difference operation flag sub _ flag of an entity A and an entity B, defining and operating a result storage chain table Body _ list, and setting swap = false and sub _ flag = false;
step 103: marking the surfaces of the entity A and the entity B, if the surfaces are inner annular surfaces, marking the surfaces as non-0, and if the surfaces are non-inner annular surfaces, marking the surfaces as 0; the inner ring surface is a surface of which one edge on the outer ring is the other edge on the inner ring;
step 104: traversing the linked lists A _ Point _ list, A _ Line _ list, A _ Loop _ list and A _ Face _ list, and obtaining enclosure box values A.min.X, A.min.Y, A.min.Z, A.max.X, A.max.Y and A.max.Z of the entity A; traversing the linked lists B _ Point _ list, B _ Line _ list, B _ Loop _ list and B _ Face _ list to obtain bounding box values B.min.X., B.min.Y, B.min.Z, B.max.X, B.max.Y and B.max.Z of the entity B;
step 105: judging whether the bounding box of the entity A is separated from the bounding box of the entity B, if not, turning to the step 106, and if so, turning to the step 117;
step 106: traversing the linked lists A _ Point _ list, A _ Line _ list, A _ Loop _ list and A _ Face _ list of the entity A, and taking one surface F of the entity A A
Step 107: section F A Whether or not outside of entity B, if face F A Go to step 118 outside entity B, otherwise go to step 108;
step 108: traversing the linked lists B _ Point _ list, B _ Line _ list, B _ Loop _ list and B _ Face _ list of the entity B, and taking a surface F of the entity B B
Step 109: section F A Dough kneading F B Whether the two surfaces are coplanar in the same direction and are not inner annular surfaces, if the condition is met, the step is shifted to a step 115, and if the condition is not met, the step is shifted to a step 110; homodromous coplanar refers to two or more faces geometrically located on a plane and having the same direction of the external normal vector;
step 110: noodles F A Enlarged surface and surface F B Intersecting, wherein an intersecting line Duan Bao exists in a linked list A _ inter _ B; face F A The enlarged surface of (A) is defined as being in contact with F A On a plane and with sides of 10 6 The square surface of (2);
step 111: judging whether the surface of the entity B is processed or not, if not, turning to the step 108, and if so, turning to the step 112;
step 112: carrying out end-to-end connection on line segments in the linked list A _ inter _ B to construct rings, and storing the constructed rings into a linked list Loop _ list; sum of the F planes with the normal vectors of the loops in Loop _ list A Comparing the directions of the normal vectors, if the directions are the same, the vertex sequence of the ring is not changed, otherwise, the vertex sequence of the ring is arranged in a reverse direction; finding out an inner ring in the Loop _ list, and arranging the vertexes of the inner ring in a reverse order; the Loop _ list obtained finally is the use face F A The data of the section polygon F obtained by cutting the entity B on the expanded surface; clearing the linked list A _ inter _ B;
step 113: setting a boolean difference operation flag sub _ flag = true;
step 114: giving a cross-sectional polygon F to a face F B
Step 115: opposite face F A Dough kneading F B Performing parallel operation on the two-dimensional polygons, and storing operation results in a linked list _ out _ respectively; the linked list _ out _ stores partial results of three-dimensional parallel operation of the entity A and the entity B;
step 116: judging whether the surface of the entity A is processed or not, if so, turning to a step 119, and if not, turning to a step 106;
step 117: the method comprises the steps of enabling a linked list A _ out _ B = A _ Face _ list, enabling the linked list B _ out _ A = B _ Face _ list, combining the two linked lists A _ out _ B, B _ out _ A into the linked list Body _ list, and outputting and operating a result linked list Body _ list;
step 118: saving faces F of entity A A Go to linked list _ out _ go to step 116;
step 119: judging whether the swap flag is true, if so, going to step 122, and if not, going to step 120;
step 120: copying data in the linked list _ out _ into the linked list A _ out _ B, and clearing the linked list _ out _;
step 121: exchanging data of the entity A and the entity B, namely copying the information of the face, the ring, the edge and the point of the entity B to the entity A, copying the information of the face, the ring, the edge and the point of the entity A to the entity B, and juxtaposing swap = true, and going to step 103;
step 122: copying data in the linked list _ out _ into the linked list B _ out _ A, and clearing the linked list _ out _;
step 123: merging the data of the linked list A _ out _ B and the linked list B _ out _ A into the Body _ list, performing post-processing, and deleting the repeated surface and the hanging surface;
step 124: combining two or more surfaces which are coplanar in the same direction and have superposed line segments into one surface;
step 125: outputting and operating a result linked list Body _ list;
in step 103, the surfaces of the entity a and the entity B are marked, if the surfaces are inner ring surfaces, the surfaces are marked as non-zero, and if the surfaces are non-inner ring surfaces, the surfaces are marked as zero, including the following steps:
step 201: reading surface information of an entity A from a linked list A _ Plane _ list, defining a variable count for marking a surface, wherein the initial value of the count is 0, and marking all the surfaces as the count initially;
step 202: let variable count = count +1;
step 203: reading one surface according to the storage sequence of the surfaces in the entity A;
step 204: judging whether the surface has an inner ring, if so, turning to step 205, and if not, turning to step 213;
step 205: taking out an inner ring according to the storage sequence, and pressing the vertex data of the inner ring into a linked list pt _ list;
step 206: reading one surface according to the storage sequence of the surfaces in the entity A;
step 207: judging whether the face mark value is not 0, if so, turning to step 210, and if not, turning to step 208;
step 208: judging whether the outer ring vertex of the surface is in the linked list pt _ list, if not, turning to the step 210, otherwise, turning to the step 209;
step 209: setting the face mark value as count;
step 210: judging whether the surface of the entity A is traversed or not, if so, turning to a step 211, and if not, turning to a step 206;
step 211: clearing the linked list pt _ list, and performing 1 adding operation on the mark value count;
step 212: judging whether the inner ring of the surface is traversed or not, if so, turning to the step 213, and if not, turning to the step 205;
step 213: judging whether the surface of the entity A is traversed or not, if so, turning to step 214, and if not, turning to step 203;
step 214: and (5) executing the steps 201 to 213 on the entity B, converting the data of the entity A in the steps into the data of the entity B, and marking the surface of the entity B.
2. The Boolean's operation method of a three-dimensional plane entity according to claim 1,
the method is characterized in that: in step 107, a cross section F is determined A Whether or not outside of entity B, including the followingThe method comprises the following steps:
step 301: solving axial bounding boxes B.max.X, B.max.Y, B.max.Z, B.min.X, B.min.Y and B.min.Z of the entity B; finding the surface F A Axial bounding box F A .max.X、F A .max.Y、F A .max.Z、F A .min.X、F A .min.Y、F A .min.Z;
Step 302: judgment of F A If not, go to step 303, and if so, go to step 309;
step 303: judgment of F A If not, go to step 304, and if so, go to step 309;
step 304: judgment of F A If not, go to step 305, and if yes, go to step 309;
step 305: judgment of F A If min.y is greater than b.max.y, if not, go to step 306, if true, go to step 309;
step 306: judgment of F A If not, go to step 307, if true, go to step 309;
step 307: judgment of F A If min.z is greater than b.max.z, if not, go to step 308, if yes, go to step 309;
step 308: face F A Not necessarily outside entity B;
step 309: face F A Outside of entity B.
3. The boolean union method of claim 1, further comprising: in step 109 shown, the surface F is judged A Dough kneading F B Whether homodromous coplane and all are not the interior ring face includes the following step:
step 401: reading marked faces F A Dough kneading F B Data;
step 402: section F A Flour F B If the conditions are satisfied, go to step 403, otherwise, go to stepGo to step 409;
step 403: respectively obtain the surfaces F A Dough kneading F B Unit normal vector of
Figure DEST_PATH_IMAGE002
Figure DEST_PATH_IMAGE003
And
Figure DEST_PATH_IMAGE005
Figure DEST_PATH_IMAGE006
step 404: judgment of
Figure 657818DEST_PATH_IMAGE002
Figure 106117DEST_PATH_IMAGE003
And
Figure 89116DEST_PATH_IMAGE005
Figure 156430DEST_PATH_IMAGE006
if not, go to step 405, if not, go to step 409;
step 405: from face F A Flour F B Respectively taking a vertex on the outer ring of the point, ensuring that the two points are not the same point, and respectively recording the taken points as a point PotA and a point PotB;
step 406: using the point PotA and the point PotB as a straight line to find the direction vector
Figure DEST_PATH_IMAGE008
Figure DEST_PATH_IMAGE009
Step 407: section F A Unit normal vector of
Figure 751228DEST_PATH_IMAGE002
Figure 776953DEST_PATH_IMAGE003
And direction vector
Figure 217555DEST_PATH_IMAGE008
Figure 619717DEST_PATH_IMAGE009
Whether the vertical direction is adopted, if the vertical direction is adopted, the step 408 is carried out, otherwise, the step 409 is carried out;
step 408: face F A Dough kneading F B Coplanar in the same direction and not an inner ring surface;
step 409: face F A Dough kneading F B Not meeting homofacial coplanarity and neither being an internal annular surface.
4. The boolean union method of claim 1, further comprising: in step 115, shown, the opposite face F A Dough kneading F B Performing the parallel operation of the two-dimensional polygons, and storing the operation result in a linked list _ out _ comprises the following steps:
step 501: reading surface F A Dough kneading F B The data of (a);
step 502: section F A Dough kneading F B If the position relationship of the outer ring is intersected, go to step 503, if not, go to step 517;
step 503: definition of the marking surface F A Dough kneading F B Whether there is an intersection on the inner ring of (2) or not]And Cinner _ label [ 2 ]]The array size is respectively the face F A Dough kneading F B The number of inner rings of (2), initializing the array Minner _ label [ ]]And Cinner _ label [ 2 ]]All flag values of (a) are 0; judging the intersection relationship, and if the inner ring has an intersection point, making the mark values of the inner rings corresponding to the two surfaces be 1;
step 504: define save planes F separately A Dough kneading F B Array dataP of the vertices of (1), intersection information, and intersection in-out attribute]<xnotran> dataQ [ </xnotran>]Definition of plane F A Go out of the dot array out Point 2](ii) a Firstly, flour F A Dough kneading F B The vertexes of the two sets are stored in the data sets of data]<xnotran> dataQ [ </xnotran>]Setting the attribute value to 0, then finding the intersection point of two face rings, and judging the in-out attribute of the intersection point, if the intersection point is in point, its attribute value is 1, if the intersection point is out point, its attribute value is-1, inserting the intersection point and its attribute value into array dataP 2 according to the position of intersection point on the ring]<xnotran> dataQ [ </xnotran>]Performing the following steps; while mixing the noodles F A Is stored in the array out _ point [ value ]]Performing the following steps; the intersection being the "in point" means that the plane F is at that point A Edge of (2) enters the surface F B The intersection point being "out point" means that the plane F is at that point A Is away from the face F B
Step 505: judging whether the Boolean difference operation flag sub _ flag is true, if true, turning to step 516, and if not, turning to step 506;
step 506: section F A Dough kneading F B If there is an inner ring, go to step 515 if there is an inner ring, if there is no inner ring, go to step 507;
step 507: taking out a point from the point array out _ point [ ], and assigning a point variable PotTmp;
step 508: on the surface F A Array data _ P [ 2 ]]Finding out corresponding out points in sequence;
step 509: this point is stored in the temporary result loop chain table looptmp. Point _ list, in dataP 2]From the point to the backward, if the vertex is encountered, the vertex is stored in the linked list looptmp B Array of (2) (dataQ [, ]]Find the corresponding point in (1), and store in the linked list looptmp. Point _ list, then in dataQ [, ]]The traversal is continued from the point backward, the vertex is met and stored in the linked list looptmp B The point of entry then enters the plane F A Array of DataP [ 2 ]]Finding out the corresponding point;
step 510: judging whether the point is the same as the point PotTmp, if so, turning to step 511, and if not, turning to step 509;
step 511: storing points in the linked list loopTmp.Point _ list in the ring linked list tmpFace _ list, and clearing the linked list loopTmp.Point _ list;
step 512: section F A Go out of the dot array out Point 2]Whether the traversal is finished or not is judged, if the traversal is finished, the step is carried out to step 513, and if the traversal is not finished, the step is carried out to step 507;
step 513: the normal vector of each ring in the ring chain table tmpFace _ list is obtained, and the sum face F of the normal vector is judged A Whether the directions of the outer normal vectors are the same or not is judged, if the directions are the same, the outer ring is judged, and if the directions are different, the inner ring is judged;
step 514: constructing a surface linked list according to the storage sequence of the outer ring and the inner ring, and storing the result in a parallel operation result linked list _ out _ in;
step 515: according to the array Minner _ label]And Cinner _ label [ 2 ]]Mark value judgment face F in (1) A Corresponding non-intersecting inner ring and surface F B The problem of removing and retaining the corresponding non-intersection inner ring is divided into the following two cases: in the first case, if the face F A In the plane F of the inner ring B The outer ring of (2), the inner ring remains if the face F A Inner ring of (F) B Inside the outer ring of (1) and in the plane F B If the inner ring is outside, the inner ring is not retained, if the face F A Inner ring of (F) B The inner ring is reserved; in the second case, if the face F B In the plane F of the inner ring A If the face F is external to the outer ring, the inner ring remains B Inner ring in the face F A Inside the outer ring of (1) and in the plane F A If the inner ring is outside, the inner ring is not retained, if the face F B In the plane F of the inner ring A The inner ring is reserved; storing the reserved environment protection in a ring linked list tmpFace _ list;
step 516: flour F B <xnotran> dataQ [ </xnotran>]Arranging vertexes and intersection points reversely, setting sub _ flag = false, and turning to step 506;
517: judging plane F A Dough kneading F B If they are, go to step 518, if they are not, go to stepGo to step 519;
step 518: flour F A Inner and outer rings and face F B The inner and outer rings of the parallel operation are stored in a parallel operation result linked list _ out _ respectively;
step 519: if face F A Outer ring of (2) is in the face F B The inner part of the outer ring is a storage surface F B If the plane F is in the parallel operation result linked list _ out A Outer ring of (2) is in the face F B The outer part of the outer ring, the retaining surface F A Go to the union operation result linked list _ out _ in step 503.
5. The boolean union method of claim 1, further comprising: in step 123, post-processing is performed to remove the duplicate plane and the suspension plane, including the following steps:
step 601: taking out a surface F from the linked list body _ list;
step 602: traversing other surfaces except the surface F in the body _ list of the linked list, if the surface F is repeated with the surface F 1 Then delete face F 1
Step 603: judging whether the surfaces in the body _ list are traversed or not, if so, turning to a step 604, and if not, turning to a step 601;
step 604: traversing the surfaces in the body _ list once, and storing vertexes of all the surfaces in a pt _ list of a point chain table;
step 605: sequentially taking a plane FF in the body _ list, setting a Boolean mark label, and juxtaposing label = false;
step 606: defining a variable count as the number of times of each vertex of the external ring of the surface FF appearing in a linked list pt _ list;
step 607: taking a vertex on the outer ring of the surface FF, counting the number of times of occurrence count in pt _ list, and when count =1, letting label = true;
step 608: judging whether all vertexes on the FF outer ring are taken out or not; if the step is finished, go to step 609, and if the step is not finished, go to step 607;
step 609: judging whether label is equal to true, if so, turning to step 612, and if not, turning to step 610;
step 610: judging whether the face in the body _ list is taken out completely, if so, finishing the algorithm, and if not, turning to the step 611;
step 611: let label = false, take out a surface from body _ list in order, give surface FF, go to step 607;
step 612: the surface FF is a suspension surface, the surface FF is deleted from the body _ list, and meanwhile label = false is made, and a linked list pt _ list is emptied; the hanging surface is a surface without an adjacent surface on at least one edge of the ring;
step 613: traversing the surfaces in the body _ list once, and storing the vertexes of all the surfaces in a point linked list pt _ list;
step 614: and traversing the body _ list again, taking one of the surfaces in sequence and assigning the surface FF to the surface FF, and turning to the step 607.
6. The boolean union method of claim 1, further comprising: in the step 124 shown, two or more surfaces that are coplanar and have coincident line segments are combined into one surface, which includes the following steps:
step 701: defining a linked list Plane _ list for storing all surfaces meeting the same-direction coplanar condition, defining a result linked list tmpPlane _ list after storage surface combination, and defining a side linked list Line _ list;
step 702: taking a surface F in the body _ list, and solving a unit normal vector of the surface F;
step 703: taking the next surface of the F surfaces according to the storage sequence and recording the next surface as F 1 Calculating the surface F 1 The unit normal vector of (1);
step 704: judging plane F and plane F 1 Whether the two surfaces are coplanar in the same direction, if so, turning to step 705, otherwise, turning to step 706;
step 705: flour F 1 Storing the list into Plane _ list, and deleting the surface F in body _ list 1
Step 706: judging whether the surfaces in the body _ list are completely taken, if so, turning to step 708, and if not, turning to step 707;
step 707: from the surfaceF 1 Taking one surface backward and giving it to the surface F 1 Obtaining a flour F 1 Go to step 704;
step 708: judging whether the number of the surfaces stored in the Plane _ list is greater than or equal to 1, if the condition is satisfied, turning to step 709, and if the condition is not satisfied, turning to step 714;
step 709: storing the surface F into a linked list Plane _ list, and deleting the surface F in the body _ list;
step 710: storing the edges of all surfaces in the Plane _ list into an edge chain table Line _ list, deleting all superposed Line segments in the chain table Line _ list, and emptying the chain table Plane _ list;
step 711: connecting Line segments in the Line _ list end to construct a face ring;
step 712: short Line segments which are collinear in the surface ring constructed in the Line _ list and have repeated points are combined to form long Line segments;
step 713: storing the construction surface ring in the Line _ list into a linked list tmpPlane _ list;
step 714: taking the next surface after the surface F in the body _ list, assigning the next surface to the surface F, and calculating a unit normal vector of the surface F;
step 715: judging whether the surface in the body _ list is taken out completely, if so, turning to a step 716, and if not, turning to a step 717;
step 716: adding the surface in the surface chain table tmpPlane _ list into the body _ list;
step 717: the next surface to the previous surface F is taken and given to the surface F 1 Obtaining a flour F 1 Go to step 704.
CN201710711666.1A 2017-08-18 2017-08-18 Boolean parallel operation method of three-dimensional plane entity Active CN107564103B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710711666.1A CN107564103B (en) 2017-08-18 2017-08-18 Boolean parallel operation method of three-dimensional plane entity

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710711666.1A CN107564103B (en) 2017-08-18 2017-08-18 Boolean parallel operation method of three-dimensional plane entity

Publications (2)

Publication Number Publication Date
CN107564103A CN107564103A (en) 2018-01-09
CN107564103B true CN107564103B (en) 2023-02-28

Family

ID=60976110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710711666.1A Active CN107564103B (en) 2017-08-18 2017-08-18 Boolean parallel operation method of three-dimensional plane entity

Country Status (1)

Country Link
CN (1) CN107564103B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109782272A (en) * 2018-12-30 2019-05-21 中国电子科技集团公司第十五研究所 Boolean's fusion method of three-dimensional radar body

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104134236A (en) * 2014-07-30 2014-11-05 西安电子科技大学 Boolean operation method of three-dimensional planar solids
CN106447777A (en) * 2016-10-21 2017-02-22 西南大学 Three-dimensional topological relation expressing and mapping achieved under support of Boolean operation

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104134236A (en) * 2014-07-30 2014-11-05 西安电子科技大学 Boolean operation method of three-dimensional planar solids
CN106447777A (en) * 2016-10-21 2017-02-22 西南大学 Three-dimensional topological relation expressing and mapping achieved under support of Boolean operation

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Boolean operations on 3D selective Nef complexes: Data structure,algorithms, optimized implementation and experiments;Peter Hachenberger等;《Computational Geometry》;20070404;第38卷;64-99 *
实体布尔运算关键算法及其奇异情况处理研究;杨矿生;《中国优秀硕士学位论文全文数据库信息科技辑》;20170315;I138-4724 *

Also Published As

Publication number Publication date
CN107564103A (en) 2018-01-09

Similar Documents

Publication Publication Date Title
Lambourne et al. Brepnet: A topological message passing system for solid models
JP4381743B2 (en) Method and program for generating volume data from boundary representation data
Yan et al. Erosion thickness on medial axes of 3D shapes
US8537158B2 (en) Parallel triangle tessellation
CN109571961B (en) Method for obtaining slicing and supporting points of complex heterogeneous parametric model
Li et al. Generalized polycube trivariate splines
Liu Exact geodesic metric in 2-manifold triangle meshes using edge-based data structures
CN104134236B (en) Boolean operation method of three-dimensional planar solids
CN106649992B (en) Fusion and optimization method of ship and trail grid model
Wang et al. Efficient boundary extraction of BSP solids based on clipping operations
Felsner et al. On primal-dual circle representations
CN107564103B (en) Boolean parallel operation method of three-dimensional plane entity
CN107562779B (en) Spatial topology processing method for two-dimensional vector polygon self-intersection
Bhunre et al. On efficient computation of inter-simplex Chebyshev distance for voxelization of 2-manifold surface
Du et al. Boundary-sampled halfspaces: a new representation for constructive solid modeling
CN109983509B (en) Instant Boolean operation method using geometric surface
Tereshin et al. Hybrid function representation for heterogeneous objects
CN112734934A (en) STL model 3D printing slicing method based on intersecting edge mapping
Wang et al. Freeform extrusion by sketched input
Kase et al. Volume cad
Ma et al. Distance computation for canal surfaces using cone-sphere bounding volumes
Song et al. Modeling and 3D object reconstruction by implicitly defined surfaces with sharp features
Peltier et al. Tubular parametric volume objects: Thickening a piecewise smooth 3d stick figure
Landier Boolean operations on arbitrary polyhedral meshes
Zhang et al. A compact face-based topological data structure for triangle mesh representation

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
GR01 Patent grant
GR01 Patent grant