0031939: Coding - correction of spelling errors in comments [part 7]
[occt.git] / dox / specification / boolean_operations / boolean_operations.md
CommitLineData
6b6d06fa 1Boolean Operations {#specification__boolean_operations}
1a457208 2=========================
3
4@tableofcontents
5
6b6d06fa 6@section specification__boolean_1 Introduction
1a457208 7
6b6d06fa 8Boolean operations are used to create new shapes from the combinations of two groups of shapes.
9This document provides a comprehensive description of the algorithms in the Boolean Operations Component as it is implemented in Open CASCADE Technology. The Boolean Component contains:
1a457208 10
e9e33e91 11* General Fuse Operator (GFA),
12* Boolean Operator (BOA),
13* Section Operator (SA),
aeee70d3 14* Splitter Operator (SPA).
e2b55410 15
aeee70d3 16GFA is the base algorithm for BOA, SPA, SA.
e2b55410 17
e9e33e91 18GFA has a history-based architecture designed to allow using OCAF naming functionality. The architecture of GFA is expandable, that allows creating new algorithms basing on it.
e2b55410 19
e2b55410 20
6b6d06fa 21@section specification__boolean_2 Overview
1a457208 22
6b6d06fa 23@subsection specification__boolean_2_1 Operators
1a457208 24
6b6d06fa 25@subsubsection specification__boolean_2_1_1 Boolean operator
1a457208 26
6b6d06fa 27The Boolean operator provides the following operations between two groups *Objects* and *Tools*:
28* FUSE - Union of two groups;
29* COMMON - Intersection of two groups;
30* CUT - Difference between two groups.
31
32Each group consists of an arbitrary number of arguments in terms of *TopoDS_Shape*.
1a457208 33
34The operator can be represented as:
35
e9e33e91 36<i>R<sub>B</sub>=B<sub>j</sub> (G<sub>1</sub>, G<sub>2</sub>),</i>
1a457208 37
38where:
3f812249 39* *R<sub>B</sub>* -- result of the operation;
40* *B<sub>j</sub>* -- operation of type *j* (Common, Fuse, Cut);
e9e33e91 41* *G<sub>1</sub>={S<sub>11</sub>, S<sub>12</sub> ... S<sub>1n1</sub>}* group of arguments (Objects);
42* *G<sub>2</sub>={S<sub>21</sub>, S<sub>22</sub> ... S<sub>2n2</sub>}* group of arguments (Tools);
3f812249 43* *n<sub>1</sub>* -- Number of arguments in *Objects* group;
44* *n<sub>2</sub>* -- Number of arguments in *Tools* group.
e9e33e91 45
46
47**Note** There is an operation *Cut21*, which is an extension for forward Cut operation, i.e <i>Cut21=Cut(G2, G1)</i>.
1a457208 48
6b6d06fa 49For more details see @ref specification__boolean_9 "Boolean Operations Algorithm" section.
c58055ad 50
6b6d06fa 51@subsubsection specification__boolean_2_1_2 General Fuse operator
1a457208 52
53The General fuse operator can be applied to an arbitrary number of arguments in terms of *TopoDS_Shape*.
54
55The GFA operator can be represented as:
56
57<i>R<sub>GF</sub> = GF (S<sub>1</sub>, S<sub>2</sub> ... S<sub>n</sub>), </i>
58
59where
3f812249 60* *R<sub>GF</sub>* -- result of the operation,
61* *S<sub>1</sub>, S<sub>2</sub> ... S<sub>n</sub>* -- arguments of the operation,
62* *n* -- number of arguments.
1a457208 63
64The result of the Boolean operator, *R<sub>B</sub>*, can be obtained from *R<sub>GF</sub>*.
65
66For example, for two arguments *S<sub>1</sub>* and *S<sub>2</sub>* the result *R<sub>GF</sub>* is
67
68<i>R<sub>GF</sub> = GF (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub> + S<sub>p2</sub> + S<sub>p12</sub></i>
69
6b6d06fa 70@figure{/specification/boolean_operations/images/operations_image001.svg,"Operators",320}
1a457208 71
72This Figure shows that
73* <i>B<sub>common</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p12</sub>;</i>
74* <i>B<sub>cut12</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub>;</i>
75* <i>B<sub>cut21</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p2</sub>;</i>
e9e33e91 76* <i>B<sub>fuse</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub>+S<sub>p2</sub>+S<sub>p12</sub></i>
1a457208 77
78<i>R<sub>GF</sub>=GF (S<sub>1</sub>, S<sub>2</sub>) = B<sub>fuse</sub> = B<sub>common</sub>+ B<sub>cut12</sub>+ B<sub>cut21</sub>.</i>
79
80The fact that *R<sub>GF</sub>* contains the components of *R<sub>B</sub>* allows considering GFA as the general case of BOA. So it is possible to implement BOA as a subclass of GFA.
81
6b6d06fa 82For more details see @ref specification__boolean_7 "General Fuse Algorithm" section.
c58055ad 83
6b6d06fa 84@subsubsection specification__boolean_2_1_3 Splitter operator
1a457208 85
aeee70d3 86The Splitter operator can be applied to an arbitrary number of arguments in terms of *TopoDS_Shape*. The arguments are divided into two groups: *Objects* and *Tools*. The result of *SPA* contains all parts that belong to the *Objects* but does not contain the parts that belong to the *Tools*.
1a457208 87
aeee70d3 88The *SPA* operator can be represented as follows:
1a457208 89
aeee70d3 90<i>R<sub>SPA</sub>=SPA (G<sub>1</sub>, G<sub>2</sub>),</i>
1a457208 91where:
aeee70d3 92* <i>R<sub>SPA</sub></i> -- is the result of the operation;
93* *G<sub>1</sub>={S<sub>11</sub>, S<sub>12</sub> ... S<sub>1n1</sub>}* group of arguments (*Objects*);
94* *G<sub>2</sub>={S<sub>21</sub>, S<sub>22</sub> ... S<sub>2n2</sub>}* group of arguments (*Tools*);
3f812249 95* *n<sub>1</sub>* -- Number of arguments in *Objects* group;
96* *n<sub>2</sub>* -- Number of arguments in *Tools* group.
1a457208 97
aeee70d3 98The result *R<sub>SPA</sub>* can be obtained from *R<sub>GF</sub>* .
1a457208 99
aeee70d3 100For example, for two arguments *S<sub>1</sub>* and *S<sub>2</sub>* the result *R<sub>SPA</sub>* is
1a457208 101
aeee70d3 102<i>R<sub>SPA</sub>=SPA(S<sub>1</sub>,S<sub>2</sub>)=S<sub>p1</sub>+S<sub>p12</sub>.</i>
1a457208 103
aeee70d3 104In case when all arguments of the *SPA* are *Objects* and there are no *Tools*, the result of *SPA* is equivalent to the result of *GFA*.
1a457208 105
aeee70d3 106For example, when *G<sub>1</sub>* consists of shapes *S<sub>1</sub>* and *S<sub>2</sub>* the result of *SPA* is
1a457208 107
aeee70d3 108<i>R<sub>SPA</sub>=SPA(S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub> + S<sub>p2</sub> + S<sub>p12</sub> = GF (S<sub>1</sub>, S<sub>2</sub>)</i>
1a457208 109
aeee70d3 110The fact that the *R<sub>GF</sub>* contains the components of *R<sub>SPA</sub>* allows considering *GFA* as the general case of *SPA*. Thus, it is possible to implement *SPA* as a subclass of *GFA*.
e9e33e91 111
6b6d06fa 112For more details see @ref specification__boolean_8 "Splitter Algorithm" section.
e9e33e91 113
6b6d06fa 114@subsubsection specification__boolean_2_1_4 Section operator
e9e33e91 115
116The Section operator *SA* can be applied to arbitrary number of arguments in terms of *TopoDS_Shape*. The result of *SA* contains vertices and edges in accordance with interferences between the arguments
117The SA operator can be represented as follows:
118<i>R<sub>SA</sub>=SA(S1, S2… Sn)</i>, where
3f812249 119* <i>R<sub>SA</sub></i> -- the operation result;
120* <i>S1, S2 ... Sn</i> -- the operation arguments;
121* *n* -- the number of arguments.
1a457208 122
6b6d06fa 123For more details see @ref specification__boolean_10a "Section Algorithm" section.
c58055ad 124
6b6d06fa 125@subsection specification__boolean_2_2 Parts of algorithms
1a457208 126
aeee70d3 127GFA, BOA, SPA and SA have the same Data Structure (DS). The main goal of the Data Structure is to store all necessary information for input data and intermediate results.
1a457208 128
e9e33e91 129The operators consist of two main parts:
1a457208 130* Intersection Part (IP). The main goal of IP is to compute the interferences between sub-shapes of arguments. The IP uses DS to retrieve input data and store the results of intersections.
131* Building Part (BP). The main goal of BP is to build required result of an operation. This part also uses DS to retrieve data and store the results.
132
aeee70d3 133As it follows from the definition of operator results, the main differences between GFA, BOA, SPA and SA are in the Building Part. The Intersection Part is the same for the algorithms.
1a457208 134
6b6d06fa 135@section specification__boolean_3 Terms and Definitions
1a457208 136
137This chapter provides the background terms and definitions that are necessary to understand how the algorithms work.
138
6b6d06fa 139@subsection specification__boolean_3_1 Interferences
1a457208 140
e9e33e91 141There are two groups of interferences.
142
3f812249 143At first, each shape having a boundary representation (vertex, edge, face) has an internal value of geometrical tolerance. The shapes interfere with each other in terms of their tolerances. The shapes that have a boundary representation interfere when there is a part of 3D space where the distance between the underlying geometry of shapes is less or equal to the sum of tolerances of the shapes. Three types of shapes: vertex, edge and face -- produce six types of **BRep interferences:**
e9e33e91 144* Vertex/Vertex,
145* Vertex/Edge,
146* Vertex/Face,
147* Edge/Edge,
148* Edge/Face and
149* Face/Face.
1a457208 150
e9e33e91 151At second, there are interferences that occur between a solid *Z1* and a shape *S2* when *Z1* and *S2* have no BRep interferences but *S2* is completely inside of *Z1*. These interferences are **Non-BRep interferences**. There are four possible cases:
152* Vertex/Solid,
153* Edge/Solid,
154* Face/Solid and
155* Solid/Solid.
1a457208 156
6b6d06fa 157@subsubsection specification__boolean_3_1_1 Vertex/Vertex interference
1a457208 158
e9e33e91 159For two vertices *Vi* and *Vj*, the distance between their corresponding 3D points is less than the sum of their tolerances *Tol(Vi)* and *Tol(Vj)*.
1a457208 160
6b6d06fa 161@figure{/specification/boolean_operations/images/operations_image002.svg,"Vertex/vertex interference",420}
1a457208 162
e9e33e91 163The result is a new vertex *Vn* with 3D point *Pn* and tolerance value <i>Tol(Vn)</i>.
1a457208 164
e9e33e91 165The coordinates of *Pn* and the value <i>Tol(Vn)</i> are computed as the center and the radius of the sphere enclosing the tolerance spheres of the source vertices <i>(V1, V2)</i>.
1a457208 166
6b6d06fa 167@subsubsection specification__boolean_3_1_2 Vertex/Edge interference
1a457208 168
e9e33e91 169For a vertex *Vi* and an edge *Ej*, the distance *D* between 3D point of the vertex and its projection on the 3D curve of edge *Ej* is less or equal than sum of tolerances of vertex *Tol(Vi)* and edge *Tol(Ej)*.
1a457208 170
6b6d06fa 171@figure{/specification/boolean_operations/images/operations_image003.svg,"Vertex/edge interference",420}
1a457208 172
e9e33e91 173The result is vertex *Vi* with the corresponding tolerance value <i>Tol(Vi)=Max(Tol(Vi), D+Tol(Ej))</i>, where <i>D = distance (Pi, PPi)</i>;
1a457208 174
175and parameter *t<sub>i</sub>* of the projected point *PPi* on 3D curve *Cj* of edge *Ej*.
176
6b6d06fa 177@subsubsection specification__boolean_3_1_3 Vertex/Face interference
1a457208 178
179For a vertex *Vi* and a face *Fj* the distance *D* between 3D point of the vertex and its projection on the surface of the face is less or equal than sum of tolerances of the vertex *Tol(Vi)* and the face *Tol(Fj)*.
180
6b6d06fa 181@figure{/specification/boolean_operations/images/operations_image004.svg,"Vertex/face interference",420}
1a457208 182
e9e33e91 183The result is vertex *Vi* with the corresponding tolerance value <i>Tol(Vi)=Max(Tol(Vi), D+Tol(Fj))</i>, where <i>D = distance (Pi, PPi)</i>
1a457208 184
e9e33e91 185and parameters <i>u<sub>i</sub>, v<sub>i</sub></i> of the projected point *PPi* on surface *Sj* of face *Fj*.
1a457208 186
6b6d06fa 187@subsubsection specification__boolean_3_1_4 Edge/Edge interference
1a457208 188
189For two edges *Ei* and *Ej* (with the corresponding 3D curves *Ci* and *Cj*) there are some places where the distance between the curves is less than (or equal to) sum of tolerances of the edges.
190
191Let us examine two cases:
192
193In the first case two edges have one or several common parts of 3D curves in terms of tolerance.
194
6b6d06fa 195@figure{/specification/boolean_operations/images/operations_image005.svg,"Edge/edge interference: common parts",420}
1a457208 196
197The results are:
198* Parametric range <i>[t<sub>i1</sub>, t<sub>i2</sub> ]</i> for 3D curve *Ci* of edge *Ei*.
199* Parametric range <i>[t<sub>j1</sub>, t<sub>j2</sub> ]</i> for 3D curve *Cj* of edge *Ej*.
200
201In the second case two edges have one or several common points in terms of tolerance.
202
6b6d06fa 203@figure{/specification/boolean_operations/images/operations_image006.svg,"Edge/edge interference: common points",420}
1a457208 204
e9e33e91 205The result is a new vertex *Vn* with 3D point *Pn* and tolerance value *Tol(Vn)*.
1a457208 206
e9e33e91 207The coordinates of *Pn* and the value *Tol(Vn)* are computed as the center and the radius of the sphere enclosing the tolerance spheres of the corresponding nearest points *Pi*, *Pj* of 3D curves *Ci*, *Cj* of source edges *Ei*, *Ej*.
1a457208 208
209* Parameter *t<sub>i</sub>* of *Pi* for the 3D curve *Ci*.
210* Parameter *t<sub>j</sub>* of *Pj* for the 3D curve *Cj*.
211
6b6d06fa 212@subsubsection specification__boolean_3_1_5 Edge/Face interference
1a457208 213
214For an edge *Ei* (with the corresponding 3D curve *Ci*) and a face *Fj* (with the corresponding 3D surface *Sj*) there are some places in 3D space, where the distance between *Ci* and surface *Sj* is less than (or equal to) the sum of tolerances of edge *Ei* and face *Fj*.
215
216Let us examine two cases:
217
218In the first case Edge *Ei* and Face *Fj* have one or several common parts in terms of tolerance.
219
6b6d06fa 220@figure{/specification/boolean_operations/images/operations_image007.svg,"Edge/face interference: common parts",420}
1a457208 221
222The result is a parametric range <i>[t<sub>i1</sub>, t<sub>i2</sub>]</i> for the 3D curve *Ci* of the edge *Ei*.
223
224In the second case Edge *Ei* and Face *Fj* have one or several common points in terms of tolerance.
225
6b6d06fa 226@figure{/specification/boolean_operations/images/operations_image008.svg,"Edge/face interference: common points",420}
1a457208 227
e9e33e91 228The result is a new vertex *Vn* with 3D point *Pn* and tolerance value *Tol(Vn)*.
229
230The coordinates of *Pn* and the value *Tol(Vn)* are computed as the center and the radius of the sphere enclosing the tolerance spheres of the corresponding nearest points *Pi*, *Pj* of 3D curve *Ci* and surface *Sj* of source edges *Ei*, *Fj*.
1a457208 231
232* Parameter *t<sub>i</sub>* of *Pi* for the 3D curve *Ci*.
233* Parameters *u<sub>i</sub>* and *v<sub>i</sub>* of the projected point *PPi* on the surface *Sj* of the face *Fj*.
234
6b6d06fa 235@subsubsection specification__boolean_3_1_6 Face/Face Interference
1a457208 236
237For a face *Fi* and a face *Fj* (with the corresponding surfaces *Si* and *Sj*) there are some places in 3D space, where the distance between the surfaces is less than (or equal to) sum of tolerances of the faces.
238
6b6d06fa 239@figure{/specification/boolean_operations/images/operations_image009.svg,"Face/face interference: common curves",418}
1a457208 240
e9e33e91 241In the first case the result contains intersection curves *C<sub>ijk</sub> (k = 0, 1, 2…k<sub>N</sub>,* where *k<sub>N</sub>* is the number of intersection curves with corresponding values of tolerances *Tol(C<sub>ijk</sub>)*.
1a457208 242
6b6d06fa 243@figure{/specification/boolean_operations/images/operations_image010.svg,"Face/face interference: common points",305}
1a457208 244
e9e33e91 245In the second case Face *Fi* and face *Fj* have one or several new vertices *V<sub>ijm</sub>*, where <i>m=0,1,2, ... mN, mN </i> is the number of intersection points.
1a457208 246
e9e33e91 247The coordinates of a 3D point *P<sub>ijm</sub>* and the value *Tol(V<sub>ijm</sub>)* are computed as the center and the radius of the sphere enclosing the tolerance spheres of the corresponding nearest points *Pi*, *Pj* of the surface *Si*, *Sj* of source shapes *Fi*, *Fj*.
1a457208 248
e9e33e91 249* Parameters *u<sub>j</sub>*, *v<sub>j</sub>* belong to point *PPj* projected on surface *Sj* of face *Fj*.
250* Parameters *u<sub>i</sub>* and *v<sub>i</sub>* belong to point *PPi* projected on surface *Si* of face *Fi*.
1a457208 251
6b6d06fa 252@subsubsection specification__boolean_3_1_7 Vertex/Solid Interference
e9e33e91 253
254For a vertex *Vi* and a solid *Zj* there is Vertex/Solid interference if the vertex *Vi* has no BRep interferences with any sub-shape of *Zj* and *Vi* is completely inside the solid *Zj*.
255
6b6d06fa 256@figure{/specification/boolean_operations/images/operations_image060.png,"Vertex/Solid Interference",220}
e9e33e91 257
6b6d06fa 258@subsubsection specification__boolean_3_1_8 Edge/Soild Interference
e9e33e91 259
260For an edge *Ei* and a solid *Zj* there is Edge/Solid interference if the edge *Ei* and its sub-shapes have no BRep interferences with any sub-shape of *Zj* and *Ei* is completely inside the solid *Zj*.
261
6b6d06fa 262@figure{/specification/boolean_operations/images/operations_image061.png,"Edge/Solid Interference",220}
e9e33e91 263
6b6d06fa 264@subsubsection specification__boolean_3_1_9 Face/Soild Interference
e9e33e91 265
266For a face *Fi* and a solid *Zj* there is Face/Solid interference if the face *Fi* and its sub-shapes have no BRep interferences with any sub-shape of *Zj* and *Fi* is completely inside the solid *Zj*.
267
6b6d06fa 268@figure{/specification/boolean_operations/images/operations_image062.png,"Face/Solid Interference",220}
e9e33e91 269
6b6d06fa 270@subsubsection specification__boolean_3_1_10 Solid/Soild Interference
e9e33e91 271
272For a solid *Zi* and a solid *Zj* there is Solid/Solid interference if the solid *Zi* and its sub-shapes have no BRep interferences with any sub-shape of *Zj* and *Zi* is completely inside the solid *Zj*.
273
6b6d06fa 274@figure{/specification/boolean_operations/images/operations_image063.png,"Solid/Solid Interference",220}
e9e33e91 275
276
6b6d06fa 277@subsubsection specification__boolean_3_1_11 Computation Order
1a457208 278
279The interferences between shapes are computed on the basis of increasing of the dimension value of the shape in the following order:
280* Vertex/Vertex,
281* Vertex/Edge,
282* Edge/Edge,
283* Vertex/Face,
284* Edge/Face,
e9e33e91 285* Face/Face,
286* Vertex/Solid,
287* Edge/Solid,
288* Face/Solid,
289* Solid/Solid.
1a457208 290
291This order allows avoiding the computation of redundant interferences between upper-level shapes *Si* and *Sj* when there are interferences between lower sub-shapes *Sik* and *Sjm*.
292
6b6d06fa 293@subsubsection specification__boolean_3_1_12 Results
1a457208 294
295* The result of the interference is a shape that can be either interfered shape itself (or its part) or a new shape.
296* The result of the interference is a shape with the dimension value that is less or equal to the minimal dimension value of interfered shapes. For example, the result of Vertex/Edge interference is a vertex, but not an edge.
297* The result of the interference splits the source shapes on the parts each time as it can do that.
298
6b6d06fa 299@subsection specification__boolean_3_2 Paves
1a457208 300
301The result of interferences of the type Vertex/Edge, Edge/Edge and Edge/Face in most cases is a vertex (new or old) lying on an edge.
302
303The result of interferences of the type Face/Face in most cases is intersection curves, which go through some vertices lying on the faces.
304
305The position of vertex *Vi* on curve *C* can be defined by a value of parameter <i>t<sub>i</sub></i> of the 3D point of the vertex on the curve.
306Pave *PVi* on curve *C* is a structure containing the vertex *Vi* and correspondent value of the parameter <i>t<sub>i</sub></i> of the 3D point of the vertex on the curve. Curve *C* can be a 3D or a 2D curve.
307
6b6d06fa 308@figure{/specification/boolean_operations/images/operations_image011.svg,"Paves",340}
1a457208 309
310Two paves *PV1* and *PV2* on the same curve *C* can be compared using the parameter value @code PV1 > PV2 if t1 > t2 @endcode
311
312The usage of paves allows binding of the vertex to the curve (or any structure that contains a curve: edge, intersection curve).
313
314
6b6d06fa 315@subsection specification__boolean_3_3 Pave Blocks
1a457208 316
317A set of paves *PVi (i=1, 2...nPV)*, where *nPV* is the number of paves] of curve *C* can be sorted in the increasing order using the value of parameter *t* on curve *C*.
318
319A pave block *PBi* is a part of the object (edge, intersection curve) between neighboring paves.
320
6b6d06fa 321@figure{/specification/boolean_operations/images/operations_image012.svg,"Pave Blocks",340}
1a457208 322
323Any finite source edge *E* has at least one pave block that contains two paves *PVb* and *PVe*:
324* Pave *PVb* corresponds to the vertex *Vb* with minimal parameter <i>t<sub>b</sub></i> on the curve of the edge.
325* Pave *PVe* corresponds to the vertex *Ve* with maximal parameter <i>t<sub>e</sub></i> on the curve of the edge.
326
6b6d06fa 327@subsection specification__boolean_3_4 Shrunk Range
1a457208 328
e9e33e91 329Pave block *PV* of curve *C* is bounded by vertices *V1* and *V2* with tolerance values *Tol(V1)* and *Tol(V2)*. Curve *C* has its own tolerance value *Tol(C)*:
330* In case of edge, the tolerance value is the tolerance of the edge.
331* In case of intersection curve, the tolerance value is obtained from an intersection algorithm.
1a457208 332
6b6d06fa 333@figure{/specification/boolean_operations/images/operations_image013.svg,"Shrunk Range",340}
1a457208 334
335The theoretical parametric range of the pave block is <i>[t1C, t2C]</i>.
336
337The positions of the vertices *V1* and *V2* of the pave block can be different. The positions are determined by the following conditions:
338~~~~
e9e33e91 339Distance (P1, P1c) is equal or less than Tol(V1) + Tol(C)
340Distance (P2, P2c) is equal or less than Tol(V2) + Tol(C)
1a457208 341~~~~
342The Figure shows that each tolerance sphere of a vertex can reduce the parametric range of the pave block to a range <i>[t1S, t2S]</i>. The range <i>[t1S, t2S]</i> is the shrunk range of the pave block.
343
344The shrunk range of the pave block is the part of 3D curve that can interfere with other shapes.
345
6b6d06fa 346@subsection specification__boolean_3_5 Common Blocks
1a457208 347
348The interferences of the type Edge/Edge, Edge/Face produce results as common parts.
349
350In case of Edge/Edge interference the common parts are pave blocks that have different base edges.
351
6b6d06fa 352@figure{/specification/boolean_operations/images/operations_image014.svg,"Common Blocks: Edge/Edge interference",340}
1a457208 353
354If the pave blocks <i>PB<sub>1</sub>, PB<sub>2</sub>…PB<sub>NbPB</sub></i> , where *NbPB* is the number of pave blocks have the same bounding vertices and geometrically coincide, the pave blocks form common block *CB*.
355
356
357In case of Edge/Face interference the common parts are pave blocks lying on a face(s).
358
6b6d06fa 359@figure{/specification/boolean_operations/images/operations_image015.svg,"Common Blocks: Edge/Face interference",265}
1a457208 360
361If the pave blocks *PBi* geometrically coincide with a face *Fj*, the pave blocks form common block *CB*.
362
363In general case a common block *CB* contains:
364* Pave blocks *PBi (i=0,1,2, 3… NbPB)*.
3f812249 365* A set of faces *Fj (j=0,1... NbF), NbF* -- number of faces.
1a457208 366
367
6b6d06fa 368@subsection specification__boolean_3_6 FaceInfo
1a457208 369
370The structure *FaceInfo* contains the following information:
371* Pave blocks that have state **In** for the face;
372* Vertices that have state **In** for the face;
373* Pave blocks that have state **On** for the face;
374* Vertices that have state **On** for the face;
375* Pave blocks built up from intersection curves for the face;
376* Vertices built up from intersection points for the face.
377
6b6d06fa 378@figure{/specification/boolean_operations/images/operations_image016.svg,"Face Info",420}
1a457208 379
380In the figure, for face *F1*:
381* Pave blocks that have state **In** for the face: *PB<sub>in1</sub>*.
382* Vertices that have state **In** for the face: *V<sub>in1</sub>*.
383* Pave blocks that have state **On** for the face: *PB<sub>on11</sub>*, *PB<sub>on12</sub>*, *PB<sub>on2</sub>*, *PB<sub>on31</sub>*, *PB<sub>on32</sub>*, *PB<sub>on4</sub>*.
384* Vertices that have state **On** for the face: *V1, V2, V3, V4, V5, V6*.
385* Pave blocks built up from intersection curves for the face: *PB<sub>sc1</sub>*.
386* Vertices built up from intersection points for the face: none
387
388
6b6d06fa 389@section specification__boolean_4 Data Structure
1a457208 390
391Data Structure (DS) is used to:
392* Store information about input data and intermediate results;
393* Provide the access to the information;
394* Provide the links between the chunks of information.
395
396This information includes:
397* Arguments;
e9e33e91 398* Shapes;
1a457208 399* Interferences;
400* Pave Blocks;
401* Common Blocks.
402
403Data Structure is implemented in the class *BOPDS_DS*.
404
6b6d06fa 405@subsection specification__boolean_4_1 Arguments
1a457208 406
407The arguments are shapes (in terms of *TopoDS_Shape*):
408* Number of arguments is unlimited.
409* Each argument is a valid shape (in terms of *BRepCheck_Analyzer*).
410* Each argument can be of one of the following types (see the Table):
411
412| No | Type | Index of Type |
413| :----- | :----- | :----- |
414| 1 | COMPOUND | 0 |
415| 2 | COMPSOLID | 1 |
416| 3 | SOLID | 2 |
417| 4 | SHELL | 3 |
418| 5 | FACE | 4 |
419| 6 | WIRE | 5 |
420| 7 | EDGE | 6 |
421| 8 | VERTEX | 7 |
422
423* The argument of type *0 (COMPOUND)* can include any number of shapes of an arbitrary type (0, 1…7).
424* The argument should not be self-interfered, i.e. all sub-shapes of the argument that have geometrical coincidence through any topological entities (vertices, edges, faces) must share these entities.
425* There are no restrictions on the type of underlying geometry of the shapes. The faces or edges of arguments *S<sub>i</sub>* can have underlying geometry of any type supported by Open CASCADE Technology modeling algorithms (in terms of *GeomAbs_CurveType* and *GeomAbs_SurfaceType*).
e9e33e91 426* The faces or edges of the arguments should have underlying geometry with continuity that is not less than C1.
1a457208 427
6b6d06fa 428@subsection specification__boolean_4_2 Shapes
e9e33e91 429
1a457208 430The information about Shapes is stored in structure *BOPDS_ShapeInfo*. The objects of type *BOPDS_ShapeInfo* are stored in the container of array type. The array allows getting the access to the information by an index (DS index).
431The structure *BOPDS_ShapeInfo* has the following contents:
432
433
434| Name | Contents |
435| :-------- | :----- |
436| *myShape* | Shape itself |
437| *myType* | Type of shape |
438| *myBox* | 3D bounding box of the shape |
439| *mySubShapes* | List of DS indices of sub-shapes |
440| *myReference* | Storage for some auxiliary information |
441| *myFlag* | Storage for some auxiliary information |
442
6b6d06fa 443@subsection specification__boolean_4_3 Interferences
1a457208 444
445The information about interferences is stored in the instances of classes that are inherited from class <i>BOPDS_Interf</i>.
446
447| Name | Contents |
448| :----- | :----- |
449| *BOPDS_Interf* | Root class for interference |
450| *Index1* | DS index of the shape 1 |
451| *Index2* | DS index of the shape 2 |
452| *BOPDS_InterfVV* | Storage for Vertex/Vertex interference |
453| *BOPDS_InterfVE* | Storage for Vertex/Edge interference |
454| *myParam* | The value of parameter of the point of the vertex on the curve of the edge |
455| *BOPDS_InterfVF* | Storage for Vertex/Face interference |
456| *myU, myV* | The value of parameters of the point of the vertex on the surface of the face |
457| *BOPDS_InterfEE* | Storage for Edge/Edge interference |
458| *myCommonPart* | Common part (in terms of *IntTools_CommonPart* ) |
459| *BOPDS_InterfEF* | Storage for Edge/Face interference |
e9e33e91 460| *myCommonPart* | Common part (in terms of *IntTools_CommonPart* ) |
1a457208 461| *BOPDS_InterfFF* | Storage for Face/Face interference |
462| *myTolR3D, myTolR2D* | The value of tolerances of curves (points) reached in 3D and 2D |
463| *myCurves* | Intersection Curves (in terms of *BOPDS_Curve*) |
464| *myPoints* | Intersection Points (in terms of *BOPDS_Point*) |
e9e33e91 465| *BOPDS_InterfVZ* | Storage for Vertex/Solid interference |
466| *BOPDS_InterfEZ* | Storage for Edge/Solid interference |
467| *BOPDS_InterfFZ* | Storage for Face/Solid interference |
468| *BOPDS_InterfZZ* | Storage for Solid/Solid interference |
469
470
471
1a457208 472
473
474The Figure shows inheritance diagram for *BOPDS_Interf* classes.
475
6b6d06fa 476@figure{/specification/boolean_operations/images/operations_image017.svg,"BOPDS_Interf classes",420}
1a457208 477
478
6b6d06fa 479@subsection specification__boolean_4_4 Pave, PaveBlock and CommonBlock
1a457208 480
481The information about the pave is stored in objects of type *BOPDS_Pave*.
482
483| Name | Contents |
484| :--- | :------ |
485| *BOPDS_Pave* | |
e9e33e91 486| *myIndex* | DS index of the vertex |
1a457208 487| *myParam* | Value of the parameter of the 3D point of vertex on curve. |
488
489The information about pave blocks is stored in objects of type *BOPDS_PaveBlock*.
490
491| Name | Contents |
492| :--- | :------ |
493| *BOPDS_PaveBlock* | |
494| *myEdge* | DS index of the edge produced from the pave block |
495| *myOriginalEdge* | DS index of the source edge |
496| *myPave1* | Pave 1 (in terms of *BOPDS_Pave*) |
497| *myPave2* | Pave 2 (in terms of *BOPDS_Pave*) |
498| *myExtPaves* | The list of paves (in terms of *BOPDS_Pave*) that is used to store paves lying inside the pave block during intersection process |
499| *myCommonBlock* | The reference to common block (in terms of *BOPDS_CommonBlock*) if the pave block is a common block |
500| *myShrunkData* | The shrunk range of the pave block |
501
502* To be bound to an edge (or intersection curve) the structures of type *BOPDS_PaveBlock* are stored in one container of list type <i>(BOPDS_ListOfPaveBlock)</i>.
503* In case of edge, all the lists of pave blocks above are stored in one container of array type. The array allows getting the access to the information by index of the list of pave blocks for the edge. This index (if exists) is stored in the field *myReference*.
504
505The information about common block is stored in objects of type *BOPDS_CommonBlock*.
506
507| Name | Contents |
508| :---- | :------ |
509| *BOPDS_CommonBlock* | |
6b6d06fa 510| *myPaveBlocks* | The list of pave blocks that are common in terms of @ref specification__boolean_3_5 "Common Blocks" |
1a457208 511| *myFaces* | The list of DS indices of the faces, on which the pave blocks lie. |
512
513
6b6d06fa 514@subsection specification__boolean_4_5 Points and Curves
1a457208 515The information about intersection point is stored in objects of type *BOPDS_Point*.
516
517| Name | Contents |
518| :---- | :----- |
519| *BOPDS_Point* | |
520| *myPnt* | 3D point |
521| *myPnt2D1* | 2D point on the face1 |
522| *myPnt2D2* | 2D point on the face2 |
523
524The information about intersection curve is stored in objects of type *BOPDS_Curve*.
525
526| Name | Contents |
527| :---- | :----- |
528| *BOPDS_Curve* | |
529| *myCurve* | The intersection curve (in terms of *IntTools_Curve* ) |
530| *myPaveBlocks* | The list of pave blocks that belong to the curve |
531| *myBox* | The bounding box of the curve (in terms of *Bnd_Box* ) |
532
6b6d06fa 533@subsection specification__boolean_4_6 FaceInfo
1a457208 534The information about *FaceInfo* is stored in a structure *BOPDS_FaceInfo*.
535The structure *BOPDS_FaceInfo* has the following contents.
536
537| Name | Contents |
538| :---- | :----- |
539| *BOPDS_FaceInfo* | |
540| *myPaveBlocksIn* | Pave blocks that have state In for the face |
541| *myVerticesIn* | Vertices that have state In for the face |
542| *myPaveBlocksOn* | Pave blocks that have state On for the face |
543| *myVerticesOn* | Vertices that have state On for the face |
544| *myPaveBlocksSc* | Pave blocks built up from intersection curves for the face |
545| *myVerticesSc* | Vertices built up from intersection points for the face +
546
547The objects of type *BOPDS_FaceInfo* are stored in one container of array type. The array allows getting the access to the information by index. This index (if exists) is stored in the field *myReference*.
548
6b6d06fa 549@section specification__boolean_root_classes Root Classes
a743814b 550
6b6d06fa 551@subsection specification__boolean_root_classes_1 Class BOPAlgo_Options
a743814b 552The class *BOPAlgo_Options* provides the following options for the algorithms:
553* Set the appropriate memory allocator;
554* Check the presence of the Errors and Warnings;
555* Turn on/off the parallel processing;
556* Set the additional tolerance for the operation;
944768d2 557* Break the operations by user request;
558* Usage of Oriented Bounding boxes in the operation.
a743814b 559
6b6d06fa 560@subsection specification__boolean_root_classes_2 Class BOPAlgo_Algo
a743814b 561
562The class *BOPAlgo_Algo* provides the base interface for all algorithms:
563* Perform the operation;
564* Check the input data;
565* Check the result.
566
6b6d06fa 567@section specification__boolean_5 Intersection Part
1a457208 568
569Intersection Part (IP) is used to
570* Initialize the Data Structure;
571* Compute interferences between the arguments (or their sub-shapes);
572* Compute same domain vertices, edges;
573* Build split edges;
574* Build section edges;
575* Build p-curves;
576* Store all obtained information in DS.
e9e33e91 577
578IP is implemented in the class *BOPAlgo_PaveFiller*.
579
6b6d06fa 580@figure{/specification/boolean_operations/images/operations_image064.png,"Diagram for Class BOPAlgo_PaveFiller",230}
e9e33e91 581
1a457208 582The description provided in the next paragraphs is coherent with the implementation of the method *BOPAlgo_PaveFiller::Perform()*.
583
6b6d06fa 584@subsection specification__boolean_5_1 Initialization
1a457208 585The input data for the step is the Arguments. The description of initialization step is shown in the Table.
586
587| No | Contents | Implementation |
588| :--- | :----- | :----- |
6b6d06fa 589| 1 | Initialization the array of shapes (in terms of @ref specification__boolean_4_2 "Shapes"). Filling the array of shapes. | *BOPDS_DS::Init()* |
590| 2 | Initialization the array pave blocks (in terms of @ref specification__boolean_4_4 "Pave, PaveBlock, CommonBlock") | *BOPDS_DS::Init()* |
591| 3 | Initialization of intersection Iterator. The intersection Iterator is the object that computes intersections between sub-shapes of the arguments in terms of bounding boxes. The intersection Iterator provides approximate number of the interferences for given type (in terms of @ref specification__boolean_3_1 "Interferences") | *BOPDS_Iterator* |
e9e33e91 592| 4 | Initialization of intersection Context. The intersection Context is an object that contains geometrical and topological toolkit (classifiers, projectors, etc). The intersection Context is used to cache the tools to increase the algorithm performance. | *IntTools_Context* |
1a457208 593
594
6b6d06fa 595@subsection specification__boolean_5_2 Compute Vertex/Vertex Interferences
1a457208 596
6b6d06fa 597The input data for this step is the DS after the @ref specification__boolean_5_1 "Initialization". The description of this step is shown in the table :
1a457208 598
599
600| No | Contents | Implementation |
601| :--- | :---- | :----- |
602| 1 | Initialize array of Vertex/Vertex interferences. | *BOPAlgo_PaveFiller::PerformVV()* |
603| 2 | Access to the pairs of interfered shapes <i>(nVi, nVj)k, k=0, 1…nk,</i> where *nVi* and *nVj* are DS indices of vertices *Vi* and *Vj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
604| 3 | Compute the connexity chains of interfered vertices *nV1C, nV2C… nVnC)k, C=0, 1…nCs*, where *nCs* is the number of the connexity chains | *BOPAlgo_Tools::MakeBlocksCnx()* |
605| 4 | Build new vertices from the chains *VNc. C=0, 1…nCs.* | *BOPAlgo_PaveFiller::PerformVV()* |
606| 5 | Append new vertices in DS. | *BOPDS_DS::Append()* |
607| 6 | Append same domain vertices in DS. | *BOPDS_DS::AddShapeSD()* |
608| 7 | Append Vertex/Vertex interferences in DS. | *BOPDS_DS::AddInterf()* |
609
610* The pairs of interfered vertices are: <i>(nV11, nV12), (nV11, nV13), (nV12, nV13), (nV13, nV15), (nV13, nV14), (nV14, nV15), (nV21, nV22), (nV21, nV23), (nV22, nV23);</i>
611* These pairs produce two chains: <i>(nV11, nV12, nV13, nV14, nV15)</i> and <i>(nV21, nV22, nV23);</i>
612* Each chain is used to create a new vertex, *VN1* and *VN2*, correspondingly.
613
614The example of connexity chains of interfered vertices is given in the image:
615
6b6d06fa 616@figure{/specification/boolean_operations/images/operations_image018.svg,"Connexity chains of interfered vertices",394}
1a457208 617
618
6b6d06fa 619@subsection specification__boolean_5_3 Compute Vertex/Edge Interferences
1a457208 620
621The input data for this step is the DS after computing Vertex/Vertex interferences.
622
623| No | Contents | Implementation |
624| :--- | :--- | :--- |
625| 1 | Initialize array of Vertex/Edge interferences | *BOPAlgo_PaveFiller::PerformVE()* |
626| 2 | Access to the pairs of interfered shapes <i>(nVi, nEj)k k=0, 1…nk,</i> where *nVi* is DS index of vertex *Vi*, *nEj* is DS index of edge *Ej* and *nk* is the number of pairs. | *BOPDS_Iterator* |
6b6d06fa 627| 3 | Compute paves. See @ref specification__boolean_3_1_2 "Vertex/Edge Interference" | *BOPInt_Context::ComputeVE()* |
1a457208 628| 4 | Initialize pave blocks for the edges *Ej* involved in the interference | *BOPDS_DS:: ChangePaveBlocks()* |
6b6d06fa 629| 5 | Append the paves into the pave blocks in terms of @ref specification__boolean_4_4 "Pave, PaveBlock and CommonBlock" | *BOPDS_PaveBlock:: AppendExtPave()* |
1a457208 630| 6 | Append Vertex/Edge interferences in DS | *BOPDS_DS::AddInterf()* |
631
6b6d06fa 632@subsection specification__boolean_5_4 Update Pave Blocks
1a457208 633The input data for this step is the DS after computing Vertex/Edge Interferences.
634
635| No | Contents | Implementation |
636| :--- | :---- | :--- |
637| 1 | Each pave block PB containing internal paves is split by internal paves into new pave blocks *PBN1, PBN2… PBNn*. PB is replaced by new pave blocks *PBN1, PBN2… PBNn* in the DS. | *BOPDS_DS:: UpdatePaveBlocks()* |
638
6b6d06fa 639@subsection specification__boolean_5_5 Compute Edge/Edge Interferences
1a457208 640
641The input data for this step is the DS after updating Pave Blocks.
642
643| No | Contents | Implementation |
644| :---- | :---- | :----- |
645| 1 | Initialize array of Edge/Edge interferences | *BOPAlgo_PaveFiller::PerformEE()* |
646| 2 | Access to the pairs of interfered shapes <i>(nEi, nEj)k, k=0, 1…nk,</i> where *nEi* is DS index of the edge *Ei*, *nEj* is DS index of the edge *Ej* and *nk* is the number of pairs. | *BOPDS_Iterator* |
647| 3 | Initialize pave blocks for the edges involved in the interference, if it is necessary. | *BOPDS_DS:: ChangePaveBlocks()* |
648| 4 | Access to the pave blocks of interfered shapes: <i>(PBi1, PBi2…PBiNi)</i> for edge *Ei* and <i>(PBj1, PBj2…PBjNj)</i> for edge *Ej* | *BOPAlgo_PaveFiller::PerformEE()* |
6b6d06fa 649| 5 | Compute shrunk data for pave blocks in terms of @ref specification__boolean_4_4 "Pave, PaveBlock and CommonBlock", if it is necessary. | *BOPAlgo_PaveFiller::FillShrunkData()* |
1a457208 650| 6 | Compute Edge/Edge interference for pave blocks *PBix* and *PBiy*. The result of the computation is a set of objects of type *IntTools_CommonPart* | *IntTools_EdgeEdge* |
651| 7.1 | For each *CommonPart* of type *VERTEX:* Create new vertices *VNi (i =1, 2…,NbVN),* where *NbVN* is the number of new vertices. Intersect the vertices *VNi* using the steps Initialization and compute Vertex/Vertex interferences as follows: a) create a new object *PFn* of type *BOPAlgo_PaveFiller* with its own DS; b) use new vertices *VNi (i=1, 2…,NbVN), NbVN* as arguments (in terms of *TopoDs_Shape*) of *PFn*; c) invoke method *Perform()* for *PFn*. The resulting vertices *VNXi (i=1, 2…,NbVNX)*, where *NbVNX* is the number of vertices, are obtained via mapping between *VNi* and the results of *PVn*. | *BOPTools_Tools::MakeNewVertex()* |
652| 7.2 | For each *CommonPart* of type *EDGE:* Compute the coinciding connexity chains of pave blocks <i>(PB1C, PB2C… PNnC)k, C=0, 1…nCs,</i> where *nCs* is the number of the connexity chains. Create common blocks <i>(CBc. C=0, 1…nCs)</i> from the chains. Attach the common blocks to the pave blocks. | *BOPAlgo_Tools::PerformCommonBlocks()* |
6b6d06fa 653| 8 | Post-processing. Append the paves of *VNXi* into the corresponding pave blocks in terms of @ref specification__boolean_4_4 "Pave, PaveBlock and CommonBlock" | *BOPDS_PaveBlock:: AppendExtPave()* |
1a457208 654| 9 | Split common blocks CBc by the paves. | *BOPDS_DS:: UpdateCommonBlock()* |
655| 10 | Append Edge/Edge interferences in the DS. | *BOPDS_DS::AddInterf()* |
656
657The example of coinciding chains of pave blocks is given in the image:
658
6b6d06fa 659@figure{/specification/boolean_operations/images/operations_image019.png,"Coinciding chains of pave blocks",420}
1a457208 660
661* The pairs of coincided pave blocks are: <i>(PB11, PB12), (PB11, PB13), (PB12, PB13), (PB21, PB22), (PB21, PB23), (PB22, PB23).</i>
662* The pairs produce two chains: <i>(PB11, PB12, PB13)</i> and <i>(PB21, PB22, PB23).</i>
663
6b6d06fa 664@subsection specification__boolean_5_6 Compute Vertex/Face Interferences
1a457208 665
666The input data for this step is the DS after computing Edge/Edge interferences.
667
668| No | Contents | Implementation |
669| :---- | :--- | :---- |
670| 1 | Initialize array of Vertex/Face interferences | *BOPAlgo_PaveFiller::PerformVF()* |
671| 2 | Access to the pairs of interfered shapes <i>(nVi, nFj)k, k=0, 1…nk,</i> where *nVi* is DS index of the vertex *Vi*, *nFj* is DS index of the edge *Fj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
6b6d06fa 672| 3 | Compute interference See @ref specification__boolean_3_1_3 "Vertex/Face Interference" | *BOPInt_Context::ComputeVF()* |
e9e33e91 673| 4 | Append Vertex/Face interferences in the DS | *BOPDS_DS::AddInterf()* |
1a457208 674| 5 | Repeat steps 2-4 for each new vertex *VNXi (i=1, 2…,NbVNX),* where *NbVNX* is the number of vertices. | *BOPAlgo_PaveFiller::TreatVerticesEE()* |
675
6b6d06fa 676@subsection specification__boolean_5_7 Compute Edge/Face Interferences
1a457208 677The input data for this step is the DS after computing Vertex/Face Interferences.
678
679| No | Contents | Implementation |
680| :---- | :---- | :---- |
681| 1 | Initialize array of Edge/Face interferences | *BOPAlgo_PaveFiller::PerformEF()* |
682| 2 | Access to the pairs of interfered shapes <i>(nEi, nFj)k, k=0, 1…nk,</i> where *nEi* is DS index of edge *Ei*, *nFj* is DS index of face *Fj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
683| 3 | Initialize pave blocks for the edges involved in the interference, if it is necessary. | *BOPDS_DS::ChangePaveBlocks()* |
684| 4 | Access to the pave blocks of interfered edge <i>(PBi1, PBi2…PBiNi)</i> for edge *Ei* | *BOPAlgo_PaveFiller::PerformEF()* |
6b6d06fa 685| 5 | Compute shrunk data for pave blocks (in terms of @ref specification__boolean_4_4 "Pave, PaveBlock and CommonBlock") if it is necessary. | *BOPAlgo_PaveFiller::FillShrunkData()* |
1a457208 686| 6 | Compute Edge/Face interference for pave block *PBix*, and face *nFj*. The result of the computation is a set of objects of type *IntTools_CommonPart* | *IntTools_EdgeFace* |
687| 7.1 | For each *CommonPart* of type *VERTEX:* Create new vertices *VNi (i=1, 2…,NbVN),* where *NbVN* is the number of new vertices. Merge vertices *VNi* as follows: a) create new object *PFn* of type *BOPAlgo_PaveFiller* with its own DS; b) use new vertices *VNi (i=1, 2…,NbVN), NbVN* as arguments (in terms of *TopoDs_Shape*) of *PFn*; c) invoke method *Perform()* for *PFn*. The resulting vertices *VNXi (i=1, 2…,NbVNX)*, where *NbVNX* is the number of vertices, are obtained via mapping between *VNi* and the results of *PVn*. | *BOPTools_Tools::MakeNewVertex()* and *BOPAlgo_PaveFiller::PerformVertices1()* |
688| 7.2 | For each *CommonPart* of type *EDGE:* Create common blocks <i>(CBc. C=0, 1…nCs)</i> from pave blocks that lie on the faces. Attach the common blocks to the pave blocks. | *BOPAlgo_Tools::PerformCommonBlocks()* |
6b6d06fa 689| 8 | Post-processing. Append the paves of *VNXi* into the corresponding pave blocks in terms of @ref specification__boolean_4_4 "Pave, PaveBlock and CommonBlock". | *BOPDS_PaveBlock:: AppendExtPave()* |
1a457208 690| 9 | Split pave blocks and common blocks *CBc* by the paves. | *BOPAlgo_PaveFiller::PerformVertices1()*, *BOPDS_DS:: UpdatePaveBlock()* and *BOPDS_DS:: UpdateCommonBlock()* |
691| 10 | Append Edge/Face interferences in the DS | *BOPDS_DS::AddInterf()* |
692| 11 | Update *FaceInfo* for all faces having EF common parts. | *BOPDS_DS:: UpdateFaceInfoIn()* |
693
694
6b6d06fa 695@subsection specification__boolean_5_8 Build Split Edges
1a457208 696
697The input data for this step is the DS after computing Edge/Face Interferences.
698
699For each pave block *PB* take the following steps:
700
701| No | Contents | Implementation |
702| :--- | :--- | :--- |
6b6d06fa 703| 1 | Get the real pave block *PBR*, which is equal to *PB* if *PB* is not a common block and to *PB<sub>1</sub>* if *PB* is a common block. *PB<sub>1</sub>* is the first pave block in the pave blocks list of the common block. See @ref specification__boolean_4_4 "Pave, PaveBlock and CommonBlock". | *BOPAlgo_PaveFiller::MakeSplitEdges()* |
1a457208 704| 2 | Build the split edge *Esp* using the information from *DS* and *PBR*. | *BOPTools_Tools::MakeSplitEdge()* |
705| 3 | Compute *BOPDS_ShapeInfo* contents for Esp | *BOPAlgo_PaveFiller::MakeSplitEdges()* |
706| 4 | Append *BOPDS_ShapeInfo* contents to the DS | *BOPDS_DS::Append()* |
707
6b6d06fa 708@subsection specification__boolean_5_9 Compute Face/Face Interferences
1a457208 709
710The input data for this step is DS after building Split Edges.
711
712| No | Contents | Implementation |
713| :--- | :--- | :--- |
e9e33e91 714| 1 | Initialize array of Face/Face interferences | *BOPAlgo_PaveFiller::PerformFF()* |
1a457208 715| 2 | Access to the pairs of interfered shapes <i>(nFi, nFj)k, k=0, 1…nk,</i> where *nFi* is DS index of edge *Fi*, *nFj* is DS index of face *Fj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
716| 3 | Compute Face/Face interference | *IntTools_FaceFace* |
717| 4 | Append Face/Face interferences in the DS. | *BOPDS_DS::AddInterf()* |
718
6b6d06fa 719@subsection specification__boolean_5_10 Build Section Edges
1a457208 720
e9e33e91 721The input data for this step is the DS after computing Face/Face interferences.
1a457208 722
723| No | Contents | Implementation |
724| :---- | :---- | :---- |
6b6d06fa 725| 1 | For each Face/Face interference *nFi, nFj*, retrieve @ref specification__boolean_4_6 "FaceInfo". Create draft vertices from intersection points *VPk (k=1, 2…, NbVP)*, where *NbVP* is the number of new vertices, and the draft vertex *VPk* is created from an intersection point if *VPk ≠ Vm (m = 0, 1, 2… NbVm)*, where *Vm* is an existing vertex for the faces *nFi* and *nF,j* (*On* or *In* in terms of *TopoDs_Shape*), *NbVm* is the number of vertices existing on faces *nFi* and *nF,j* and ≠ -- means non-coincidence in terms of @ref specification__boolean_3_1_1 "Vertex/Vertex interference". | *BOPAlgo_PaveFiller::MakeBlocks()* |
1a457208 726| 2 | For each intersection curve *Cijk* | |
727| 2.1 | Create paves PVc for the curve using existing vertices, i.e. vertices On or In (in terms of *FaceInfo*) for faces *nFi* and *nFj*. Append the paves *PVc* | *BOPAlgo_PaveFiller::PutPaveOnCurve()* and *BOPDS_PaveBlock::AppendExtPave()* |
728| 2.2 | Create technological vertices *Vt*, which are the bounding points of an intersection curve (with the value of tolerance *Tol(Cijk)*). Each vertex *Vt* with parameter *Tt* on curve *Cijk* forms pave *PVt* on curve *Cijk*. Append technological paves. | *BOPAlgo_PaveFiller::PutBoundPaveOnCurve()* |
729| 2.3 | Create pave blocks *PBk* for the curve using paves <i>(k=1, 2…, NbPB)</i>, where *NbPB* is the number of pave blocks | *BOPAlgo_PaveFiller::MakeBlocks()* |
6b6d06fa 730| 2.4 | Build draft section edges *ESk* using the pave blocks <i>(k=1, 2…, NbES)</i>, where *NbES* is the number of draft section edges The draft section edge is created from a pave block *PBk* if *PBk* has state *In* or *On* for both faces *nFi* and *nF,j* and *PBk ≠ PBm (m=0, 1, 2… NbPBm)*, where *PBm* is an existing pave block for faces *nFi* and *nF,j* (*On* or *In* in terms of *FaceInfo*), *NbVm* is the number of existing pave blocks for faces *nFi* and *nF,j* and ≠ -- means non-coincidence (in terms of @ref specification__boolean_3_1_3 "Vertex/Face interference"). | *BOPTools_Tools::MakeEdge()* |
731| 3 | Intersect the draft vertices *VPk (k=1, 2…, NbVP)* and the draft section edges *ESk (k=1, 2…, NbES)*. For this: a) create new object *PFn* of type *BOPAlgo_PaveFiller* with its own DS; b) use vertices *VPk* and edges *ESk* as arguments (in terms of @ref specification__boolean_4_1 "Arguments") of *PFn*; c) invoke method *Perform()* for *PFn*. Resulting vertices *VPXk (k=1, 2… NbVPX)* and edges *ESXk (k=1, 2… NbESX)* are obtained via mapping between *VPk, ESk* and the results of *PVn*. | *BOPAlgo_PaveFiller::PostTreatFF()* |
1a457208 732| 4 | Update face info (sections about pave blocks and vertices) | *BOPAlgo_PaveFiller::PerformFF()* |
733
6b6d06fa 734@subsection specification__boolean_5_11 Build P-Curves
1a457208 735The input data for this step is the DS after building section edges.
736
737| No | Contents | Implementation |
738| :---- | :---- | :---- |
739| 1 | For each Face/Face interference *nFi* and *nFj* build p-Curves on *nFi* and *nFj* for each section edge *ESXk*. | *BOPAlgo_PaveFiller::MakePCurves()* |
740| 2 | For each pave block that is common for faces *nFi* and *nFj* build p-Curves on *nFi* and *nFj*. | *BOPAlgo_PaveFiller::MakePCurves()* |
741
6b6d06fa 742@subsection specification__boolean_5_12 Process Degenerated Edges
1a457208 743The input data for this step is the DS after building P-curves.
744
745| No | Contents | Implementation |
746| :---- | :---- | :---- |
747| | For each degenerated edge *ED* having vertex *VD* | BOPAlgo_PaveFiller::ProcessDE() |
748| 1 | Find pave blocks *PBi (i=1,2… NbPB)*, where *NbPB* is the number of pave blocks, that go through vertex *VD*. | *BOPAlgo_PaveFiller::FindPaveBlocks()* |
749| 2 | Compute paves for the degenerated edge *ED* using a 2D curve of *ED* and a 2D curve of *PBi*. Form pave blocks *PBDi (i=1,2… NbPBD)*, where *NbPBD* is the number of the pave blocks for the degenerated edge *ED* | *BOPAlgo_PaveFiller::FillPaves()* |
750| 3 | Build split edges *ESDi (i=1,2…NbESD)*, where *ESD* is the number of split edges, using the pave blocks *PBDi* | *BOPAlgo_PaveFiller:: MakeSplitEdge()* |
751
6b6d06fa 752@section specification__boolean_6 General description of the Building Part
1a457208 753
754Building Part (BP) is used to
755* Build the result of the operation
756* Provide history information (in terms of <i>\::Generated(), \::Modified()</i> and <i>\::IsDeleted()</i>)
757BP uses the DS prepared by *BOPAlgo_PaveFiller* described at chapter 5 as input data.
758BP is implemented in the following classes:
3f812249 759* *BOPAlgo_Builder* -- for the General Fuse operator (GFA).
760* *BOPAlgo_BOP* -- for the Boolean Operation operator (BOA).
761* *BOPAlgo_Section* -- for the Section operator (SA).
a743814b 762* *BOPAlgo_MakerVolume* -- for the Volume Maker operator.
763* *BOPAlgo_Splitter* -- for the Splitter operator.
764* *BOPAlgo_CellsBuilder* -- for the Cells Builder operator.
1a457208 765
6b6d06fa 766@figure{/specification/boolean_operations/images/operations_image020.png,"Diagram for BP classes",300}
1a457208 767
1a457208 768The class *BOPAlgo_BuilderShape* provides the interface for algorithms that have:
769* A Shape as the result;
770* History information (in terms of <i>\::Generated(), \::Modified()</i> and <i>\::IsDeleted()).</i>
771
6b6d06fa 772@section specification__boolean_7 General Fuse Algorithm
773@subsection specification__boolean_7_1 Arguments
774The arguments of the algorithm are shapes (in terms of *TopoDS_Shape*). The main requirements for the arguments are described in @ref specification__boolean_4 "Data Structure" chapter.
1a457208 775
6b6d06fa 776@subsection specification__boolean_7_2 Results
1a457208 777
778During the operation argument *Si* can be split into several parts *Si1, Si2… Si1NbSp*, where *NbSp* is the number of parts. The set <i>(Si1, Si2… Si1NbSp)</i> is an image of argument *Si*.
e9e33e91 779* The result of the General Fuse operation is a compound. Each sub-shape of the compound corresponds to the certain argument shape S1, S2…Sn and has shared sub-shapes in accordance with interferences between the arguments.
1a457208 780* For the arguments of the type EDGE, FACE, SOLID the result contains split parts of the argument.
781* For the arguments of the type WIRE, SHELL, COMPSOLID, COMPOUND the result contains the image of the shape of the corresponding type (i.e. WIRE, SHELL, COMPSOLID or COMPOUND).
782The types of resulting shapes depend on the type of the corresponding argument participating in the operation. See the table below:
783
784| No | Type of argument | Type of resulting shape | Comments |
785| :--- | :---- | :--- | :--- |
786| 1 | COMPOUND | COMPOUND | The resulting COMPOUND is built from images of sub-shapes of type COMPOUND COMPSOLID, SHELL, WIRE and VERTEX. Sets of split sub-shapes of type SOLID, FACE, EDGE. |
787| 2 | COMPSOLID | COMPSOLID | The resulting COMPSOLID is built from split SOLIDs. |
788| 3 | SOLID | Set of split SOLIDs | |
789| 4 | SHELL | SHELL | The resulting SHELL is built from split FACEs |
790| 5 | FACE | Set of split FACEs | |
791| 6 | WIRE | WIRE | The resulting WIRE is built from split EDGEs |
792| 7 | EDGE | Set of split EDGEs | |
793| 8 | VERTEX | VERTEX | |
794
6b6d06fa 795@subsection specification__boolean_7_3a Options
944768d2 796
797The General Fuse algorithm has a set of options, which allow speeding-up the operation and improving the quality of the result:
798* Parallel processing option allows running the algorithm in parallel mode;
799* Fuzzy option allows setting the additional tolerance for the operation;
800* Safe input shapes option allows preventing modification of the input shapes;
801* Gluing option allows speeding-up the intersection of the arguments;
802* Possibility to disable the check for the inverted solids among input shapes;
803* Usage of Oriented Bounding Boxes in the operation;
804* History support.
805
6b6d06fa 806For more detailed information on these options, see the @ref specification__boolean_11a "Advanced options" section.
944768d2 807
6b6d06fa 808@subsection specification__boolean_7_3b Usage
944768d2 809
810The following example illustrates how to use the GF algorithm:
811
812#### Usage of the GF algorithm on C++ level
813
814~~~~
815BOPAlgo_Builder aBuilder;
816// Setting arguments
817TopTools_ListOfShape aLSObjects = …; // Objects
818aBuilder.SetArguments(aLSObjects);
819
820// Setting options for GF
821
822// Set parallel processing mode (default is false)
823Standard_Boolean bRunParallel = Standard_True;
824aBuilder.SetRunParallel(bRunParallel);
825
826// Set Fuzzy value (default is Precision::Confusion())
827Standard_Real aFuzzyValue = 1.e-5;
828aBuilder.SetFuzzyValue(aFuzzyValue);
829
830// Set safe processing mode (default is false)
831Standard_Boolean bSafeMode = Standard_True;
832aBuilder.SetNonDestructive(bSafeMode);
833
834// Set Gluing mode for coinciding arguments (default is off)
835BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueShift;
836aBuilder.SetGlue(aGlue);
837
838// Disabling/Enabling the check for inverted solids (default is true)
839Standard Boolean bCheckInverted = Standard_False;
840aBuilder.SetCheckInverted(bCheckInverted);
841
842// Set OBB usage (default is false)
843Standard_Boolean bUseOBB = Standard_True;
844aBuilder.SetUseOBB(buseobb);
845
846// Perform the operation
847aBuilder.Perform();
848
849// Check for the errors
850if (aBuilder.HasErrors())
851{
852 return;
853}
854
855// Check for the warnings
856if (aBuilder.HasWarnings())
857{
858 // treatment of the warnings
859 ...
860}
861
862// result of the operation
863const TopoDS_Shape& aResult = aBuilder.Shape();
864~~~~
865
866#### Usage of the GF algorithm on Tcl level
867
868~~~~
869# prepare the arguments
870box b1 10 10 10
871box b2 3 4 5 10 10 10
872box b3 5 6 7 10 10 10
873
874# clear inner contents
875bclearobjects; bcleartools;
876
877# set the arguments
878baddobjects b1 b2 b3
879
880# setting options for GF
881
882# set parallel processing mode (default is 0)
883brunparallel 1
884
885# set Fuzzy value
886bfuzzyvalue 1.e-5
887
888# set safe processing mode (default is 0)
889bnondestructive 1
890
891# set gluing mode (default is 0)
892bglue 1
893
894# set check for inverted (default is 1)
895bcheckinverted 0
896
897# set obb usage (default is 0)
898buseobb 1
899
900# perform intersection
901bfillds
902
a25d5aaa 903# perform GF operation
944768d2 904bbuild result
905~~~~
906
6b6d06fa 907@subsection specification__boolean_7_3 Examples
1a457208 908
07f2b741 909Have a look at the examples to better understand the definitions.
1a457208 910
6b6d06fa 911@subsubsection specification__boolean_7_3_1 Case 1: Three edges intersecting at a point
1a457208 912
913Let us consider three edges: *E1, E2* and *E3* that intersect in one 3D point.
914
6b6d06fa 915@figure{/specification/boolean_operations/images/operations_image021.svg,"Three Intersecting Edges",420}
1a457208 916
917The result of the GFA operation is a compound containing 6 new edges: *E11, E12, E21, E22, E31*, and *E32*. These edges have one shared vertex *Vn1*.
918
919In this case:
920* The argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*).
921* The argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
922* The argument edge *E3* has resulting split edges *E31* and *E32* (image of *E3*).
923
6b6d06fa 924@subsubsection specification__boolean_7_3_2 Case 2: Two wires and an edge
1a457208 925
926Let us consider two wires *W1 (Ew11, Ew12, Ew13)* and *W2 (Ew21, Ew22, Ew23)* and edge *E1*.
927
6b6d06fa 928@figure{/specification/boolean_operations/images/operations_image022.svg,"Two wires and an edge",420}
1a457208 929
930The result of the GF operation is a compound consisting of 2 wires: *Wn1 (Ew11, En1, En2, En3, Ew13)* and *Wn2 (Ew21, En2, En3, En4, Ew23)* and two edges: *E11* and *E12*.
931
932In this case :
933* The argument *W1* has image *Wn1*.
934* The argument *W2* has image *Wn2*.
935* The argument edge *E1* has split edges *E11* and *E12*. (image of *E1*).
936The edges *En1, En2, En3, En4* and vertex *Vn1* are new shapes created during the operation. Edge *Ew12* has split edges *En1, En2* and *En3* and edge *Ew22* has split edges *En2, En3* and *En4*.
937
6b6d06fa 938@subsubsection specification__boolean_7_3_3 Case 3: An edge intersecting with a face
1a457208 939
940Let us consider edge *E1* and face *F2*:
941
6b6d06fa 942@figure{/specification/boolean_operations/images/operations_image023.svg,"An edge intersecting with a face",420}
1a457208 943
944The result of the GF operation is a compound consisting of 3 shapes:
945* Split edge parts *E11* and *E12* (image of *E1*).
946* New face *F21* with internal edge *E12* (image of *F2*).
947
6b6d06fa 948@subsubsection specification__boolean_7_3_4 Case 4: An edge lying on a face
1a457208 949
950Let us consider edge *E1* and face *F2*:
951
6b6d06fa 952@figure{/specification/boolean_operations/images/operations_image024.svg,"An edge lying on a face",420}
1a457208 953
954The result of the GF operation is a compound consisting of 5 shapes:
955* Split edge parts *E11, E12* and *E13* (image of *E1*).
956* Split face parts *F21* and *F22* (image of *F2*).
957
958
6b6d06fa 959@subsubsection specification__boolean_7_3_5 Case 5: An edge and a shell
1a457208 960
961Let us consider edge *E1* and shell *Sh2* that consists of 2 faces: *F21* and *F22*
962
6b6d06fa 963@figure{/specification/boolean_operations/images/operations_image025.svg,"An edge and a shell",488}
1a457208 964
965The result of the GF operation is a compound consisting of 5 shapes:
966* Split edge parts *E11, E12 , E13* and *E14* (image of *E1*).
967* Image shell *Sh21* (that contains split face parts *F211, F212, F221* and *F222*).
968
6b6d06fa 969@subsubsection specification__boolean_7_3_6 Case 6: A wire and a shell
1a457208 970
971Let us consider wire *W1 (E1, E2, E3, E4)* and shell *Sh2 (F21, F22)*.
6b6d06fa 972@figure{/specification/boolean_operations/images/operations_image026.svg,"A wire and a shell",427}
1a457208 973
974The result of the GF operation is a compound consisting of 2 shapes:
975
976* Image wire *W11* that consists of split edge parts from wire *W1: E11, E12, E13* and *E14*.
977* Image shell *Sh21* that contains split face parts: *F211, F212, F213, F221, F222* and *F223*.
978
6b6d06fa 979@subsubsection specification__boolean_7_3_7 Case 7: Three faces
1a457208 980
6b6d06fa 981Let us consider 3 faces: *F1, F2* and *F3*. @figure{/specification/boolean_operations/images/operations_image027.png,"Three faces",420}
1a457208 982
983The result of the GF operation is a compound consisting of 7 shapes:
984* Split face parts: *Fn1, Fn2, Fn3, Fn4, Fn5, Fn6* and *Fn7*.
985
6b6d06fa 986@subsubsection specification__boolean_7_3_8 Case 8: A face and a shell
1a457208 987
988Let us consider shell *Sh1 (F11, F12, F13)* and face *F2*.
6b6d06fa 989@figure{/specification/boolean_operations/images/operations_image028.png,"A face and a shell",420}
1a457208 990
991The result of the GF operation is a compound consisting of 4 shapes:
992* Image shell *Sh11* that consists of split face parts from shell *Sh1: Fn1, Fn2, Fn3, Fn4, Fn5* and *Fn6*.
993* Split parts of face *F2: Fn3, Fn6* and *Fn7*.
994
6b6d06fa 995@subsubsection specification__boolean_7_3_9 Case 9: A shell and a solid
1a457208 996
6b6d06fa 997Let us consider shell *Sh1 (F11, F12…F16)* and solid *So2*. @figure{/specification/boolean_operations/images/operations_image029.png,"A shell and a solid: arguments",220}
1a457208 998
999The result of the GF operation is a compound consisting of 2 shapes:
1000* Image shell *Sh11* consisting of split face parts of *Sh1: Fn1, Fn2 ... Fn8.*
1001* Solid *So21* with internal shell. (image of *So2*).
6b6d06fa 1002@figure{/specification/boolean_operations/images/operations_image030.png,"A shell and a solid: results",420}
1a457208 1003
6b6d06fa 1004@subsubsection specification__boolean_7_3_10 Case 10: A compound and a solid
1a457208 1005
1006Let us consider compound *Cm1* consisting of 2 solids *So11* and *So12*) and solid *So2*.
6b6d06fa 1007@figure{/specification/boolean_operations/images/operations_image031.png,"A compound and a solid: arguments",220}
1a457208 1008
1009The result of the GF operation is a compound consisting of 4 shapes:
1010* Image compound *Cm11* consisting of split solid parts from *So11* and *So12 (Sn1, Sn2, Sn3, Sn4)*.
1011* Split parts of solid *So2 (Sn2, Sn3, Sn5)*.
1012
6b6d06fa 1013@figure{/specification/boolean_operations/images/operations_image032.png,"A compound and a solid: results",420}
1a457208 1014
6b6d06fa 1015@subsection specification__boolean_7_4 Class BOPAlgo_Builder
1a457208 1016
1017GFA is implemented in the class *BOPAlgo_Builder*.
1018
6b6d06fa 1019@subsubsection specification__boolean_7_4_1 Fields
1a457208 1020
1021The main fields of the class are described in the Table:
1022
1023| Name | Contents |
1024| :---- | :---- |
1025| *myPaveFiller* | Pointer to the *BOPAlgo_PaveFiller* object |
1026| *myDS* | Pointer to the *BOPDS_DS* object |
1027| *myContext* | Pointer to the intersection Context |
1028| *myImages* | The Map between the source shape and its images |
1029| *myShapesSD* | The Map between the source shape (or split part of source shape) and the shape (or part of shape) that will be used in result due to same domain property. |
1030
6b6d06fa 1031@subsubsection specification__boolean_7_4_2 Initialization
1a457208 1032
6b6d06fa 1033The input data for this step is a *BOPAlgo_PaveFiller* object (in terms of @ref specification__boolean_5 "Intersection") at the state after @ref specification__boolean_5_12 "Processing of degenerated edges" with the corresponding DS.
1a457208 1034
1035| No | Contents | Implementation |
1036| :---- | :---- | :---- |
1037| 1 | Check the readiness of the DS and *BOPAlgo_PaveFiller*. | *BOPAlgo_Builder::CheckData()* |
1038| 2 | Build an empty result of type Compound. | *BOPAlgo_Builder::Prepare()* |
1039
6b6d06fa 1040@subsubsection specification__boolean_7_4_3 Build Images for Vertices
1a457208 1041
d6b4d3d0 1042The input data for this step is *BOPAlgo_Builder* object after Initialization.
1a457208 1043
1044| No | Contents | Implementation |
1045| :--- | :--- | :--- |
1046| 1 | Fill *myShapesSD* by SD vertices using the information from the DS. | *BOPAlgo_Builder::FillImagesVertices()* |
1047
6b6d06fa 1048@subsubsection specification__boolean_7_4_4 Build Result of Type Vertex
1a457208 1049
1050The input data for this step is *BOPAlgo_Builder* object after building images for vertices and *Type*, which is the shape type (*TopAbs_VERTEX*).
1051
1052| No | Contents | Implementation |
1053| :--- | :--- | :----- |
1054| 1 | For the arguments of type *Type*. If there is an image for the argument: add the image to the result. If there is no image for the argument: add the argument to the result. | *BOPAlgo_Builder::BuildResult()* |
1055
6b6d06fa 1056@subsubsection specification__boolean_7_4_5 Build Images for Edges
1a457208 1057
1058The input data for this step is *BOPAlgo_Builder object* after building result of type vertex.
1059
1060| No | Contents | Implementation |
1061| :---- | :---- | :----- |
1062| 1 | For all pave blocks in the DS. Fill *myImages* for the original edge *E* by split edges *ESPi* from pave blocks. In case of common blocks on edges, use edge *ESPSDj* that corresponds to the leading pave block and fill *myShapesSD* by the pairs *ESPi/ESPSDj*. | *BOPAlgo_Builder::FillImagesEdges()* |
1063
6b6d06fa 1064@subsubsection specification__boolean_7_4_6 Build Result of Type Edge
1a457208 1065
6b6d06fa 1066This step is the same as @ref specification__boolean_7_4_4 "Building Result of Type Vertex", but for the type *Edge*.
1a457208 1067
6b6d06fa 1068@subsubsection specification__boolean_7_4_7 Build Images for Wires
1a457208 1069
1070The input data for this step is:
1071* *BOPAlgo_Builder* object after building result of type *Edge*;
3f812249 1072* Original Shape -- Wire
1073* *Type* -- the shape type <i>(TopAbs_WIRE).</i>
1a457208 1074
1075| No | Contents | Implementation |
1076| :---- | :---- | :----- |
1077| 1 | For all arguments of the type *Type*. Create a container C of the type *Type*. | *BOPAlgo_Builder::FillImagesContainers()* |
1078| 2 | Add to C the images or non-split parts of the *Original Shape*, taking into account its orientation. | *BOPAlgo_Builder::FillImagesContainers()* *BOPTools_Tools::IsSplitToReverse()* |
1079| 3 | Fill *myImages* for the *Original Shape* by the information above. | *BOPAlgo_Builder::FillImagesContainers()* |
1080
6b6d06fa 1081@subsubsection specification__boolean_7_4_8 Build Result of Type Wire
1a457208 1082
6b6d06fa 1083This step is the same as @ref specification__boolean_7_4_4 "Building Result of Type Vertex" but for the type *Wire*.
1a457208 1084
6b6d06fa 1085@subsubsection specification__boolean_7_4_9 Build Images for Faces
1a457208 1086
1087The input data for this step is *BOPAlgo_Builder* object after building result of type *Wire*.
1088
1089| No | Contents | Implementation |
1090| :--- | :--- | :--- |
1091| 1 | Build Split Faces for all interfered DS shapes *Fi* of type *FACE*. | |
1092| 1.1 | Collect all edges or their images of *Fi(ESPij)*. | *BOPAlgo_Builder::BuildSplitFaces()* |
1093| 1.2 | Impart to ESPij the orientation to be coherent with the original one. | *BOPAlgo_Builder::BuildSplitFaces()* |
1094| 1.3 | Collect all section edges *SEk* for *Fi*. | *BOPAlgo_Builder::BuildSplitFaces()* |
6b6d06fa 1095| 1.4 | Build split faces for *Fi (Fi1, Fi2…FiNbSp)*, where *NbSp* is the number of split parts (see @ref specification__boolean_7_2 "Building faces from a set of edges" for more details). | *BOPAlgo_BuilderFace* |
1a457208 1096| 1.5 | Impart to <i>(Fi1, Fi2…FiNbSp)</i> the orientation coherent with the original face *Fi*. | *BOPAlgo_Builder::BuildSplitFaces()* |
1097| 1.6 | Fill the map mySplits with *Fi/(Fi1, Fi2…FiNbSp)* | *BOPAlgo_Builder::BuildSplitFaces()* |
1098| 2 | Fill Same Domain faces | *BOPAlgo_Builder::FillSameDomainFaces* |
1099| 2.1 | Find and collect in the contents of *mySplits* the pairs of same domain split faces <i>(Fij, Fkl)m</i>, where *m* is the number of pairs. | *BOPAlgo_Builder::FillSameDomainFaces* *BOPTools_Tools::AreFacesSameDomain()* |
1100| 2.2 | Compute the connexity chains 1) of same domain faces <i>(F1C, F2C… FnC)k, C=0, 1…nCs,</i> where *nCs* is the number of connexity chains. | *BOPAlgo_Builder::FillSameDomainFaces()* |
1101| 2.3 | Fill *myShapesSD* using the chains <i>(F1C, F2C… FnC)k</i> | *BOPAlgo_Builder::FillSameDomainFaces()* |
1102| 2.4 | Add internal vertices to split faces. | *BOPAlgo_Builder::FillSameDomainFaces()* |
1103| 2.5 | Fill *myImages* using *myShapesSD* and *mySplits*. | *BOPAlgo_Builder::FillSameDomainFaces()* |
1104
1105
1106The example of chains of same domain faces is given in the image:
1107
6b6d06fa 1108@figure{/specification/boolean_operations/images/operations_image033.svg,"Chains of same domain faces",420}
1a457208 1109
1110* The pairs of same domain faces are: <i>(F11, F21), (F22, F31), (F41, F51) , (F41, F6)</i> and <i>(F51, F6)</i>.
1111* The pairs produce the three chains: <i>(F11, F21), (F22, F31)</i> and <i>(F41, F51, F6)</i>.
1112
6b6d06fa 1113@subsubsection specification__boolean_7_4_10 Build Result of Type Face
1114This step is the same as @ref specification__boolean_7_4_4 "Building Result of Type Vertex" but for the type *Face*.
1a457208 1115
6b6d06fa 1116@subsubsection specification__boolean_7_4_11 Build Images for Shells
1a457208 1117The input data for this step is:
1118* *BOPAlgo_Builder* object after building result of type face;
3f812249 1119* *Original Shape* -- a Shell;
1120* *Type* -- the type of the shape <i>(TopAbs_SHELL)</i>.
1a457208 1121
1122The procedure is the same as for building images for wires.
1123
6b6d06fa 1124@subsubsection specification__boolean_7_4_12 Build Result of Type Shell
1125This step is the same as @ref specification__boolean_7_4_4 "Building Result of Type Vertex" but for the type *Shell*.
1a457208 1126
6b6d06fa 1127@subsubsection specification__boolean_7_4_13 Build Images for Solids
1a457208 1128
1129The input data for this step is *BOPAlgo_Builder* object after building result of type *Shell*.
1130
1131The following procedure is executed for all interfered DS shapes *Si* of type *SOLID*.
1132
1133| No | Contents | Implementation |
1134| :--- | :--- | :--- |
1135| 1 | Collect all images or non-split parts for all faces <i>(FSPij)</i> that have 3D state *In Si*. | *BOPAlgo_Builder::FillIn3DParts ()* |
1136| 2 | Collect all images or non-split parts for all faces of *Si* | *BOPAlgo_Builder::BuildSplitSolids()* |
6b6d06fa 1137| 3 | Build split solids for *Si -> (Si1, Si2…SiNbSp)*, where *NbSp* is the number of split parts (see @ref specification__boolean_7_2 "Building faces from a set of edges" for more details) | *BOPAlgo_BuilderSolid* |
1a457208 1138| 4 | Fill the map Same Domain solids *myShapesSD* | *BOPAlgo_Builder::BuildSplitSolids()* |
1139| 5 | Fill the map *myImages* | *BOPAlgo_Builder::BuildSplitSolids()* |
1140| 6 | Add internal vertices to split solids | *BOPAlgo_Builder::FillInternalShapes()* |
1141
6b6d06fa 1142@subsubsection specification__boolean_7_4_14 Build Result of Type Solid
1143This step is the same as @ref specification__boolean_7_4_4 "Building Result of Type Vertex", but for the type Solid.
1a457208 1144
6b6d06fa 1145@subsubsection specification__boolean_7_4_15 Build Images for Type CompSolid
1a457208 1146
1147The input data for this step is:
1148* *BOPAlgo_Builder* object after building result of type solid;
3f812249 1149* *Original Shape* -- a Compsolid;
1150* *Type* -- the type of the shape <i>(TopAbs_COMPSOLID)</i>.
1a457208 1151
1152The procedure is the same as for building images for wires.
1153
6b6d06fa 1154@subsubsection specification__boolean_7_4_16 Build Result of Type Compsolid
1155This step is the same as @ref specification__boolean_7_4_4 "Building Result of Type Vertex", but for the type Compsolid.
1a457208 1156
6b6d06fa 1157@subsubsection specification__boolean_7_4_17 Build Images for Compounds
1a457208 1158The input data for this step is as follows:
3f812249 1159* *BOPAlgo_Builder* object after building results of type *compsolid*;
1160* *Original Shape* -- a Compound;
1161* *Type* -- the type of the shape <i>(TopAbs_COMPOUND)</i>.
1a457208 1162
1163The procedure is the same as for building images for wires.
1164
6b6d06fa 1165@subsubsection specification__boolean_7_4_18 Build Result of Type Compound
1a457208 1166
6b6d06fa 1167This step is the same as @ref specification__boolean_7_4_4 "Building Result of Type Vertex", but for the type Compound.
1a457208 1168
6b6d06fa 1169@subsubsection specification__boolean_7_4_19 Post-Processing
1a457208 1170The purpose of the step is to correct tolerances of the result to provide its validity in terms of *BRepCheck_Analyzer.*
1171
1172The input data for this step is a *BOPAlgo_Builder* object after building result of type compound.
1173
1174| No | Contents | Implementation |
1175| :---- | :---- | :----- |
1176| 1 | Correct tolerances of vertices on curves | *BOPTools_Tools::CorrectPointOnCurve()* |
1177| 2 | Correct tolerances of edges on faces | *BOPTools_Tools::CorrectCurveOnSurface()* |
1178
1179
6b6d06fa 1180@section specification__boolean_8 Splitter Algorithm
c58055ad 1181
aeee70d3 1182The Splitter algorithm allows splitting a group of arbitrary shapes by another group of arbitrary shapes.<br>
6b6d06fa 1183It is based on the General Fuse algorithm, thus all options of the General Fuse (see @ref specification__boolean_7_3a "GF Options") are also available in this algorithm.
c58055ad 1184
6b6d06fa 1185@subsection specification__boolean_8_1 Arguments
c58055ad 1186
aeee70d3 1187* The arguments of the Splitter algorithm are divided into two groups - *Objects* (shapes that will be split) and *Tools* (shapes, by which the *Objects* will be split);
1188* The requirements for the arguments (both for *Objects* and *Tools*) are the same as for the General Fuse algorithm - there can be any number of arguments of any type in each group, but each argument should be valid and not self-interfered.
c58055ad 1189
6b6d06fa 1190@subsection specification__boolean_8_2 Results
c58055ad 1191
aeee70d3 1192* The result of Splitter algorithm contains only the split parts of the shapes included into the group of *Objects*;
1193* The split parts of the shapes included only into the group of *Tools* are excluded from the result;
1194* If there are no shapes in the group of *Tools* the result of the operation will be equivalent to the result of General Fuse operation;
1195* The shapes can be split by other shapes from the same group (if these shapes are interfering).
c58055ad 1196
6b6d06fa 1197@subsection specification__boolean_8_3 Usage
c58055ad 1198
6b6d06fa 1199@subsubsection specification__boolean_8_3_1 API
c58055ad 1200
aeee70d3 1201On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitter*. The usage of this algorithm looks as follows:
c58055ad 1202~~~~~
1203BOPAlgo_Splitter aSplitter;
944768d2 1204// Setting arguments and tools
1155d05a 1205TopTools_ListOfShape aLSObjects = …; // Objects
1206TopTools_ListOfShape aLSTools = …; // Tools
c58055ad 1207aSplitter.SetArguments(aLSObjects);
1208aSplitter.SetTools(aLSTools);
944768d2 1209
1210// Set options for the algorithm
1211// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
1212...
1213
1214// Perform the operation
1215aSplitter.Perform();
a743814b 1216if (aSplitter.HasErrors()) { //check error status
c58055ad 1217 return;
1218}
1219//
1220const TopoDS_Shape& aResult = aSplitter.Shape(); // result of the operation
1221~~~~~
1222
6b6d06fa 1223@subsubsection specification__boolean_8_3_2 DRAW
c58055ad 1224
aeee70d3 1225The command *bsplit* implements the Splitter algorithm in DRAW. Similarly to the *bbuild* command for the General Fuse algorithm, the *bsplit* command should be used after the Pave Filler is filled.
c58055ad 1226~~~~~
1227# s1 s2 s3 - objects
1228# t1 t2 t3 - tools
1229bclearobjects
1230bcleartools
1231baddobjects s1 s2 s3
1232baddtools t1 t2 t3
1233bfillds
1234bsplit result
1235~~~~~
1236
6b6d06fa 1237@subsection specification__boolean_8_4 Examples
c58055ad 1238
6b6d06fa 1239@subsubsection specification__boolean_8_4_1 Example 1
c58055ad 1240
aeee70d3 1241Splitting a face by the set of edges:
c58055ad 1242
1243~~~~
1244# draw script for reproducing
1245bclearobjects
1246bcleartools
1247
1248set height 20
1249cylinder cyl 0 0 0 0 0 1 10
1250mkface f cyl 0 2*pi -$height $height
1251baddobjects f
1252
1253# create tool edges
1254compound edges
1255
1256set nb_uedges 10
1257set pi2 [dval 2*pi]
1258set ustep [expr $pi2/$nb_uedges]
1259for {set i 0} {$i <= $pi2} {set i [expr $i + $ustep]} {
1260 uiso c cyl $i
1261 mkedge e c -25 25
1262 add e edges
1263}
1264
1265set nb_vedges 10
1266set vstep [expr 2*$height/$nb_vedges]
1267for {set i -20} {$i <= 20} {set i [expr $i + $vstep]} {
1268 viso c cyl $i
1269 mkedge e c
1270 add e edges
1271}
1272baddctools edges
1273
1274bfillds
1275bsplit result
1276~~~~
1277
1278<table align="center">
1279<tr>
6b6d06fa 1280 <td>@figure{/specification/boolean_operations/images/bsplit_image001.png,"Arguments",160}</td>
1281 <td>@figure{/specification/boolean_operations/images/bsplit_image002.png,"Result",160}</td>
c58055ad 1282</tr>
1283</table>
1284
6b6d06fa 1285@subsubsection specification__boolean_8_4_2 Example 2
c58055ad 1286
aeee70d3 1287Splitting a plate by the set of cylinders:
c58055ad 1288
1289~~~~
1290# draw script for reproducing:
1291bclearobjects
1292bcleartools
1293
1294box plate 100 100 1
1295baddobjects plate
1296
1297pcylinder p 1 11
1298compound cylinders
1299for {set i 0} {$i < 101} {incr i 5} {
1300 for {set j 0} {$j < 101} {incr j 5} {
1301 copy p p1;
1302 ttranslate p1 $i $j -5;
1303 add p1 cylinders
1304 }
1305}
1306baddtools cylinders
1307
1308bfillds
1309bsplit result
1310~~~~
1311
1312<table align="center">
1313<tr>
6b6d06fa 1314 <td>@figure{/specification/boolean_operations/images/bsplit_image003.png,"Arguments",160}</td>
1315 <td>@figure{/specification/boolean_operations/images/bsplit_image004.png,"Result",160}</td>
c58055ad 1316</tr>
1317</table>
1318
6b6d06fa 1319@subsubsection specification__boolean_8_4_3 Example 3
c58055ad 1320
1321Splitting shell hull by the planes:
1322<table align="center">
1323<tr>
6b6d06fa 1324 <td>@figure{/specification/boolean_operations/images/bsplit_image005.png,"Arguments",160}</td>
1325 <td>@figure{/specification/boolean_operations/images/bsplit_image006.png,"Results",160}</td>
c58055ad 1326</tr>
1327</table>
1328
6b6d06fa 1329@section specification__boolean_9 Boolean Operations Algorithm
1a457208 1330
6b6d06fa 1331@subsection specification__boolean_9_1 Arguments
1a457208 1332
6b6d06fa 1333* The arguments of BOA are shapes in terms of *TopoDS_Shape*. The main requirements for the arguments are described in the @ref specification__boolean_4 "Data Structure"
e9e33e91 1334* There are two groups of arguments in BOA:
1335 * Objects <i>(S1=S11, S12, ...)</i>;
1336 * Tools <i>(S2=S21, S22, ...)</i>.
9526aa6a 1337* The following table contains the values of dimension for different types of arguments:
1a457208 1338
1339| No | Type of Argument | Index of Type | Dimension |
1340| :---- | :---- | :----- | :---- |
1341| 1 | COMPOUND | 0 | One of 0, 1, 2, 3 |
1342| 2 | COMPSOLID | 1 | 3 |
1343| 3 | SOLID | 2 | 3 |
1344| 4 | SHELL | 3 | 2 |
1345| 5 | FACE | 4 | 2 |
1346| 6 | WIRE | 5 | 1 |
1347| 7 | EDGE | 6 | 1 |
1348| 8 | VERTEX | 7 | 0 |
1349
9526aa6a 1350* For Boolean operation Fuse all arguments should have equal dimensions.
1351* For Boolean operation Cut the minimal dimension of *S2* should not be less than the maximal dimension of *S1*.
251a7984 1352* For Boolean operation Common the arguments can have any dimension.
1a457208 1353
6b6d06fa 1354@subsection specification__boolean_9_3 Results. General Rules
1a457208 1355
e9e33e91 1356* The result of the Boolean operation is a compound (if defined). Each sub-shape of the compound has shared sub-shapes in accordance with interferences between the arguments.
1a457208 1357* The content of the result depends on the type of the operation (Common, Fuse, Cut12, Cut21) and the dimensions of the arguments.
1358* The result of the operation Fuse is defined for arguments *S1* and *S2* that have the same dimension value : *Dim(S1)=Dim(S2)*. If the arguments have different dimension values the result of the operation Fuse is not defined. The dimension of the result is equal to the dimension of the arguments. For example, it is impossible to fuse an edge and a face.
1359* The result of the operation Fuse for arguments *S1* and *S2* contains the parts of arguments that have states **OUT** relative to the opposite arguments.
9526aa6a 1360* The result of the operation Fuse for arguments *S1* and *S2* having dimension value 3 (Solids) is refined by removing all possible internal faces to provide minimal number of solids.
251a7984 1361* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The result can contain shapes of different dimensions, but the minimal dimension of the result will be equal to the minimal dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex.
1a457208 1362* The result of the operation Common for the arguments *S1* and *S2* contains the parts of the argument that have states **IN** and **ON** relative to the opposite argument.
251a7984 1363* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The result can contain shapes of different dimensions, but the minimal dimension of the result will be equal to the minimal dimension of the objects *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined.
1a457208 1364* The result of the operation *Cut12* for arguments *S1* and *S2* contains the parts of argument *S1* that have state **OUT** relative to the opposite argument *S2*.
1365* The result of the operation *Cut21* for arguments *S1* and *S2* contains the parts of argument *S2* that have state **OUT** relative to the opposite argument *S1*.
251a7984 1366* For the arguments of collection type (WIRE, SHELL, COMPSOLID) the type will be passed in the result. For example, the result of Common operation between Shell and Wire will be a compound containing Wire.
77a11d3d 1367* For the arguments of collection type (WIRE, SHELL, COMPSOLID) containing overlapping parts the overlapping parts passed into result will be repeated for each container from the input shapes containing such parts. The containers completely included in other containers will be avoided in the result.
1368* For the arguments of collection type (WIRE, SHELL, COMPSOLID) the containers included into result will have the same orientation as the original containers from arguments. In case of duplication its orientation will be defined by the orientation of the first container in arguments. Each container included into result will have coherent orientation of its sub-shapes.
1369* The result of the operation Fuse for the arguments of collection type (WIRE, SHELL) will consist of the shapes of the same collection type. The overlapping parts (EDGES/FACES) will be shared among containers, but duplicating containers will be avoided in the result. For example, the result of Fuse operation between two fully coinciding wires will be one wire, but the result of Fuse operation between two partially coinciding wires will be two wires sharing coinciding edges.
1370* The result of the operation Fuse for the arguments of type COMPSOLID will consist of the compound containing COMPSOLIDs created from connexity blocks of fused solids.
1371* The result of the operation Common for the arguments of collection type (WIRE, SHELL, COMPSOLID) will consist of the unique containers containing the overlapping parts. For example, the result of Common operation between two fully overlapping wires will be one wire containing all splits of edges. The number of wires in the result of Common operation between two partially overlapping wires will be equal to the number of connexity blocks of overlapping edges.
1a457208 1372
6b6d06fa 1373@subsection specification__boolean_9_4 Examples
1a457208 1374
6b6d06fa 1375@subsubsection specification__boolean_9_4_1 Case 1: Two Vertices
1a457208 1376
1377Let us consider two interfering vertices *V1* and *V2*:
1378
6b6d06fa 1379@figure{/specification/boolean_operations/images/boolean_image001.svg,"",160}
1a457208 1380
1381* The result of *Fuse* operation is the compound that contains new vertex *V*.
1382
6b6d06fa 1383@figure{/specification/boolean_operations/images/boolean_image002.svg,"",160}
1a457208 1384
1385* The result of *Common* operation is a compound containing new vertex *V*.
1a457208 1386
1387* The result of *Cut12* operation is an empty compound.
1388* The result of *Cut21* operation is an empty compound.
1389
6b6d06fa 1390@subsubsection specification__boolean_9_4_2 Case 2: A Vertex and an Edge
1a457208 1391
1392Let us consider vertex *V1* and the edge *E2*, that intersect in a 3D point:
1393
6b6d06fa 1394@figure{/specification/boolean_operations/images/boolean_image004.png,"",230}
1a457208 1395
1396* The result of *Fuse* operation is result is not defined because the dimension of the vertex (0) is not equal to the dimension of the edge (1).
1397
e9e33e91 1398* The result of *Common* operation is a compound containing vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with edge *E2*.
1a457208 1399
6b6d06fa 1400@figure{/specification/boolean_operations/images/boolean_image005.png,"",230}
1a457208 1401
1402* The result of *Cut12* operation is an empty compound.
1403* The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the edge (1).
1404
6b6d06fa 1405@subsubsection specification__boolean_9_4_3 Case 3: A Vertex and a Face
1a457208 1406
1407Let us consider vertex *V1* and face *F2*, that intersect in a 3D point:
1408
6b6d06fa 1409@figure{/specification/boolean_operations/images/boolean_image006.png,"",230}
1a457208 1410
1411* The result of *Fuse* operation is not defined because the dimension of the vertex (0) is not equal to the dimension of the face (2).
1412
e9e33e91 1413* The result of *Common* operation is a compound containing vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with face *F2*.
1a457208 1414
6b6d06fa 1415@figure{/specification/boolean_operations/images/boolean_image007.png,"",230}
1a457208 1416
1417* The result of *Cut12* operation is an empty compound.
1418* The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the face (2).
1419
6b6d06fa 1420@subsubsection specification__boolean_9_4_4 Case 4: A Vertex and a Solid
1a457208 1421
1422Let us consider vertex *V1* and solid *S2*, that intersect in a 3D point:
1423
6b6d06fa 1424@figure{/specification/boolean_operations/images/boolean_image008.png,"",230}
1a457208 1425
1426* The result of *Fuse* operation is not defined because the dimension of the vertex (0) is not equal to the dimension of the solid (3).
1427
e9e33e91 1428* The result of *Common* operation is a compound containing vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with solid *S2*.
1a457208 1429
6b6d06fa 1430@figure{/specification/boolean_operations/images/boolean_image009.png,"",230}
1a457208 1431
1432* The result of *Cut12* operation is an empty compound.
1433* The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the solid (3).
1434
6b6d06fa 1435@subsubsection specification__boolean_9_4_5 Case 5: Two edges intersecting at one point
1a457208 1436
e9e33e91 1437Let us consider edges *E1* and *E2* that intersect in a 3D point:
1a457208 1438
6b6d06fa 1439@figure{/specification/boolean_operations/images/boolean_image010.svg,"",230}
1a457208 1440
1441* The result of *Fuse* operation is a compound containing split parts of arguments i.e. 4 new edges *E11, E12, E21*, and *E22*. These edges have one shared vertex *Vn1*.
1442In this case:
1443 * argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*);
1444 * argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
1445
6b6d06fa 1446@figure{/specification/boolean_operations/images/boolean_image011.svg,"",230}
1a457208 1447
1448* The result of *Common* operation is an empty compound because the dimension (0) of the common part between the edges (vertex) is less than the dimension of the arguments (1).
1449
1450* The result of *Cut12* operation is a compound containing split parts of the argument *E1*, i.e. 2 new edges *E11* and *E12*. These edges have one shared vertex *Vn1*.
1451
e9e33e91 1452In this case the argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*).
1a457208 1453
6b6d06fa 1454@figure{/specification/boolean_operations/images/boolean_image012.svg,"",230}
1a457208 1455
1456* The result of *Cut21* operation is a compound containing split parts of the argument *E2*, i.e. 2 new edges *E21* and *E12*. These edges have one shared vertex *Vn1*.
1457
1458In this case the argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
1459
6b6d06fa 1460@figure{/specification/boolean_operations/images/boolean_image013.svg,"",70}
1a457208 1461
6b6d06fa 1462@subsubsection specification__boolean_9_4_6 Case 6: Two edges having a common block
1a457208 1463
e9e33e91 1464Let us consider edges *E1* and *E2* that have a common block:
1a457208 1465
6b6d06fa 1466@figure{/specification/boolean_operations/images/boolean_image014.svg,"",230}
1a457208 1467
e9e33e91 1468* The result of *Fuse* operation is a compound containing split parts of arguments i.e. 3 new edges *E11*, *E12* and *E22*. These edges have two shared vertices.
1a457208 1469In this case:
1470 * argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*);
1471 * argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*);
1472 * edge *E12* is common for the images of *E1* and *E2*.
1473
6b6d06fa 1474@figure{/specification/boolean_operations/images/boolean_image015.svg,"",230}
1a457208 1475
e9e33e91 1476* The result of *Common* operation is a compound containing split parts of arguments i.e. 1 new edge *E12*. In this case edge *E12* is common for the images of *E1* and *E2*.
1a457208 1477The common part between the edges (edge) has the same dimension (1) as the dimension of the arguments (1).
1478
6b6d06fa 1479@figure{/specification/boolean_operations/images/boolean_image016.svg,"",230}
1a457208 1480
1481* The result of *Cut12* operation is a compound containing a split part of argument *E1*, i.e. new edge *E11*.
1482
6b6d06fa 1483@figure{/specification/boolean_operations/images/boolean_image017.svg,"",230}
1a457208 1484
1485* The result of *Cut21* operation is a compound containing a split part of argument *E2*, i.e. new edge *E22*.
1486
6b6d06fa 1487@figure{/specification/boolean_operations/images/boolean_image018.svg,"",230}
1a457208 1488
1489
6b6d06fa 1490@subsubsection specification__boolean_9_4_7 Case 7: An Edge and a Face intersecting at a point
1a457208 1491
e9e33e91 1492Let us consider edge *E1* and face *F2* that intersect at a 3D point:
1a457208 1493
6b6d06fa 1494@figure{/specification/boolean_operations/images/boolean_image019.png,"",230}
1a457208 1495
1496* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the face (2).
1497
1498* The result of *Common* operation is an empty compound because the dimension (0) of the common part between the edge and face (vertex) is less than the dimension of the arguments (1).
1499
1500* The result of *Cut12* operation is a compound containing split parts of the argument *E1*, i.e. 2 new edges *E11* and *E12*.
1501
1502In this case the argument edge *E1* has no common parts with the face *F2* so the whole image of *E1* is in the result.
1503
6b6d06fa 1504@figure{/specification/boolean_operations/images/boolean_image020.png,"",230}
1a457208 1505
1506* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the face (2).
1507
6b6d06fa 1508@subsubsection specification__boolean_9_4_8 Case 8: A Face and an Edge that have a common block
1a457208 1509
e9e33e91 1510Let us consider edge *E1* and face *F2* that have a common block:
1a457208 1511
6b6d06fa 1512@figure{/specification/boolean_operations/images/boolean_image021.png,"",230}
1a457208 1513
1514* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the face (2).
1515
1516* The result of *Common* operation is a compound containing a split part of the argument *E1*, i.e. new edge *E12*.
1517
1518In this case the argument edge *E1* has a common part with face *F2* so the corresponding part of the image of *E1* is in the result. The yellow square is not a part of the result. It only shows the place of *F2*.
1519
6b6d06fa 1520@figure{/specification/boolean_operations/images/boolean_image022.png,"",230}
1a457208 1521
1522* The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.
1523
1524In this case the argument edge *E1* has a common part with face *F2* so the corresponding part is not included into the result. The yellow square is not a part of the result. It only shows the place of F2.
1525
6b6d06fa 1526@figure{/specification/boolean_operations/images/boolean_image023.png,"",230}
1a457208 1527
1528* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the face (2).
1529
6b6d06fa 1530@subsubsection specification__boolean_9_4_9 Case 9: An Edge and a Solid intersecting at a point
1a457208 1531
e9e33e91 1532Let us consider edge *E1* and solid *S2* that intersect at a point:
1a457208 1533
6b6d06fa 1534@figure{/specification/boolean_operations/images/boolean_image024.png,"",230}
1a457208 1535
1536* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the solid (3).
1537
1538* The result of *Common* operation is a compound containing a split part of the argument *E1*, i.e. new edge *E12*.
1539
1540In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part of the image of *E1* is in the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1541
6b6d06fa 1542@figure{/specification/boolean_operations/images/boolean_image025.png,"",230}
1a457208 1543
1544* The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.
1545
1546In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1547
6b6d06fa 1548@figure{/specification/boolean_operations/images/boolean_image071.png,"",230}
1a457208 1549
1550* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the solid (3).
1551
6b6d06fa 1552@subsubsection specification__boolean_9_4_10 Case 10: An Edge and a Solid that have a common block
1a457208 1553
e9e33e91 1554Let us consider edge *E1* and solid *S2* that have a common block:
1a457208 1555
6b6d06fa 1556@figure{/specification/boolean_operations/images/boolean_image072.png,"",230}
1a457208 1557
1558* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the solid (3).
1559
1560* The result of *Common* operation is a compound containing a split part of the argument *E1*, i.e. new edge *E12*.
1561
1562In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part of the image of *E1* is in the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1563
6b6d06fa 1564@figure{/specification/boolean_operations/images/boolean_image073.png,"",230}
1a457208 1565
1566* The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.
1567
e9e33e91 1568In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1a457208 1569
6b6d06fa 1570@figure{/specification/boolean_operations/images/boolean_image026.png,"",230}
1a457208 1571
1572* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the solid (3).
1573
6b6d06fa 1574@subsubsection specification__boolean_9_4_11 Case 11: Two intersecting faces
1a457208 1575
1576Let us consider two intersecting faces *F1* and *F2*:
1577
6b6d06fa 1578@figure{/specification/boolean_operations/images/boolean_image027.png,"",230}
1a457208 1579
e9e33e91 1580* The result of *Fuse* operation is a compound containing split parts of arguments i.e. 2 new faces *F11* and *F21*. These faces have one shared edge *En1*.
1a457208 1581
6b6d06fa 1582@figure{/specification/boolean_operations/images/boolean_image028.png,"",230}
1a457208 1583
1584
1585* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *F2* (edge) is less than the dimension of arguments (2).
1586
1587* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.
1588
6b6d06fa 1589@figure{/specification/boolean_operations/images/boolean_image029.png,"",230}
1a457208 1590
1591* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*.
1592
6b6d06fa 1593@figure{/specification/boolean_operations/images/boolean_image030.png,"",127}
1a457208 1594
6b6d06fa 1595@subsubsection specification__boolean_9_4_12 Case 12: Two faces that have a common part
1a457208 1596
e9e33e91 1597Let us consider two faces *F1* and *F2* that have a common part:
1a457208 1598
6b6d06fa 1599@figure{/specification/boolean_operations/images/boolean_image031.png,"",230}
1a457208 1600
1601* The result of *Fuse* operation is a compound containing split parts of arguments, i.e. 3 new faces: *F11*, *F12* and *F22*. These faces are shared through edges In this case:
1602 * the argument edge *F1* has resulting split faces *F11* and *F12* (image of *F1*)
1603 * the argument face *F2* has resulting split faces *F12* and *F22* (image of *F2*)
1604 * the face *F12* is common for the images of *F1* and *F2*.
1605
6b6d06fa 1606@figure{/specification/boolean_operations/images/boolean_image032.png,"",230}
1a457208 1607
1608* The result of *Common* operation is a compound containing split parts of arguments i.e. 1 new face *F12*.
1609In this case: face *F12* is common for the images of *F1* and *F2*.
1610The common part between the faces (face) has the same dimension (2) as the dimension of the arguments (2).
1611
1612
6b6d06fa 1613@figure{/specification/boolean_operations/images/boolean_image033.png,"",230}
1a457208 1614
1615* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.
1616
6b6d06fa 1617@figure{/specification/boolean_operations/images/boolean_image034.png,"",230}
1a457208 1618
1619* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*.
1620
6b6d06fa 1621@figure{/specification/boolean_operations/images/boolean_image035.png,"",230}
1a457208 1622
6b6d06fa 1623@subsubsection specification__boolean_9_4_13 Case 13: Two faces that have a common edge
1a457208 1624
1625Let us consider two faces *F1* and *F2* that have a common edge:
1626
6b6d06fa 1627@figure{/specification/boolean_operations/images/boolean_image036.png,"",230}
1a457208 1628
1629* The result of *Fuse* operation is a compound containing split parts of arguments, i.e. 2 new faces: *F11* and *F21*. These faces have one shared edge *En1*.
1630
6b6d06fa 1631@figure{/specification/boolean_operations/images/boolean_image037.png,"",230}
1a457208 1632
1633* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *F2* (edge)is less than the dimension of the arguments (2)
1634
1635* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*. The vertices are shown just to clarify the fact that the edges are spitted.
1636
6b6d06fa 1637@figure{/specification/boolean_operations/images/boolean_image038.png,"",230}
1a457208 1638
1639* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*. The vertices are shown just to clarify the fact that the edges are spitted.
1640
6b6d06fa 1641@figure{/specification/boolean_operations/images/boolean_image039.png,"",230}
1a457208 1642
6b6d06fa 1643@subsubsection specification__boolean_9_4_14 Case 14: Two faces that have a common vertex
1a457208 1644
1645Let us consider two faces *F1* and *F2* that have a common vertex:
1646
6b6d06fa 1647@figure{/specification/boolean_operations/images/boolean_image040.png,"",230}
1a457208 1648
e9e33e91 1649* The result of *Fuse* operation is a compound containing split parts of arguments, i.e. 2 new faces: *F11* and *F21*. These faces have one shared vertex *Vn1*.
1a457208 1650
6b6d06fa 1651@figure{/specification/boolean_operations/images/boolean_image041.png,"",230}
1a457208 1652
1653* The result of *Common* operation is an empty compound because the dimension (0) of the common part between *F1* and *F2* (vertex) is less than the dimension of the arguments (2)
1654
1655* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.
1656
6b6d06fa 1657@figure{/specification/boolean_operations/images/boolean_image042.png,"",230}
1a457208 1658
1659* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*.
1660
6b6d06fa 1661@figure{/specification/boolean_operations/images/boolean_image043.png,"",230}
1a457208 1662
1663
6b6d06fa 1664@subsubsection specification__boolean_9_4_15 Case 15: A Face and a Solid that have an intersection curve.
1a457208 1665
1666Let us consider face *F1* and solid *S2* that have an intersection curve:
1667
6b6d06fa 1668@figure{/specification/boolean_operations/images/boolean_image044.png,"",230}
1a457208 1669
1670* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1671
e9e33e91 1672* The result of *Common* operation is a compound containing split part of the argument *F1*. In this case the argument face *F1* has a common part with solid *S2*, so the corresponding part of the image of *F1* is in the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1a457208 1673
6b6d06fa 1674@figure{/specification/boolean_operations/images/boolean_image045.png,"",230}
1a457208 1675
1676* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1677
6b6d06fa 1678@figure{/specification/boolean_operations/images/boolean_image046.png,"",230}
1a457208 1679
7b5e532f 1680* The result of *Cut21* operation is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1a457208 1681
6b6d06fa 1682@subsubsection specification__boolean_9_4_16 Case 16: A Face and a Solid that have overlapping faces.
1a457208 1683
e9e33e91 1684Let us consider face *F1* and solid *S2* that have overlapping faces:
1a457208 1685
6b6d06fa 1686@figure{/specification/boolean_operations/images/boolean_image047.png,"",230}
1a457208 1687
1688* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1689
e9e33e91 1690* The result of *Common* operation is a compound containing split part of the argument *F1*. In this case the argument face *F1* has a common part with solid *S2*, so the corresponding part of the image of *F1* is included in the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1a457208 1691
6b6d06fa 1692@figure{/specification/boolean_operations/images/boolean_image048.png,"",230}
1a457208 1693
1694* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1695
6b6d06fa 1696@figure{/specification/boolean_operations/images/boolean_image049.png,"",230}
1a457208 1697
7b5e532f 1698* The result of *Cut21* operation is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1a457208 1699
1700
6b6d06fa 1701@subsubsection specification__boolean_9_4_17 Case 17: A Face and a Solid that have overlapping edges.
1a457208 1702
e9e33e91 1703Let us consider face *F1* and solid *S2* that have overlapping edges:
1a457208 1704
6b6d06fa 1705@figure{/specification/boolean_operations/images/boolean_image050.png,"",230}
1a457208 1706
1707* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1708
1709* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *S2* (edge) is less than the lower dimension of the arguments (2).
1710
1711* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1712
6b6d06fa 1713@figure{/specification/boolean_operations/images/boolean_image051.png,"",230}
1a457208 1714
7b5e532f 1715* The result of *Cut21* operation is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1a457208 1716
6b6d06fa 1717@subsubsection specification__boolean_9_4_18 Case 18: A Face and a Solid that have overlapping vertices.
1a457208 1718
e9e33e91 1719Let us consider face *F1* and solid *S2* that have overlapping vertices:
1a457208 1720
6b6d06fa 1721@figure{/specification/boolean_operations/images/boolean_image052.png,"",230}
1a457208 1722
1723* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1724
1725* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *S2* (vertex) is less than the lower dimension of the arguments (2).
1726
1727* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1728
6b6d06fa 1729@figure{/specification/boolean_operations/images/boolean_image053.png,"",230}
1a457208 1730
7b5e532f 1731* The result of *Cut21* operation is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1a457208 1732
6b6d06fa 1733@subsubsection specification__boolean_9_4_19 Case 19: Two intersecting Solids.
1a457208 1734
1735Let us consider two intersecting solids *S1* and *S2*:
1736
6b6d06fa 1737@figure{/specification/boolean_operations/images/boolean_image054.png,"",230}
1a457208 1738
e9e33e91 1739* The result of *Fuse* operation is a compound composed from the split parts of arguments *S11, S12* and *S22* <i>(Cut12, Common, Cut21)</i>. All inner webs are removed, so the result is one new solid *R*.
1a457208 1740
6b6d06fa 1741@figure{/specification/boolean_operations/images/boolean_image055.png,"",230}
1a457208 1742
1743* The result of *Common* operation is a compound containing split parts of arguments i.e. one new solid *S12*. In this case solid *S12* is common for the images of *S1* and *S2*. The common part between the solids (solid) has the same dimension (3) as the dimension of the arguments (3). The yellow contour is not a part of the result. It only shows the place of *S1*.
1744
6b6d06fa 1745@figure{/specification/boolean_operations/images/boolean_image056.png,"",176}
1a457208 1746
1747* The result of *Cut12* operation is a compound containing split part of the argument *S1*, i.e. 1 new solid *S11*.
1748
6b6d06fa 1749@figure{/specification/boolean_operations/images/boolean_image057.png,"",230}
1a457208 1750
1751* The result of *Cut21* operation is a compound containing split part of the argument *S2*, i.e. 1 new solid *S21*.
1752
6b6d06fa 1753@figure{/specification/boolean_operations/images/boolean_image058.png,"",230}
1a457208 1754
6b6d06fa 1755@subsubsection specification__boolean_9_4_20 Case 20: Two Solids that have overlapping faces.
1a457208 1756
1757Let us consider two solids *S1* and *S2* that have a common part on face:
1758
6b6d06fa 1759@figure{/specification/boolean_operations/images/boolean_image059.png,"",230}
1a457208 1760
e9e33e91 1761* The result of *Fuse* operation is a compound composed from the split parts of arguments *S11, S12* and *S22* <i>(Cut12, Common, Cut21)</i>. All inner webs are removed, so the result is one new solid *R*.
1a457208 1762
6b6d06fa 1763@figure{/specification/boolean_operations/images/boolean_image060.png,"",230}
1a457208 1764
1765* The result of *Common* operation is an empty compound because the dimension (2) of the common part between *S1* and *S2* (face) is less than the lower dimension of the arguments (3).
1766
1767* The result of *Cut12* operation is a compound containing split part of the argument *S1*, i.e. 1 new solid *S11*.
1768
6b6d06fa 1769@figure{/specification/boolean_operations/images/boolean_image061.png,"",230}
1a457208 1770
1771* The result of *Cut21* operation is a compound containing split part of the argument *S2*, i.e. 1 new solid *S21*.
6b6d06fa 1772@figure{/specification/boolean_operations/images/boolean_image062.png,"",230}
1a457208 1773
1774
6b6d06fa 1775@subsubsection specification__boolean_9_4_21 Case 21: Two Solids that have overlapping edges.
1a457208 1776
e9e33e91 1777Let us consider two solids *S1* and *S2* that have overlapping edges:
1a457208 1778
6b6d06fa 1779@figure{/specification/boolean_operations/images/boolean_image063.png,"",230}
1a457208 1780
1781* The result of *Fuse* operation is a compound composed from the split parts of arguments i.e. 2 new solids *S11* and *S21*. These solids have one shared edge *En1*.
1782
6b6d06fa 1783@figure{/specification/boolean_operations/images/boolean_image064.png,"",230}
1a457208 1784
1785* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *S1* and *S2* (edge) is less than the lower dimension of the arguments (3).
1786
1787* The result of *Cut12* operation is a compound containing split part of the argument *S1*. In this case
1788argument *S1* has a common part with solid *S2* so the corresponding part is not included into the result.
1789
6b6d06fa 1790@figure{/specification/boolean_operations/images/boolean_image065.png,"",230}
1a457208 1791
1511c7e9 1792* The result of *Cut21* operation is a compound containing split part of the argument *S2*. In this case
1a457208 1793argument *S2* has a common part with solid *S1* so the corresponding part is not included into the result.
d6b4d3d0 1794
6b6d06fa 1795@figure{/specification/boolean_operations/images/boolean_image066.png,"",230}
1a457208 1796
6b6d06fa 1797@subsubsection specification__boolean_9_4_22 Case 22: Two Solids that have overlapping vertices.
1a457208 1798
e9e33e91 1799Let us consider two solids *S1* and *S2* that have overlapping vertices:
1a457208 1800
6b6d06fa 1801@figure{/specification/boolean_operations/images/boolean_image067.png,"",230}
1a457208 1802
e9e33e91 1803* The result of *Fuse* operation is a compound composed from the split parts of arguments i.e. 2 new solids *S11* and *S21*. These solids share *Vn1*.
1a457208 1804
6b6d06fa 1805@figure{/specification/boolean_operations/images/boolean_image068.png,"",230}
1a457208 1806
e9e33e91 1807* The result of *Common* operation is an empty compound because the dimension (0) of the common part between *S1* and *S2* (vertex) is less than the lower dimension of the arguments (3).
1a457208 1808
e9e33e91 1809* The result of *Cut12* operation is a compound containing split part of the argument *S1*.
1a457208 1810
6b6d06fa 1811@figure{/specification/boolean_operations/images/boolean_image069.png,"",230}
1a457208 1812
e9e33e91 1813* The result of *Cut21* operation is a compound containing split part of the argument *S2*.
1a457208 1814
6b6d06fa 1815@figure{/specification/boolean_operations/images/boolean_image070.png,"",230}
1a457208 1816
6b6d06fa 1817@subsubsection specification__boolean_9_4_23 Case 23: A Shell and a Wire cut by a Solid.
9526aa6a 1818
1819Let us consider Shell *Sh* and Wire *W* as the objects and Solid *S* as the tool:
1820
6b6d06fa 1821@figure{/specification/boolean_operations/images/boolean_image136.png,"",230}
9526aa6a 1822
1823* The result of *Fuse* operation is not defined as the dimension of the arguments is not the same.
1824
1825* The result of *Common* operation is a compound containing the parts of the initial Shell and Wire common for the Solid. The new Shell and Wire are created from the objects.
1826
6b6d06fa 1827@figure{/specification/boolean_operations/images/boolean_image137.png,"",230}
9526aa6a 1828
1511c7e9 1829* The result of *Cut12* operation is a compound containing new Shell and Wire split from the arguments *Sh* and *W*. In this case they have a common part with solid *S* so the corresponding part is not included into the result.
9526aa6a 1830
6b6d06fa 1831@figure{/specification/boolean_operations/images/boolean_image138.png,"",230}
9526aa6a 1832
251a7984 1833* The result of *Cut21* operation is not defined as the objects have a lower dimension than the tool.
9526aa6a 1834
6b6d06fa 1835@subsubsection specification__boolean_9_4_24 Case 24: Two Wires that have overlapping edges.
1511c7e9 1836
1837Let us consider two Wires that have overlapping edges, *W1* is the object and *W2* is the tool:
1838
6b6d06fa 1839@figure{/specification/boolean_operations/images/boolean_image139.png,"",230}
1511c7e9 1840
1841* The result of *Fuse* operation is a compound containing two Wires, which share an overlapping edge. The new Wires are created from the objects:
1842
6b6d06fa 1843@figure{/specification/boolean_operations/images/boolean_image140.png,"",230}
1511c7e9 1844
77a11d3d 1845* The result of *Common* operation is a compound containing one Wire consisting of an overlapping edge. The new Wire is created from the objects:
1511c7e9 1846
6b6d06fa 1847@figure{/specification/boolean_operations/images/boolean_image141.png,"",230}
1511c7e9 1848
1849* The result of *Cut12* operation is a compound containing a wire split from object *W1*. Its common part with *W2* is not included into the result.
1850
6b6d06fa 1851@figure{/specification/boolean_operations/images/boolean_image142.png,"",230}
1511c7e9 1852
1853* The result of *Cut21* operation is a compound containing a wire split from *W2*. Its common part with *W1* is not included into the result.
1854
6b6d06fa 1855@figure{/specification/boolean_operations/images/boolean_image143.png,"",230}
1511c7e9 1856
1a457208 1857
6b6d06fa 1858@subsection specification__boolean_9_5 Class BOPAlgo_BOP
1a457208 1859
1860BOA is implemented in the class *BOPAlgo_BOP*. The main fields of this class are described in the Table:
1861
1862| Name | Contents |
1863| :---- | :--- |
1864| *myOperation* | The type of the Boolean operation (Common, Fuse, Cut) |
e9e33e91 1865| *myTools* | The tools |
1a457208 1866| *myDims[2]* | The values of the dimensions of the arguments |
1867| *myRC* | The draft result (shape) |
1868
6b6d06fa 1869The main steps of the *BOPAlgo_BOP* are the same as of @ref specification__boolean_7_4 "BOPAlgo_Builder" except for some aspects described in the next paragraphs.
1a457208 1870
6b6d06fa 1871@subsection specification__boolean_9_6 Building Draft Result
1a457208 1872
1873The input data for this step is as follows:
1874* *BOPAlgo_BOP* object after building result of type *Compound*;
1875* *Type* of the Boolean operation.
1876
1877| No | Contents | Implementation |
1878| :---- | :----- | :----- |
1879| 1 | For the Boolean operation *Fuse* add to *myRC* all images of arguments. | *BOPAlgo_BOP::BuildRC()* |
e9e33e91 1880| 2 | For the Boolean operation *Common* or *Cut* add to *myRC* all images of argument *S1* that are *Common* for the Common operation and are *Not Common* for the Cut operation | *BOPAlgo_BOP::BuildRC()* |
1a457208 1881
6b6d06fa 1882@subsection specification__boolean_9_7 Building the Result
1a457208 1883
1884The input data for this step is as follows:
1885* *BOPAlgo_BOP* object the state after building draft result.
1886
1887| No | Contents | Implementation |
1888| :---- | :---- | :------ |
9526aa6a 1889| 1 | For the Type of the Boolean operation Common, Cut with any dimension and operation Fuse with *myDim[0] < 3* | |
1890| 1.1 | Find containers (WIRE, SHELL, COMPSOLID) in the arguments | *BOPAlgo_BOP:: BuildShape()* |
1891| 1.2 | Make connexity blocks from splits of each container that are in *myRC* | *BOPTools_Tools::MakeConnexityBlocks()* |
1a457208 1892| 1.3 | Build the result from shapes made from the connexity blocks | *BOPAlgo_BOP:: BuildShape()* |
9526aa6a 1893| 1.4 | Add the remaining shapes from *myRC* to the result | *BOPAlgo_BOP:: BuildShape()* |
1894| 2 | For the Type of the Boolean operation Fuse with *myDim[0] = 3* | |
1895| 2.1 | Find internal faces <i>(FWi)</i> in *myRC* | *BOPAlgo_BOP::BuildSolid()* |
1896| 2.2 | Collect all faces of *myRC* except for internal faces <i>(FWi) -> SFS</i> | *BOPAlgo_BOP::BuildSolid ()* |
1897| 2.3 | Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
1898| 2.4 | Add the solids <i>(SDi)</i> to the result | |
1a457208 1899
6b6d06fa 1900@subsection specification__boolean_bop_on_opensolids Boolean operations on open solids
13c0e402 1901
1902The Boolean operations on open solids are tricky enough that the standard approach of Boolean operations for building the result, based on the splits of solids does not work.
1903It happens because the algorithm for splitting solids (*BOPAlgo_BuilderSolid*) always tries to create the closed loops (shells) and make solids from them. But if the input solid is not closed, what can be expected from its splits?
1904For performing Boolean Operations on open solids another approach is used, which does not rely on the splits of the solids to be correct, but tries to select the splits of faces, which are necessary for the given type of operation.
1905The point here is that the type of Boolean operation clearly defines the states for the faces to be taken into result:
1906- For **COMMON** operation all the faces from the arguments located inside any solid of the opposite group must be taken;
1907- For **FUSE** operation all the faces from the arguments located outside of all solids of the opposite group must be taken;
1908- For **CUT** operation all the faces from the Objects located outside of all solids of the Tools and all faces from the Tools located inside any solid of the Objects must be taken;
1909- For **CUT21** operation all the faces from the Objects located inside any solid of the Tools and all faces from the Tools located outside of all solids of the Objects must be taken.
1910From the selected faces the result solids are built. Please note, that the result may contain as normal (closed) solids as the open ones.
1911
1912Even with this approach, the correct result of Boolean operation on open solids cannot be always guaranteed.
1913This is explained by non-manifold nature of open solids: in some cases classification of a face depends on the point of the face chosen for classification.
1914
6b6d06fa 1915@section specification__boolean_10a Section Algorithm
e9e33e91 1916
6b6d06fa 1917@subsection specification__boolean_10a_1 Arguments
e9e33e91 1918
1919The arguments of BOA are shapes in terms of *TopoDS_Shape*. The main requirements for the arguments are described in the Algorithms.
1920
6b6d06fa 1921@subsection specification__boolean_10a_2 Results and general rules
e9e33e91 1922* The result of Section operation is a compound. Each sub-shape of the compound has shared sub-shapes in accordance with interferences between the arguments.
1923* The result of Section operation contains shapes that have dimension that is less then 2 i.e. vertices and edges.
1924* The result of Section operation contains standalone vertices if these vertices do not belong to the edges of the result.
1925* The result of Section operation contains vertices and edges of the arguments (or images of the arguments) that belong to at least two arguments (or two images of the arguments).
1926* The result of Section operation contains Section vertices and edges obtained from Face/Face interferences.
1927* The result of Section operation contains vertices that are the result of interferences between vertices and faces.
1928* The result of Section operation contains edges that are the result of interferences between edges and faces (Common Blocks),
1929
6b6d06fa 1930@subsection specification__boolean_10a_3 Examples
e9e33e91 1931
6b6d06fa 1932@subsubsection specification__boolean_10a_3_1 Case 1: Two Vertices
e9e33e91 1933
1934Let us consider two interfering vertices: *V1* and *V2*.
1935
6b6d06fa 1936@figure{/specification/boolean_operations/images/boolean_image080.png,"",131}
e9e33e91 1937
1938The result of *Section* operation is the compound that contains a new vertex *V*.
1939
6b6d06fa 1940@figure{/specification/boolean_operations/images/boolean_image081.png,"",128}
e9e33e91 1941
6b6d06fa 1942@subsubsection specification__boolean_10a_3_2 Case 1: Case 2: A Vertex and an Edge
e9e33e91 1943
1944Let us consider vertex *V1* and the edge *E2*, that intersect in a 3D point:
1945
6b6d06fa 1946@figure{/specification/boolean_operations/images/boolean_image082.png,"",230}
e9e33e91 1947
1948The result of *Section* operation is the compound that contains vertex *V1*.
1949
6b6d06fa 1950@figure{/specification/boolean_operations/images/boolean_image083.png,"",230}
e9e33e91 1951
6b6d06fa 1952@subsubsection specification__boolean_10a_3_3 Case 1: Case 2: A Vertex and a Face
e9e33e91 1953
1954Let us consider vertex *V1* and face *F2*, that intersect in a 3D point:
1955
6b6d06fa 1956@figure{/specification/boolean_operations/images/boolean_image084.png,"",230}
e9e33e91 1957
1958The result of *Section* operation is the compound that contains vertex *V1*.
1959
6b6d06fa 1960@figure{/specification/boolean_operations/images/boolean_image085.png,"",230}
e9e33e91 1961
6b6d06fa 1962@subsubsection specification__boolean_10a_3_4 Case 4: A Vertex and a Solid
e9e33e91 1963
1964Let us consider vertex *V1* and solid *Z2*. The vertex *V1* is inside the solid *Z2*.
1965
6b6d06fa 1966@figure{/specification/boolean_operations/images/boolean_image086.png,"",230}
e9e33e91 1967
1968The result of *Section* operation is an empty compound.
1969
6b6d06fa 1970@subsubsection specification__boolean_10a_3_5 Case 5: Two edges intersecting at one point
e9e33e91 1971
1972Let us consider edges *E1* and *E2*, that intersect in a 3D point:
1973
6b6d06fa 1974@figure{/specification/boolean_operations/images/boolean_image087.png,"",230}
e9e33e91 1975
1976The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1977
6b6d06fa 1978@figure{/specification/boolean_operations/images/boolean_image088.png,"",230}
e9e33e91 1979
6b6d06fa 1980@subsubsection specification__boolean_10a_3_6 Case 6: Two edges having a common block
e9e33e91 1981
1982Let us consider edges *E1* and *E2*, that have a common block:
1983
6b6d06fa 1984@figure{/specification/boolean_operations/images/boolean_image089.png,"",230}
e9e33e91 1985
1986The result of *Section* operation is the compound that contains a new edge *Enew*.
1987
6b6d06fa 1988@figure{/specification/boolean_operations/images/boolean_image090.png,"",230}
e9e33e91 1989
6b6d06fa 1990@subsubsection specification__boolean_10a_3_7 Case 7: An Edge and a Face intersecting at a point
e9e33e91 1991
1992Let us consider edge *E1* and face *F2*, that intersect at a 3D point:
1993
6b6d06fa 1994@figure{/specification/boolean_operations/images/boolean_image091.png,"",230}
e9e33e91 1995
1996The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1997
6b6d06fa 1998@figure{/specification/boolean_operations/images/boolean_image092.png,"",230}
e9e33e91 1999
6b6d06fa 2000@subsubsection specification__boolean_10a_3_8 Case 8: A Face and an Edge that have a common block
e9e33e91 2001
2002Let us consider edge *E1* and face *F2*, that have a common block:
2003
6b6d06fa 2004@figure{/specification/boolean_operations/images/boolean_image093.png,"",230}
e9e33e91 2005
2006The result of *Section* operation is the compound that contains new edge *Enew*.
2007
6b6d06fa 2008@figure{/specification/boolean_operations/images/boolean_image094.png,"",230}
e9e33e91 2009
2010
6b6d06fa 2011@subsubsection specification__boolean_10a_3_9 Case 9: An Edge and a Solid intersecting at a point
e9e33e91 2012
2013Let us consider edge *E1* and solid *Z2*, that intersect at a point:
2014
6b6d06fa 2015@figure{/specification/boolean_operations/images/boolean_image095.png,"",230}
e9e33e91 2016
2017The result of *Section* operation is the compound that contains a new vertex *Vnew*.
2018
6b6d06fa 2019@figure{/specification/boolean_operations/images/boolean_image096.png,"",230}
e9e33e91 2020
6b6d06fa 2021@subsubsection specification__boolean_10a_3_10 Case 10: An Edge and a Solid that have a common block
e9e33e91 2022
2023Let us consider edge *E1* and solid *Z2*, that have a common block at a face:
2024
6b6d06fa 2025@figure{/specification/boolean_operations/images/boolean_image097.png,"",230}
e9e33e91 2026
2027The result of *Section* operation is the compound that contains a new edge *Enew*.
2028
6b6d06fa 2029@figure{/specification/boolean_operations/images/boolean_image098.png,"",230}
e9e33e91 2030
6b6d06fa 2031@subsubsection specification__boolean_10a_3_11 Case 11: Two intersecting faces
e9e33e91 2032
2033Let us consider two intersecting faces *F1* and *F2*:
2034
6b6d06fa 2035@figure{/specification/boolean_operations/images/boolean_image099.png,"",230}
e9e33e91 2036
2037The result of *Section* operation is the compound that contains a new edge *Enew*.
2038
6b6d06fa 2039@figure{/specification/boolean_operations/images/boolean_image100.png,"",230}
e9e33e91 2040
6b6d06fa 2041@subsubsection specification__boolean_10a_3_12 Case 12: Two faces that have a common part
e9e33e91 2042
2043Let us consider two faces *F1* and *F2* that have a common part:
2044
6b6d06fa 2045@figure{/specification/boolean_operations/images/boolean_image133.png,"",230}
e9e33e91 2046
2047The result of *Section* operation is the compound that contains 4 new edges.
2048
6b6d06fa 2049@figure{/specification/boolean_operations/images/boolean_image134.png,"",230}
e9e33e91 2050
6b6d06fa 2051@subsubsection specification__boolean_10a_3_13 Case 13: Two faces that have overlapping edges
e9e33e91 2052
2053Let us consider two faces *F1* and *F2* that have a overlapping edges:
2054
6b6d06fa 2055@figure{/specification/boolean_operations/images/boolean_image101.png,"",230}
e9e33e91 2056
2057The result of *Section* operation is the compound that contains a new edge *Enew*.
2058
6b6d06fa 2059@figure{/specification/boolean_operations/images/boolean_image102.png,"",230}
e9e33e91 2060
6b6d06fa 2061@subsubsection specification__boolean_10a_3_14 Case 14: Two faces that have overlapping vertices
e9e33e91 2062
2063Let us consider two faces *F1* and *F2* that have overlapping vertices:
2064
6b6d06fa 2065@figure{/specification/boolean_operations/images/boolean_image103.png,"",230}
e9e33e91 2066
2067The result of *Section* operation is the compound that contains a new vertex *Vnew*.
2068
6b6d06fa 2069@figure{/specification/boolean_operations/images/boolean_image104.png,"",230}
e9e33e91 2070
6b6d06fa 2071@subsubsection specification__boolean_10a_3_15 Case 15: A Face and a Solid that have an intersection curve
e9e33e91 2072
2073Let us consider face *F1* and solid *Z2* that have an intersection curve:
2074
6b6d06fa 2075@figure{/specification/boolean_operations/images/boolean_image105.png,"",230}
e9e33e91 2076
2077The result of *Section* operation is the compound that contains new edges.
2078
6b6d06fa 2079@figure{/specification/boolean_operations/images/boolean_image106.png,"",230}
e9e33e91 2080
6b6d06fa 2081@subsubsection specification__boolean_10a_3_16 Case 16: A Face and a Solid that have overlapping faces.
e9e33e91 2082
2083Let us consider face *F1* and solid *Z2* that have overlapping faces:
2084
6b6d06fa 2085@figure{/specification/boolean_operations/images/boolean_image107.png,"",230}
e9e33e91 2086
2087The result of *Section* operation is the compound that contains new edges
2088
6b6d06fa 2089@figure{/specification/boolean_operations/images/boolean_image108.png,"",230}
e9e33e91 2090
6b6d06fa 2091@subsubsection specification__boolean_10a_3_17 Case 17: A Face and a Solid that have overlapping edges.
e9e33e91 2092
2093Let us consider face *F1* and solid *Z2* that have a common part on edge:
2094
6b6d06fa 2095@figure{/specification/boolean_operations/images/boolean_image109.png,"",230}
e9e33e91 2096
2097The result of *Section* operation is the compound that contains a new edge *Enew*.
2098
6b6d06fa 2099@figure{/specification/boolean_operations/images/boolean_image110.png,"",230}
e9e33e91 2100
6b6d06fa 2101@subsubsection specification__boolean_10a_3_18 Case 18: A Face and a Solid that have overlapping vertices.
e9e33e91 2102
2103Let us consider face *F1* and solid *Z2* that have overlapping vertices:
2104
6b6d06fa 2105@figure{/specification/boolean_operations/images/boolean_image111.png,"",230}
e9e33e91 2106
2107The result of *Section* operation is the compound that contains a new vertex *Vnew*.
2108
6b6d06fa 2109@figure{/specification/boolean_operations/images/boolean_image112.png,"",230}
e9e33e91 2110
6b6d06fa 2111@subsubsection specification__boolean_10a_3_19 Case 19: Two intersecting Solids
e9e33e91 2112
2113Let us consider two intersecting solids *Z1* and *Z2*:
6b6d06fa 2114@figure{/specification/boolean_operations/images/boolean_image113.png,"",230}
e9e33e91 2115
2116The result of *Section* operation is the compound that contains new edges.
6b6d06fa 2117@figure{/specification/boolean_operations/images/boolean_image114.png,"",230}
e9e33e91 2118
6b6d06fa 2119@subsubsection specification__boolean_10a_3_20 Case 20: Two Solids that have overlapping faces
e9e33e91 2120
2121Let us consider two solids *Z1* and *Z2* that have a common part on face:
6b6d06fa 2122@figure{/specification/boolean_operations/images/boolean_image115.png,"",230}
e9e33e91 2123
2124The result of *Section* operation is the compound that contains new edges.
6b6d06fa 2125@figure{/specification/boolean_operations/images/boolean_image116.png,"",230}
e9e33e91 2126
6b6d06fa 2127@subsubsection specification__boolean_10a_3_21 Case 21: Two Solids that have overlapping edges
e9e33e91 2128
2129Let us consider two solids *Z1* and *Z2* that have overlapping edges:
6b6d06fa 2130@figure{/specification/boolean_operations/images/boolean_image117.png,"",230}
e9e33e91 2131
2132The result of *Section* operation is the compound that contains a new edge *Enew*.
6b6d06fa 2133@figure{/specification/boolean_operations/images/boolean_image118.png,"",230}
e9e33e91 2134
6b6d06fa 2135@subsubsection specification__boolean_10a_3_22 Case 22: Two Solids that have overlapping vertices
e9e33e91 2136
2137Let us consider two solids *Z1* and *Z2* that have overlapping vertices:
6b6d06fa 2138@figure{/specification/boolean_operations/images/boolean_image119.png,"",230}
e9e33e91 2139
2140The result of *Section* operation is the compound that contains a new vertex *Vnew*.
6b6d06fa 2141@figure{/specification/boolean_operations/images/boolean_image120.png,"",230}
e9e33e91 2142
6b6d06fa 2143@subsection specification__boolean_10a_4 Class BOPAlgo_Section
e9e33e91 2144
2145SA is implemented in the class *BOPAlgo_Section*. The class has no specific fields.
2146The main steps of the *BOPAlgo_Section* are the same as of *BOPAlgo_Builder* except for the following steps:
2147
2148* Build Images for Wires;
2149* Build Result of Type Wire;
2150* Build Images for Faces;
2151* Build Result of Type Face;
2152* Build Images for Shells;
2153* Build Result of Type Shell;
2154* Build Images for Solids;
2155* Build Result of Type Solid;
2156* Build Images for Type CompSolid;
2157* Build Result of Type CompSolid;
2158* Build Images for Compounds;
2159Some aspects of building the result are described in the next paragraph
2160
6b6d06fa 2161@subsection specification__boolean_10a_5 Building the Result
e9e33e91 2162
2163| No | Contents | Implementation |
2164| :---- | :---- | :------ |
2165| 1 | Build the result of the operation using all information contained in *FaceInfo*, Common Block, Shared entities of the arguments, etc. | *BOPAlgo_Section:: BuildSection()* |
2166
6b6d06fa 2167@section specification__boolean_10b Volume Maker Algorithm
e9e33e91 2168
291fced1 2169The Volume Maker algorithm has been designed for building the elementary volumes (solids) from a set of connected, intersecting, or nested shapes. The algorithm can also be useful for splitting solids into parts, or constructing new solid(s) from set of intersecting or connected faces or shells.
2170The algorithm creates only closed solids. In general case the result solids are non-manifold: fragments of the input shapes (wires, faces) located inside the solids are added as internal sub-shapes to these solids.
2171But the algorithm allows preventing the addition of the internal for solids parts into result. In this case the result solids will be manifold and not contain any internal parts. However, this option does not prevent from the occurrence of the internal edges or vertices in the faces.<br>
2172Non-closed faces, free wires etc. located outside of any solid are always excluded from the result.
2173
6b6d06fa 2174The Volume Maker algorithm is implemented in the class BOPAlgo_MakerVolume. It is based on the General Fuse (GF) algorithm. All the options of the GF algorithm (see @ref specification__boolean_7_3a "GF Options") are also available in this algorithm.
291fced1 2175
2176The requirements for the arguments are the same as for the arguments of GF algorithm - they could be of any type, but each argument should be valid and not self-interfered.
2177
2178The algorithm allows disabling the calculation of intersections among the arguments. In this case the algorithm will run much faster, but the user should guarantee that the arguments do not interfere with each other, otherwise the result will be invalid (e.g. contain unexpected parts) or empty.
2179This option is useful e.g. for building a solid from the faces of one shell or from the shapes that have already been intersected.
2180
6b6d06fa 2181@subsection specification__boolean_10b_1 Usage
291fced1 2182
2183#### C++ Level
2184The usage of the algorithm on the API level:
2185~~~~
2186BOPAlgo_MakerVolume aMV;
944768d2 2187// Set the arguments
1155d05a 2188TopTools_ListOfShape aLS = …; // arguments
291fced1 2189aMV.SetArguments(aLS);
944768d2 2190
2191// Set options for the algorithm
2192// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
2193...
2194// Additional option of the algorithm
14deaf42 2195Standard_Boolean bAvoidInternalShapes = Standard_False; // Set to True to exclude from the result any shapes internal to the solids
291fced1 2196aMV.SetAvoidInternalShapes(bAvoidInternalShapes);
944768d2 2197
2198// Perform the operation
2199aMV.Perform();
a743814b 2200if (aMV.HasErrors()) { //check error status
291fced1 2201 return;
2202}
2203//
2204const TopoDS_Shape& aResult = aMV.Shape(); // result of the operation
2205~~~~
2206
2207#### Tcl Level
2208To use the algorithm in Draw the command mkvolume has been implemented. The usage of this command is following:
2209~~~~
2210Usage: mkvolume r b1 b2 ... [-c] [-ni] [-ai]
2211Options:
2212-c - use this option to have input compounds considered as set of separate arguments (allows passing multiple arguments as one compound);
2213-ni - use this option to disable the intersection of the arguments;
2214-ai - use this option to avoid internal for solids shapes in the result.
2215~~~~
2216
6b6d06fa 2217@subsection specification__boolean_10b_2 Examples
291fced1 2218
2219#### Example 1
2220Creation of 9832 solids from sphere and set of 63 planes:
2221
2222<table align="center">
2223<tr>
6b6d06fa 2224 <td>@figure{/specification/boolean_operations/images/mkvolume_image001.png,"Arguments",200}</td>
2225 <td>@figure{/specification/boolean_operations/images/mkvolume_image002.png,"Results",200}</td>
291fced1 2226</tr>
2227</table>
2228
2229#### Example 2
2230Creating compartments on a ship defined by hull shell and a set of planes. The ship is divided on compartments by five transverse bulkheads and a deck – six compartments are created:
2231
2232<table align="center">
2233<tr>
6b6d06fa 2234 <td>@figure{/specification/boolean_operations/images/mkvolume_image003.png,"Arguments",200}</td>
2235 <td>@figure{/specification/boolean_operations/images/mkvolume_image004.png,"Results",200}</td>
291fced1 2236</tr>
2237</table>
e9e33e91 2238
6b6d06fa 2239@section specification__boolean_10c_Cells Cells Builder algorithm
e8b9db57 2240
aeee70d3 2241The Cells Builder algorithm is an extension of the General Fuse algorithm. The result of General Fuse algorithm contains all split parts of the arguments. The Cells Builder algorithm provides means to specify if any given split part of the arguments (referred to as Cell) can be taken or avoided in the result.
2242
2243The possibility of selecting any Cell allows combining any possible result and gives the Cells Builder algorithm a very wide sphere of application - from building the result of any Boolean operation to building the result of any application-specific operation.
2244
2245The algorithm builds Cells only once and then just reuses them for combining the result. This gives this algorithm the performance advantage over Boolean operations, which always rebuild the splits to obtain the desirable result.
e8b9db57 2246
aeee70d3 2247Thus, the Cells Builder algorithm can be especially useful for simulating Boolean expressions, i.e. a sequence of Boolean operations on the same arguments. Instead of performing many Boolean operations it allows getting the final result in a single operation. The Cells Builder will also be beneficial to obtain the results of different Boolean operations on the same arguments - Cut and Common, for example.
2248
2249The Cells Builder algorithm also provides the possibility to remove any internal boundaries between splits of the same type, i.e. to fuse any same-dimensional parts added into the result and to keep any other parts as separate. This possibility is implemented through the Cells material approach: to remove the boundary between two Cells, both Cells should be assigned with the same material ID. However, if the same material ID has been assigned to the Cells of different dimension, the removal of the internal boundaries for that material will not be performed. Currently, such case is considered a limitation for the algorithm.
e8b9db57 2250
2251The algorithm can also create containers from the connected Cells added into result - WIRES from Edges, SHELLS from Faces and COMPSOLIDS from Solids.
2252
6b6d06fa 2253@subsection specification__boolean_10c_Cells_1 Usage
e8b9db57 2254
2255The algorithm has been implemented in the *BOPAlgo_CellsBuilder* class.
2256
6b6d06fa 2257Cells Builder is based on the General Fuse algorithm. Thus all options of the General Fuse algorithm (see @ref specification__boolean_7_3a "GF Options") are also available in this algorithm.
e8b9db57 2258
2259The requirements for the input shapes are the same as for General Fuse - each argument should be valid in terms of *BRepCheck_Analyzer* and *BOPAlgo_ArgumentAnalyzer*.
2260
aeee70d3 2261The result of the algorithm is a compound containing the selected parts of the basic type (VERTEX, EDGE, FACE or SOLID). The default result is an empty compound. It is possible to add any Cell by using the methods *AddToRessult()* and *AddAllToResult()*. It is also possible to remove any part from the result by using methods *RemoveFromResult()* and *RemoveAllFromResult()*. The method *RemoveAllFromResult()* is also suitable for clearing the result.
e8b9db57 2262
aeee70d3 2263The Cells that should be added/removed to/from the result are defined through the input shapes containing the parts that should be taken *(ShapesToTake)* and the ones containing parts that should be avoided (ShapesToAvoid).
2264To be taken into the result the part must be IN all shapes from *ShapesToTake* and OUT of all shapes from *ShapesToAvoid*.
e8b9db57 2265
aeee70d3 2266To remove Internal boundaries, it is necessary to set the same material to the Cells, between which the boundaries should be removed, and call the method *RemoveInternalBoundaries()*.
2267The material should not be equal to 0, as this is the default material ID. The boundaries between Cells with this material ID will not be removed. The same Cell cannot be added with different materials.
2268It is also possible to remove the boundaries when the result is combined. To do this, it is necessary to set the material for parts (not equal to 0) and set the flag *bUpdate* to TRUE.
2269If the same material ID has been set for parts of different dimension, the removal of internal boundaries for this material will not be performed.
e8b9db57 2270
aeee70d3 2271It is possible to create typed Containers from the parts added into result by using method *MakeContainers()*. The type of the containers will depend on the type of the input shapes: WIRES for EDGE, SHELLS for FACES and COMPSOLIDS for SOLIDS. The result will be a compound containing containers.
e8b9db57 2272
2273#### API usage
aeee70d3 2274Here is the example of the algorithm use on the API level:
e8b9db57 2275~~~~
2276BOPAlgo_CellsBuilder aCBuilder;
944768d2 2277// Set the arguments
1155d05a 2278TopTools_ListOfShape aLS = …; // arguments
e8b9db57 2279aCBuilder.SetArguments(aLS);
944768d2 2280
2281// Set options for the algorithm
2282// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
2283...
2284
e8b9db57 2285aCBuilder.Perform(); // build splits of all arguments (GF)
a743814b 2286if (aCBuilder.HasErrors()) { // check error status
e8b9db57 2287 return;
2288}
2289//
2290// collecting of the cells into result
2291const TopoDS_Shape& anEmptyRes = aCBuilder.Shape(); // empty result, as nothing has been added yet
2292const TopoDS_Shape& anAllCells = aCBuilder.GetAllParts(); //all split parts
2293//
1155d05a 2294TopTools_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result
2295TopTools_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result
e8b9db57 2296//
2297Standard_Integer iMaterial = 1; // defines the material for the cells
2298Standard_Boolean bUpdate = Standard_False; // defines whether to update the result right now or not
2299// adding to result
2300aCBuilder.AddToResult(aLSToTake, aLSToAvoid, iMaterial, bUpdate);
2301aCBuilder.RemoveInternalBoundaries(); // removing of the boundaries
2302TopoDS_Shape aResult = aCBuilder.Shape(); // the result
2303// removing from result
2304aCBuilder.AddAllToResult();
2305aCBuilder.RemoveFromResult(aLSToTake, aLSToAvoid);
2306aResult = aCBuilder.Shape(); // the result
2307~~~~
2308
2309#### DRAW usage
2310
2311The following set of new commands has been implemented to run the algorithm in DRAW Test Harness:
2312~~~~
aeee70d3 2313bcbuild : Initialization of the Cells Builder. Use: *bcbuild r*
2314bcadd : Add parts to result. Use: *bcadd r s1 (0,1) s2 (0,1) ... [-m material [-u]]*
2315bcaddall : Add all parts to result. Use: *bcaddall r [-m material [-u]]*
2316bcremove : Remove parts from result. Use: *bcremove r s1 (0,1) s2 (0,1) ...*
2317bcremoveall : Remove all parts from result. Use: *bcremoveall*
2318bcremoveint : Remove internal boundaries. Use: *bcremoveint r*
2319bcmakecontainers : Make containers from the parts added to result. Use: *bcmakecontainers r*
e8b9db57 2320~~~~
2321
aeee70d3 2322Here is the example of the algorithm use on the DRAW level:
e8b9db57 2323~~~~
2324psphere s1 15
2325psphere s2 15
2326psphere s3 15
2327ttranslate s1 0 0 10
2328ttranslate s2 20 0 10
2329ttranslate s3 10 0 0
2330bclearobjects; bcleartools
2331baddobjects s1 s2 s3
2332bfillds
2333# rx will contain all split parts
2334bcbuild rx
2335# add to result the part that is common for all three spheres
2336bcadd res s1 1 s2 1 s3 1 -m 1
2337# add to result the part that is common only for first and third spheres
2338bcadd res s1 1 s2 0 s3 1 -m 1
2339# remove internal boundaries
2340bcremoveint res
2341~~~~
2342
6b6d06fa 2343@subsection specification__boolean_10c_Cells_2 Examples
e8b9db57 2344
aeee70d3 2345The following simple example illustrates the possibilities of the algorithm working on a cylinder and a sphere intersected by a plane:
e8b9db57 2346~~~~
2347pcylinder c 10 30
2348psphere s 15
2349ttranslate s 0 0 30
2350plane p 0 0 20 1 0 0
2351mkface f p -25 30 -17 17
2352~~~~
2353
6b6d06fa 2354@figure{/specification/boolean_operations/images/cells_algorithm_001.png,"Arguments",160}
e8b9db57 2355
2356~~~~
2357bclearobjects
2358bcleartools
2359baddobjects c s f
2360bfillds
2361bcbuild r
2362~~~~
2363
2364#### 1. Common for all arguments
2365
2366~~~~
2367bcremoveall
2368bcadd res c 1 s 1 f 1
2369~~~~
2370
6b6d06fa 2371@figure{/specification/boolean_operations/images/cells_algorithm_002.png,"The result of COMMON operation",126}
e8b9db57 2372
2373#### 2. Common between cylinder and face
2374
2375~~~~
2376bcremoveall
2377bcadd res f 1 c 1
2378~~~~
2379
6b6d06fa 2380@figure{/specification/boolean_operations/images/cells_algorithm_003.png,"The result of COMMON operation between cylinder and face",90}
e8b9db57 2381
2382#### 3. Common between cylinder and sphere
2383
2384~~~~
2385bcremoveall
2386bcadd res c 1 s 1
2387~~~~
2388
6b6d06fa 2389@figure{/specification/boolean_operations/images/cells_algorithm_004.png,"The result of COMMON operation between cylinder and sphere",120}
e8b9db57 2390
2391#### 4. Fuse of cylinder and sphere
2392
2393~~~~
2394bcremoveall
2395bcadd res c 1 -m 1
2396bcadd res s 1 -m 1
2397bcremoveint res
2398~~~~
2399
6b6d06fa 2400@figure{/specification/boolean_operations/images/cells_algorithm_005.png,"The result of FUSE operation between cylinder and sphere",160}
e8b9db57 2401
2402#### 5. Parts of the face inside solids - FUSE(COMMON(f, c), COMMON(f, s))
2403
2404~~~~
2405bcremoveall
2406bcadd res f 1 s 1 -m 1
2407bcadd res f 1 c 1 -m 1
2408~~~~
2409
6b6d06fa 2410@figure{/specification/boolean_operations/images/cells_algorithm_006_1.png,"Parts of the face inside solids",160}
e8b9db57 2411
2412~~~~
2413bcremoveint res
2414~~~~
2415
6b6d06fa 2416@figure{/specification/boolean_operations/images/cells_algorithm_006_2.png,"Unified parts of the face inside solids",160}
e8b9db57 2417
2418#### 6. Part of the face outside solids
2419
2420~~~~
2421bcremoveall
2422bcadd res f 1 c 0 s 0
2423~~~~
2424
6b6d06fa 2425@figure{/specification/boolean_operations/images/cells_algorithm_007.png,"Part of the face outside solids",160}
e8b9db57 2426
2427#### 7. Fuse operation (impossible using standard Boolean Fuse operation)
2428
2429~~~~
2430bcremoveall
2431bcadd res c 1 -m 1
2432bcadd res s 1 -m 1
2433bcadd res f 1 c 0 s 0
2434bcremoveint res
2435~~~~
2436
6b6d06fa 2437@figure{/specification/boolean_operations/images/cells_algorithm_008.png,"Fuse operation",160}
e8b9db57 2438
2439
aeee70d3 2440These examples may last forever. To define any new operation, it is just necessary to define, which Cells should be taken and which should be avoided.
e8b9db57 2441
2442
6b6d06fa 2443@section specification__boolean_10 Algorithm Limitations
1a457208 2444
2445The chapter describes the problems that are considered as Algorithm limitations. In most cases an Algorithm failure is caused by a combination of various factors, such as self-interfered arguments, inappropriate or ungrounded values of the argument tolerances, adverse mutual position of the arguments, tangency, etc.
2446
e9e33e91 2447A lot of failures of GFA algorithm can be caused by bugs in low-level algorithms: Intersection Algorithm, Projection Algorithm, Approximation Algorithm, Classification Algorithm, etc.
1a457208 2448* The Intersection, Projection and Approximation Algorithms are mostly used at the Intersection step. Their bugs directly cause wrong section results (i.e. incorrect section edges, section points, missing section edges or micro edges). It is not possible to obtain a correct final result of the GFA if a section result is wrong.
3f812249 2449* The Projection Algorithm is used at the Intersection step. The purpose of Projection Algorithm is to compute 2D curves on surfaces. Wrong results here lead to incorrect or missing faces in the final GFA result.
1a457208 2450* The Classification Algorithm is used at the Building step. The bugs in the Classification Algorithm lead to errors in selecting shape parts (edges, faces, solids) and ultimately to a wrong final GFA result.
2451
07f2b741 2452The description below illustrates some known GFA limitations. It does not enumerate exhaustively all problems that can arise in practice. Please address cases of Algorithm failure to the OCCT Maintenance Service.
1a457208 2453
2454
6b6d06fa 2455@subsection specification__boolean_10_1 Arguments
1a457208 2456
6b6d06fa 2457@subsubsection specification__boolean_10_1_1 Common requirements
1a457208 2458
2459Each argument should be valid (in terms of *BRepCheck_Analyzer*), or conversely, if the argument is considered as non-valid (in terms of *BRepCheck_Analyzer*), it cannot be used as an argument of the algorithm.
2460
2461The class *BRepCheck_Analyzer* is used to check the overall validity of a shape. In OCCT a Shape (or its sub-shapes) is considered valid if it meets certain criteria. If the shape is found as invalid, it can be fixed by tools from *ShapeAnalysis, ShapeUpgrade* and *ShapeFix* packages.
2462
2463However, it is important to note that class *BRepCheck_Analyzer* is just a tool that can have its own problems; this means that due to a specific factor(s) this tool can sometimes provide a wrong result.
2464
2465Let us consider the following example:
2466
3f812249 2467The Analyzer checks distances between couples of 3D check-points <i>(Pi, PSi)</i> of edge *E* on face *F*. Point *Pi* is obtained from the 3D curve (at the parameter *ti*) of the edge. *PSi* is obtained from 2D curve (at the parameter *ti*) of the edge on surface *S* of face *F*. To be valid the distance should be less than *Tol(E)* for all couples of check-points. The number of these check-points is a predefined value (e.g. 23).
1a457208 2468
2469Let us consider the case when edge *E* is recognized valid (in terms of *BRepCheck_Analyzer*).
2470
3f812249 2471Further, after some operation, edge *E* is split into two edges *E1* and *E2*. Each split edge has the same 3D curve and 2D curve as the original edge *E*.
1a457208 2472
2473Let us check *E1* (or E2). The Analyzer again checks the distances between the couples of check-points points <i>(Pi, PSi)</i>. The number of these check-points is the same constant value (23), but there is no guarantee that the distances will be less than *Tol(E)*, because the points chosen for *E1* are not the same as for *E*.
2474
2475Thus, if *E1* is recognized by the Analyzer as non-valid, edge *E* should also be non-valid. However *E* has been recognized as valid. Thus the Analyzer gives a wrong result for *E*.
2476
2477The fact that the argument is a valid shape (in terms of *BRepCheck_Analyzer*) is a necessary but insufficient requirement to produce a valid result of the Algorithms.
2478
6b6d06fa 2479@subsubsection specification__boolean_10_1_3 Pure self-interference
1a457208 2480
2481The argument should not be self-interfered, i.e. all sub-shapes of the argument that have geometrical coincidence through any topological entities (vertices, edges, faces) should share these entities.
2482
2483#### Example 1: Compound of two edges
2484The compound of two edges *E1* and *E2* is a self-interfered shape and cannot be used as the argument of the Algorithms.
2485
6b6d06fa 2486@figure{/specification/boolean_operations/images/operations_image036.svg,"Compound of two edges",230}
1a457208 2487
2488#### Example 2: Self-interfered Edge
2489The edge *E* is a self-interfered shape and cannot be used as an argument of the Algorithms.
2490
6b6d06fa 2491@figure{/specification/boolean_operations/images/operations_image037.svg,"Self-interfered Edge",140}
1a457208 2492
2493#### Example 3: Self-interfered Face
2494The face *F* is a self-interfered shape and cannot be used as an argument of the Algorithms.
2495
6b6d06fa 2496@figure{/specification/boolean_operations/images/operations_image038.svg,"Self-interfered Face",230}
1a457208 2497
2498#### Example 4: Face of Revolution
2499The face *F* has been obtained by revolution of edge *E* around line *L*.
2500
6b6d06fa 2501@figure{/specification/boolean_operations/images/operations_image039a.png,"Face of Revolution: Arguments",230}
2502@figure{/specification/boolean_operations/images/operations_image039b.png,"Face of Revolution: Result",230}
1a457208 2503
2504In spite of the fact that face *F* is valid (in terms of *BRepCheck_Analyzer*) it is a self-interfered shape and cannot be used as the argument of the Algorithms.
2505
6b6d06fa 2506@subsubsection specification__boolean_10_1_4 Self-interferences due to tolerances
1a457208 2507#### Example 1: Non-closed Edge
2508
6b6d06fa 2509Let us consider edge *E* based on a non-closed circle. @figure{/specification/boolean_operations/images/operations_image040.png,"Edge based on a non-closed circle",230}
1a457208 2510
2511The distance between the vertices of *E* is *D=0.69799*. The values of the tolerances *Tol(V1)=Tol(V2)=0.5*.
6b6d06fa 2512@figure{/specification/boolean_operations/images/operations_image041.png,"Distance and Tolerances",230}
1a457208 2513
2514In spite of the fact that the edge *E* is valid in terms of *BRepCheck_Analyzer*, it is a self-interfered shape because its vertices are interfered. Thus, edge *E* cannot be used as an argument of the Algorithms.
2515
2516#### Example 2: Solid containing an interfered vertex
2517
6b6d06fa 2518Let us consider solid *S* containing vertex V. @figure{/specification/boolean_operations/images/operations_image042.png,"Solid containing an interfered vertex",230}
1a457208 2519
2520The value of tolerance Tol(V)= 50.000075982061.
2521
6b6d06fa 2522@figure{/specification/boolean_operations/images/operations_image043.png,"Tolerance",230}
1a457208 2523
2524In spite of the fact that solid *S* is valid in terms of *BRepCheck_Analyzer* it is a self-interfered shape because vertex *V* is interfered with a lot of sub-shapes from *S* without any topological connection with them. Thus solid *S* cannot be used as an argument of the Algorithms.
2525
6b6d06fa 2526@subsubsection specification__boolean_10_1_5 Parametric representation
1a457208 2527The parameterization of some surfaces (cylinder, cone, surface of revolution) can be the cause of limitation.
2528
2529#### Example 1: Cylindrical surface
2530The parameterization range for cylindrical surface is:
2531
6b6d06fa 2532@figure{/specification/boolean_operations/images/boolean_image135.png,"",230}
1a457208 2533
2534The range of *U* coordinate is always restricted while the range of *V* coordinate is non-restricted.
2535
2536Let us consider a cylinder-based *Face 1* with radii *R=3* and *H=6*.
2537
6b6d06fa 2538@figure{/specification/boolean_operations/images/operations_image044.png,"Face 1",230}
1a457208 2539
6b6d06fa 2540@figure{/specification/boolean_operations/images/operations_image045.png,"P-Curves for Face 1",230}
1a457208 2541
2542Let us also consider a cylinder-based *Face 2* with radii *R=3000* and *H=6000* (resulting from scaling Face 1 with scale factor *ScF=1000*).
2543
6b6d06fa 2544@figure{/specification/boolean_operations/images/operations_image046.png,"Face 2",230}
1a457208 2545
6b6d06fa 2546@figure{/specification/boolean_operations/images/operations_image047.png,"P-Curves for Face 2",230}
1a457208 2547
07f2b741 2548Pay attention to the Zoom value of the Figures.
1a457208 2549
2550It is obvious that starting with some value of *ScF*, e.g. *ScF>1000000*, all sloped p-Curves on *Face 2* will be almost vertical. At least, there will be no difference between the values of angles computed by standard C Run-Time Library functions, such as *double acos(double x)*. The loss of accuracy in computation of angles can cause failure of some BP sub-algorithms, such as building faces from a set of edges or building solids from a set of faces.
2551
2552
6b6d06fa 2553@subsubsection specification__boolean_10_1_6 Using tolerances of vertices to fix gaps
1a457208 2554
2555It is possible to create shapes that use sub-shapes of lower order to avoid gaps in the tolerance-based data model.
2556
2557Let us consider the following example:
2558
6b6d06fa 2559@figure{/specification/boolean_operations/images/operations_image048.png,"Example",230}
1a457208 2560
2561* Face *F* has two edges *E1* and *E2* and two vertices, the base plane is <i>{0,0,0, 0,0,1}</i>;
2562* Edge *E1* is based on line <i>{0,0,0, 1,0,0}, Tol(E1) = 1.e-7; </i>
2563* Edge *E2* is based on line <i>{0,1,0, 1,0,0}, Tol(E2) = 1.e-7;</i>
2564* Vertex *V1*, point <i>{0,0.5,0}, Tol(V1) = 1;</i>
2565* Vertex *V2*, point <i>{10,0.5,0}, Tol(V2) = 1;</i>
2566* Face *F* is valid (in terms of *BRepCheck_Analyzer*).
2567
2568The values of tolerances *Tol(V1)* and *Tol(V2)* are big enough to fix the gaps between the ends of the edges, but the vertices *V1* and *V2* do not contain any information about the trajectories connecting the corresponding ends of the edges. Thus, the trajectories are undefined. This will cause failure of some sub-algorithms of BP. For example, the sub-algorithms for building faces from a set of edges use the information about all edges connected in a vertex. The situation when a vertex has several pairs of edges such as above will not be solved in a right way.
2569
2570
6b6d06fa 2571@subsection specification__boolean_11_1 Intersection problems
2572@subsubsection specification__boolean_11_1_1 Pure intersections and common zones
1a457208 2573
2574#### Example: Intersecting Edges
2575
2576Let us consider the intersection between two edges:
2577* *E1* is based on a line: <i>{0,-10,0, 1,0,0}, Tol(E1)=2.</i>
2578* *E2* is based on a circle: <i>{0,0,0, 0,0,1}, R=10, Tol(E2)=2.</i>
2579
6b6d06fa 2580@figure{/specification/boolean_operations/images/operations_image049.png,"Intersecting Edges",320}
1a457208 2581
2582The result of pure intersection between *E1* and *E2* is vertex *Vx {0,-10,0}*.
2583
2584The result of intersection taking into account tolerances is the common zone *CZ* (part of 3D-space where the distance between the curves is less than or equals to the sum of edge tolerances.
2585
2586The Intersection Part of Algorithms uses the result of pure intersection *Vx* instead of *CZ* for the following reasons:
2587* The Algorithms do not produce Common Blocks between edges based on underlying curves of explicitly different type (e.g. Line / Circle). If the curves have different types, the rule of thumb is that the produced result is of type **vertex**. This rule does not work for non-analytic curves (Bezier, B-Spline) and their combinations with analytic curves.
e9e33e91 2588* The algorithm of intersection between two surfaces *IntPatch_Intersection* does not compute *CZ* of the intersection between curves and points. So even if *CZ* were computed by Edge/Edge intersection algorithm, its result could not be treated by Face/Face intersection algorithm.
1a457208 2589
6b6d06fa 2590@subsubsection specification__boolean_11_2_2 Tolerances and inaccuracies
1a457208 2591
2592The following limitations result from modeling errors or inaccuracies.
2593
2594#### Example: Intersection of planar faces
2595
2596Let us consider two planar rectangular faces *F1* and *F2*.
2597
e9e33e91 2598The intersection curve between the planes is curve *C12*. The curve produces a new intersection edge *EC12*. The edge goes through vertices *V1* and *V2* thanks to big tolerance values of vertices *Tol(V1)* and *Tol(V2)*. So, two straight edges *E12* and *EC12* go through two vertices, which is impossible in this case.
1a457208 2599
6b6d06fa 2600@figure{/specification/boolean_operations/images/operations_image050.svg,"Intersecting Faces",320}
1a457208 2601
2602
2603The problem cannot be solved in general, because the length of *E12* can be infinite and the values of *Tol(V1)* and *Tol(V2)* theoretically can be infinite too.
2604
2605In a particular case the problem can be solved in several ways:
2606* Reduce, if possible, the values of *Tol(V1)* and *Tol(V2)* (refinement of *F1*).
2607* Analyze the value of *Tol(EC12)* and increase *Tol(EC12)* to get a common part between the edges *EC12* and *E12*. Then the common part will be rejected as there is an already existing edge *E12* for face *F1*.
2608
2609It is easy to see that if *C12* is slightly above the tolerance spheres of *V1* and *V2* the problem does not appear.
2610
2611#### Example: Intersection of two edges
2612
2613Let us consider two edges *E1* and *E2*, which have common vertices *V1* and *V2*. The edges *E1* and *E2* have 3D-curves *C1* and *C2. Tol(E1)=1.e<sup>-7</sup>, Tol(E2)=1.e<sup>-7</sup>.*
2614
2615*C1* practically coincides in 3D with *C2*. The value of deflection is *Dmax* (e.g. *Dmax=1.e<sup>-6</sup>*).
2616
6b6d06fa 2617@figure{/specification/boolean_operations/images/operations_image051.svg,"Intersecting Edges",420}
1a457208 2618
2619The evident and prospective result should be the Common Block between *E1* and *E2*. However, the result of intersection differs.
2620
6b6d06fa 2621@figure{/specification/boolean_operations/images/operations_image052.svg,"Result of Intersection",420}
1a457208 2622
e9e33e91 2623The result contains three new vertices *Vx1, Vx2* and *Vx3*, 8 new edges <i>(V1, Vx1, Vx2, Vx3, V2)</i> and no Common Blocks. This is correct due to the source data: *Tol(E1)=1.e<sup>-7</sup>, Tol(E2)=1.e<sup>-7</sup>* and <i>Dmax=1.e<sup>-6</sup></i>.
1a457208 2624
2625In this particular case the problem can be solved by several ways:
2626* Increase, if possible, the values *Tol(E1)* and *Tol(E2)* to get coincidence in 3D between *E1* and *E2* in terms of tolerance.
2627* Replace *E1* by a more accurate model.
2628
2629The example can be extended from 1D (edges) to 2D (faces).
2630
6b6d06fa 2631@figure{/specification/boolean_operations/images/operations_image053.svg,"Intersecting Faces",420}
1a457208 2632
2633The comments and recommendations are the same as for 1D case above.
2634
2635
6b6d06fa 2636@subsubsection specification__boolean_11_2_3 Acquired Self-interferences
1a457208 2637#### Example 1: Vertex and edge
2638
2639Let us consider vertex *V1* and edge *E2*.
2640
6b6d06fa 2641@figure{/specification/boolean_operations/images/operations_image054.svg,"Vertex and Edge",171}
1a457208 2642
2643Vertex *V1* interferes with vertices *V12* and *V22*.
2644So vertex *V21* should interfere with vertex *V22*, which is impossible because vertices *V21* and *V22* are the vertices of edge *E2*, thus *V21* is not equal to *V22*.
2645
e9e33e91 2646The problem cannot be solved in general, because the length can be as small as possible to provide validity of *E2* (in the extreme case: *Length (E2) = Tol(V21) + Tol(V22) + e,* where *e-> 0*).
1a457208 2647
2648In a particular case the problem can be solved by refinement of arguments, i.e. by decreasing the values of *Tol(V21)*, *Tol(V22)* and *Tol(V1)*.
2649
1a457208 2650#### Example 2: Vertex and wire
2651
2652Let us consider vertex *V2* and wire consisting of edges *E11* and *E12*.
2653
6b6d06fa 2654@figure{/specification/boolean_operations/images/operations_image055.svg,"Vertex and Wire",200}
1a457208 2655
2656The arguments themselves are not self-intersected.
2657Vertex *V2* interferes with edges *E11* and *E12*. Thus, edge *E11* should interfere with edge *E22*, but it is impossible because edges *E11* and *E12* cannot interfere by the condition.
2658
2659The cases when a non-self-interfered argument (or its sub-shapes) become interfered due to the intersections with other arguments (or their sub-shapes) are considered as limitations for the Algorithms.
2660
6b6d06fa 2661@section specification__boolean_11a Advanced Options
1a457208 2662
e9e33e91 2663The previous chapters describe so called Basic Operations. Most of tasks can be solved using Basic Operations. Nonetheless, there are cases that can not be solved straightforwardly by Basic Operations. The tasks are considered as limitations of Basic Operations.
1a457208 2664
e9e33e91 2665The chapter is devoted to Advanced Options. In some cases the usage of Advanced Options allows overcoming the limitations, improving the quality of the result of operations, robustness and performance of the operators themselves.
1a457208 2666
6b6d06fa 2667@subsection specification__boolean_11a_1 Fuzzy Boolean Operation
1a457208 2668
aeee70d3 2669Fuzzy Boolean operation is the option of Basic Operations such as General Fuse, Splitting, Boolean, Section, Maker Volume and Cells building operations, in which additional user-specified tolerance is used. This option allows operators to handle robustly cases of touching and near-coincident, misaligned entities of the arguments.
1a457208 2670
aeee70d3 2671The Fuzzy option is useful on the shapes with gaps or embeddings between the entities of these shapes, which are not covered by the tolerance values of these entities. Such shapes can be the result of modeling mistakes, or translating process, or import from other systems with loss of precision, or errors in some algorithms.
1a457208 2672
e9e33e91 2673Most likely, the Basic Operations will give unsatisfactory results on such models. The result may contain unexpected and unwanted small entities, faulty entities (in terms of *BRepCheck_Analyzer*), or there can be no result at all.
1a457208 2674
3f812249 2675With the Fuzzy option it is possible to get the expected result -- it is just necessary to define the appropriate value of fuzzy tolerance for the operation. To define that value it is necessary to measure the value of the gap (or the value of embedding depth) between the entities of the models, slightly increase it (to make the shifted entities coincident in terms of their tolerance plus the additional one) and pass it to the algorithm.
1a457208 2676
e9e33e91 2677Fuzzy option is included in interface of Intersection Part (class *BOPAlgo_PaveFiller*) and application programming interface (class *BRepAlgoAPI_BooleanOperation*)
1a457208 2678
6b6d06fa 2679@subsubsection specification__boolean_11a_1_1 Examples
e9e33e91 2680The following examples demonstrate the advantages of usage Fuzzy option operations over the Basic Operations in typical situations.
1a457208 2681
483ce1bd 2682#### Case 1
1a457208 2683
e9e33e91 2684In this example the cylinder (shown in yellow and transparent) is subtracted from the box (shown in red). The cylinder is shifted by 5e<sup>-5</sup> relatively to the box along its axis (the distance between rear faces of the box and cylinder is 5e<sup>-5</sup>).
1a457208 2685
6b6d06fa 2686@figure{/specification/boolean_operations/images/boolean_image121.png,"",240}
e9e33e91 2687
2688The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 5e<sup>-5</sup>:
1a457208 2689
6b6d06fa 2690@figure{/specification/boolean_operations/images/boolean_image122.png,"Result of CUT operation obtained with Basic Operations",240}
1a457208 2691
6b6d06fa 2692@figure{/specification/boolean_operations/images/boolean_image123.png,"Result of CUT operation obtained with Fuzzy Option",240}
1a457208 2693
e9e33e91 2694In this example Fuzzy option allows eliminating a very thin part of the result shape produced by Basic algorithm due to misalignment of rear faces of the box and the cylinder.
1a457208 2695
483ce1bd 2696#### Case 2
1a457208 2697
e9e33e91 2698In this example two boxes are fused. One of them has dimensions 10*10*10, and the other is 10*10.000001*10.000001 and adjacent to the first one. There is no gap in this case as the surfaces of the neighboring faces coincide, but one box is slightly greater than the other.
1a457208 2699
6b6d06fa 2700@figure{/specification/boolean_operations/images/boolean_image124.png,"",240}
1a457208 2701
e9e33e91 2702The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 1e<sup>-6</sup>:
1a457208 2703
6b6d06fa 2704@figure{/specification/boolean_operations/images/boolean_image125.png,"Result of CUT operation obtained with Basic Operations",240}
1a457208 2705
6b6d06fa 2706@figure{/specification/boolean_operations/images/boolean_image126.png,"Result of CUT operation obtained with Fuzzy Option",240}
1a457208 2707
e9e33e91 2708In this example Fuzzy option allows eliminating an extremely narrow face in the result produced by Basic operation.
1a457208 2709
483ce1bd 2710#### Case 3
1a457208 2711
e9e33e91 2712In this example the small planar face (shown in orange) is subtracted from the big one (shown in yellow). There is a gap 1e<sup>-5</sup> between the edges of these faces.
1a457208 2713
6b6d06fa 2714@figure{/specification/boolean_operations/images/boolean_image127.png,"",240}
1a457208 2715
e9e33e91 2716The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 1e<sup>-5</sup>:
1a457208 2717
6b6d06fa 2718@figure{/specification/boolean_operations/images/boolean_image128.png,"Result of CUT operation obtained with Basic Operations",240}
1a457208 2719
6b6d06fa 2720@figure{/specification/boolean_operations/images/boolean_image129.png,"Result of CUT operation obtained with Fuzzy Option",240}
1a457208 2721
e9e33e91 2722In this example Fuzzy options eliminated a pin-like protrusion resulting from the gap between edges of the argument faces.
1a457208 2723
483ce1bd 2724#### Case 4
1a457208 2725
e9e33e91 2726In this example the small edge is subtracted from the big one. The edges are overlapping not precisely, with max deviation between them equal to 5.28004e<sup>-5</sup>. We will use 6e<sup>-5</sup> value for Fuzzy option.
1a457208 2727
6b6d06fa 2728@figure{/specification/boolean_operations/images/boolean_image130.png,"",240}
1a457208 2729
e9e33e91 2730The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 6e<sup>-5</sup>:
1a457208 2731
6b6d06fa 2732@figure{/specification/boolean_operations/images/boolean_image131.png,"Result of CUT operation obtained with Basic Operations",240}
e9e33e91 2733
6b6d06fa 2734@figure{/specification/boolean_operations/images/boolean_image132.png,"Result of CUT operation obtained with Fuzzy Option",240}
e9e33e91 2735
2736This example stresses not only the validity, but also the performance issue. The usage of Fuzzy option with the appropriate value allows processing the case much faster than with the pure Basic operation. The performance gain for the case is 45 (Processor: Intel(R) Core(TM) i5-3450 CPU @ 3.10 GHz).
2737
6b6d06fa 2738@subsection specification__boolean_11a_2 Gluing Operation
483ce1bd 2739
aeee70d3 2740The Gluing operation is the option of the Basic Operations such as General Fuse, Splitting, Boolean, Section, Maker Volume and Cells building operations.
483ce1bd 2741It has been designed to speed up the computation of the interferences among arguments of the operations on special cases, in which the arguments may be overlapping but do not have real intersections between their sub-shapes.
2742
2743This option cannot be used on the shapes having real intersections, like intersection vertex between edges, or intersection vertex between edge and a face or intersection line between faces:
d6b4d3d0 2744
6b6d06fa 2745@figure{/specification/boolean_operations/images/glue_options_image002.png,"Intersecting faces",240}
483ce1bd 2746
2747There are two possibilities of overlapping shapes:
2748* The shapes can be partially coinciding - the faces do not have intersection curves, but overlapping. The faces of such arguments will be split during the operation. The following picture illustrates such shapes:
d6b4d3d0 2749
6b6d06fa 2750@figure{/specification/boolean_operations/images/glue_options_image001.png,"Partially coinciding faces",240}
d6b4d3d0 2751
2752* The shapes can be fully coinciding - there should be no partial overlapping of the faces, thus no intersection of type EDGE/FACE at all. In such cases the faces will not be split during the operation.
2753
6b6d06fa 2754@figure{/specification/boolean_operations/images/glue_options_image003.png,"Full coinciding faces of the boxes",240}
483ce1bd 2755
2756Thus, there are two possible options - for full and partial coincidence of the shapes.
2757
2758Even though there are no real intersections on such cases without Gluing options the algorithm will still intersect the sub-shapes of the arguments with interfering bounding boxes.
2759
2760The performance improvement in gluing mode is achieved by excluding the most time consuming computations and in some case can go up to 90%:
2761* Exclude computation of FACE/FACE intersections for partial coincidence;
2762* Exclude computation of VERTEX/FACE, EDGE/FACE and FACE/FACE intersections for full coincidence.
2763
2764By setting the Gluing option for the operation user should guarantee that the arguments are really coinciding. The algorithm does not check this itself. Setting inappropriate option for the operation is likely to lead to incorrect result.
2765
6b6d06fa 2766@subsubsection specification__boolean_11a_2_1 Usage
483ce1bd 2767
2768The Gluing option is an enumeration implemented in BOPAlgo_GlueEnum.hxx:
2769* BOPAlgo_GlueOff - default value for the algorithms, Gluing is switched off;
2770* BOPAlgo_GlueShift - Glue option for shapes with partial coincidence;
2771* BOPAlgo_GlueFull - Glue option for shapes with full coincidence.
2772
2773#### API level
2774For setting the Gluing options for the algorithm it is just necessary to call the SetGlue(const BOPAlgo_Glue) method with appropriate value:
2775~~~~
2776BOPAlgo_Builder aGF;
2777//
2778....
2779// setting the gluing option to speed up intersection of the arguments
2780aGF.SetGlue(BOPAlgo_GlueShift)
2781//
2782....
2783~~~~
2784
2785#### TCL level
2786For setting the Gluing options in DRAW it is necessary to call the <i>bglue</i> command with appropriate value:
2787* 0 - default value, Gluing is off;
2788* 1 - for partial coincidence;
2789* 2 - for full coincidence
2790
2791~~~~
2792bglue 1
2793~~~~
2794
6b6d06fa 2795@subsubsection specification__boolean_11a_2_2 Examples
483ce1bd 2796#### Case1 - Fusing the 64 bspline boxes into one solid
d6b4d3d0 2797
6b6d06fa 2798@figure{/specification/boolean_operations/images/glue_options_image004.png,"BSpline Boxes with partial coincidence",240}
483ce1bd 2799
2800Performance improvement from using the GlueShift option in this case is about 70 percent.
2801
2802#### Case2 - Sewing faces of the shape after reading from IGES
d6b4d3d0 2803
6b6d06fa 2804@figure{/specification/boolean_operations/images/glue_options_image005.png,"Faces with coinciding but not shared edges",240}
483ce1bd 2805
2806Performance improvement in this case is also about 70 percent.
2807
6b6d06fa 2808@subsection specification__boolean_11a_3 Safe processing mode
c58055ad 2809
aeee70d3 2810The safe processing mode is the advanced option in Boolean Operation component. This mode can be applied to all Basic operations such as General Fuse, Splitting, Boolean, Section, Maker Volume, Cells building.
2811This option allows keeping the input arguments untouched. In other words, switching this option on prevents the input arguments from any modification such as tolerance increase, addition of the P-Curves on edges, etc.
c58055ad 2812
aeee70d3 2813The option can be very useful for implementation of the Undo/Redo mechanism in the applications and allows performing the operation many times without changing the inputs.
c58055ad 2814
aeee70d3 2815By default the safe processing option is switched off for the algorithms. Enabling this option might slightly decrease the performance of the operation, because instead of the modification of some entity it will be necessary to create the copy of this entity and modify it. However, this degradation should be very small because the copying is performed only in case of necessity.
c58055ad 2816
aeee70d3 2817The option is also available in the Intersection algorithm - *BOPAlgo_PaveFiller*. To perform several different operations on the same arguments, the safe processing mode can be enabled in PaveFiller, prepared only once and then used in operations. It is enough to set this option to PaveFiller only and all algorithms taking this PaveFiller will also work in the safe mode.
c58055ad 2818
6b6d06fa 2819@subsubsection specification__boolean_11a_3_1 Usage
c58055ad 2820
2821#### API level
2822
aeee70d3 2823To enable/disable the safe processing mode for the algorithm, it is necessary to call *SetNonDestructive()* method with the appropriate value:
c58055ad 2824~~~~
2825BOPAlgo_Builder aGF;
2826//
2827....
2828// enabling the safe processing mode to prevent modification of the input shapes
2829aGF.SetNonDestructive(Standard_True);
2830//
2831....
2832~~~~
2833
2834#### TCL level
aeee70d3 2835To enable the safe processing mode for the operation in DRAW, it is necessary to call the <i>bnondestructive</i> command with the appropriate value:
c58055ad 2836* 0 - default value, the safe mode is switched off;
2837* 1 - the safe mode will be switched on.
2838
2839~~~~
2840bnondestructive 1
2841~~~~
2842
6b6d06fa 2843@subsection specification__boolean_11a_4 How to disable check of input solids for inverted status
98b37659 2844
14deaf42 2845By default, all input solids are checked for inverted status, i.e. the solids are classified to understand if they are holes in the space (negative volumes) or normal solids (positive volumes). The possibility to disable the check of the input solids for inverted status is the advanced option in Boolean Operation component. This option can be applied to all Basic operations, such as General Fuse, Splitting, Boolean, Section, Maker Volume and Cells building.
2846This option allows avoiding time-consuming classification of the input solids and processing them in the same way as positive volumes, saving up to 10 percent of time on the cases with a big number of input solids.
98b37659 2847
2848The classification should be disabled only if the user is sure that there are no negative volumes among the input solids, otherwise the result may be invalid.
2849
6b6d06fa 2850@subsubsection specification__boolean_11a_4_1 Usage
98b37659 2851
2852#### API level
2853
2854To enable/disable the classification of the input solids it is necessary to call *SetCheckInverted()* method with the appropriate value:
2855~~~~
2856BOPAlgo_Builder aGF;
2857//
2858....
2859// disabling the classification of the input solid
2860aGF.SetCheckInverted(Standard_False);
2861//
2862....
2863~~~~
2864
2865#### TCL level
14deaf42 2866To enable/disable the classification of the solids in DRAW, it is necessary to call *bcheckinverted* command with the appropriate value:
98b37659 2867* 0 - disabling the classification;
2868* 1 - default value, enabling the classification.
2869
2870~~~~
2871bcheckinverted 0
2872~~~~
2873
6b6d06fa 2874@subsection specification__boolean_11a_5_obb Usage of Oriented Bounding Boxes
944768d2 2875
14deaf42 2876Since Oriented Bounding Boxes are usually much tighter than Axes Aligned Bounding Boxes (for more information on OBB see the @ref occt_modat_6 "Bounding boxes" chapter of Modeling data User guide) its usage can significantly speed-up the intersection stage of the operation by reducing the number of interfering objects.
944768d2 2877
6b6d06fa 2878@subsubsection specification__boolean_11a_5_obb_1 Usage
944768d2 2879
2880#### API level
a25d5aaa 2881To enable/disable the usage of OBB in the operation it is necessary to call the *SetUseOBB()* method with the appropriate value:
944768d2 2882~~~~
2883BOPAlgo_Builder aGF;
2884//
2885....
2886// Enabling the usage of OBB in the operation
2887aGF.SetUseOBB(Standard_True);
2888//
2889....
2890~~~~
2891
2892#### TCL level
a25d5aaa 2893To enable/disable the usage of OBB in the operation in DRAW it is necessary to call the *buseobb* command with the appropriate value:
944768d2 2894* 0 - disabling the usage of OBB;
2895* 1 - enabling the usage of OBB.
2896~~~~
2897buseobb 1
2898~~~~
98b37659 2899
6b6d06fa 2900@section specification__boolean_ers Errors and warnings reporting system
33ba8565 2901
2902The chapter describes the Error/Warning reporting system of the algorithms in the Boolean Component.
2903
2904The errors and warnings are collected in the instance of the class *Message_Report* maintained as a field by common base class of Boolean operation algorithms *BOPAlgo_Options*.
2905
2906The error is reported in for problems which cannot be treated and cause the algorithm to fail.
2907In this case the result of the operation will be incorrect or incomplete or there will be no result at all.
2908
2909The warnings are reported for the problems which can be potentially handled or ignored and thus do not cause the algorithms to stop their work (but probably affect the result).
2910
2911All possible errors and warnings that can be set by the algorithm are listed in its header file.
2912The complete list of errors and warnings that can be generated by Boolean operations is defined in *BOPAlgo_Alerts.hxx*.
2913
2914Use method *HasErrors()* to check for presence of error; method *HasError()* can be used to check for particular error.
2915Methods *DumpErrors()* outputs textual description of collected errors into the stream.
2916Similar methods *HasWarnings()*, *HasWarning()*, and *DumpWarnings()* are provided for warnings.
2917
2918Note that messages corresponding to errors and warnings are defined in resource file *BOPAlgo.msg*.
2919These messages can be localized; for that put translated version to separate file and load it in the application by call to *Message_MsgFile::Load()* .
2920
2921Here is the example of how to use this system:
2922~~~~~
2923BOPAlgo_PaveFiller aPF;
2924aPF.SetArguments(...);
2925aPF.Perform();
2926if (aPF.HasErrors()) {
2927 aPF.DumpErrors(std::cerr);
2928 //
2929 if (aPF.HasError(STANDARD_TYPE(BOPAlgo_AlertNullInputShapes)) {
2930 // some actions
2931 }
2932 if (aPF.HasWarning(STANDARD_TYPE(BOPAlgo_AlertTooSmallEdge)) {
2933 // some actions
2934 }
2935 ...
2936}
2937~~~~~
2938
2939DRAW commands executing Boolean operations output errors and warnings generated by these operations in textual form.
2940Additional option allows saving shapes for which warnings have been generated, as DRAW variables.
2941To activate this option, run command *bdrawwarnshapes* with argument 1 (or with 0 to deactivate):
2942~~~~
2943bdrawwarnshapes 1
2944~~~~
2945
2946After setting this option and running an algorithm the result will look as follows:
2947~~~~
2948Warning: The interfering vertices of the same argument: ws_1_1 ws_1_2
2949Warning: The positioning of the shapes leads to creation of small edges without valid range: ws_2_1
2950~~~~
2951
483ce1bd 2952
6b6d06fa 2953@section specification__boolean_history History Information
803a8caf 2954
4f7d41ea 2955All operations in Boolean Component support @ref occt_modalg_hist "History information". This chapter describes how the History is filled for these operations.
803a8caf 2956
4f7d41ea 2957Additionally to Vertices, Edges and Faces the history is also available for the Solids.
803a8caf 2958
4f7d41ea 2959The rules for filling the History information about Deleted and Modified shapes are the same as for the API algorithms.
803a8caf 2960
4f7d41ea 2961Only the rules for Generated shapes require clarification.
2962In terms of the algorithms in Boolean Component the shape from the arguments can have Generated shapes only if these new shapes
2963have been obtained as a result of pure intersection (not overlapping) of this shape with any other shapes from arguments. Thus, the Generated shapes are always:
2964* VERTICES created from the intersection points and may be Generated from edges and faces only;
2965* EDGES created from the intersection edges and may be Generated from faces only.
803a8caf 2966
4f7d41ea 2967So, only EDGES and FACES could have information about Generated shapes. For all other types of shapes the list of Generated shapes will be empty.
2968
6b6d06fa 2969@subsection specification__boolean_history_ex Examples
803a8caf 2970
4f7d41ea 2971Here are some examples illustrating the History information.
803a8caf 2972
6b6d06fa 2973@subsubsection specification__boolean_history_ex_del Deleted shapes
4f7d41ea 2974
2975The result of CUT operation of two overlapping planar faces (see the example below) does not contain any parts from the tool face. Thus, the tool face is considered as Deleted.
2976If the faces are not fully coinciding, the result must contain some parts of the object face. In this case object face will be considered as not deleted.
2977But if the faces are fully coinciding, the result must be empty, and both faces will be considered as Deleted.
803a8caf 2978
2979Example of the overlapping faces:
2980
2981~~~~
2982plane p 0 0 0 0 0 1
2983mkface f1 p -10 10 -10 10
2984mkface f2 p 0 20 -10 10
2985
2986bclearobjects
2987bcleartools
2988baddobjects f1
2989baddtools f2
2990bfillds
2991bbop r 2
2992
4f7d41ea 2993savehistory cut_hist
2994isdeleted cut_hist f1
803a8caf 2995# Not deleted
2996
4f7d41ea 2997isdeleted cut_hist f2
803a8caf 2998# Deleted
2999~~~~
3000
6b6d06fa 3001@subsubsection specification__boolean_history_ex_modif Modified shapes
803a8caf 3002
4f7d41ea 3003In the FUSE operation of two edges intersecting in one point (see the example below), both edges will be split by the intersection point. All these splits will be contained in the result.
803a8caf 3004Thus, each of the input edges will be Modified into its two splits.
3005But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes.
3006
803a8caf 3007Example of the intersecting edges:
803a8caf 3008~~~~
3009line l1 0 0 0 1 0 0
3010mkedge e1 l1 -10 10
3011
3012line l2 0 0 0 0 1 0
3013mkedge e2 l2 -10 10
3014
3015bclearobjects
3016bcleartools
3017baddobjects e1
3018baddtools e2
3019bfillds
3020
3021# fuse operation
3022bbop r 1
3023
4f7d41ea 3024savehistory fuse_hist
3025
3026modified m1 fuse_hist e1
803a8caf 3027nbshapes m1
3028# EDGES: 2
3029
4f7d41ea 3030modified m2 fuse_hist e2
803a8caf 3031nbshapes m2
3032# EDGES: 2
3033
3034# cut operation
3035bbop r 2
3036
4f7d41ea 3037savehistory cut_hist
3038
3039modified m1 cut_hist e1
803a8caf 3040nbshapes m1
3041# EDGES: 2
3042
4f7d41ea 3043modified m2 cut_hist e2
803a8caf 3044# The shape has not been modified
803a8caf 3045~~~~
3046
3047
6b6d06fa 3048@subsubsection specification__boolean_history_gen Generated shapes
803a8caf 3049
14deaf42 3050Two intersecting edges will both have the intersection vertices Generated from them.
803a8caf 3051
4f7d41ea 3052As for the operation with intersecting faces, consider the following example:
803a8caf 3053
3054~~~~
3055plane p1 0 0 0 0 0 1
3056mkface f1 p1 -10 10 -10 10
3057
3058plane p2 0 0 0 1 0 0
3059mkface f2 p2 -10 10 -10 10
3060
3061bclearobjects
3062bcleartools
3063baddobjects f1
3064baddtools f2
3065bfillds
3066
3067# fuse operation
3068bbop r 1
3069
4f7d41ea 3070savehistory fuse_hist
3071
3072generated gf1 fuse_hist f1
803a8caf 3073nbshapes gf1
3074# EDGES: 1
3075
4f7d41ea 3076generated gf2 fuse_hist f2
803a8caf 3077nbshapes gf2
3078# EDGES: 1
3079
3080
3081# common operation - result is empty
3082bbop r 0
3083
4f7d41ea 3084savehistory com_hist
3085
3086generated gf1 com_hist f1
803a8caf 3087# No shapes were generated from the shape
3088
4f7d41ea 3089generated gf2 com_hist f2
803a8caf 3090# No shapes were generated from the shape
3091
3092~~~~
3093
6b6d06fa 3094@section specification__boolean_simplification BOP result simplification
948fe6ca 3095
3096The API algorithms implementing Boolean Operations provide possibility to simplify the result shape by unification of the connected tangential edges and faces.
3097This simplification is performed by the method *SimplifyResult* which is implemented in the class *BRepAlgoAPI_BuilderAlgo* (General Fuse operation).
3098It makes it available for users of the classes *BRepAlgoAPI_BooleanOperation* (all Boolean Operations) and *BRepAlgoAPI_Splitter* (split operation).
3099
3100The simplification is performed by the means of *ShapeUpgrade_UnifySameDom* algorithm. The result of operation is overwritten with the simplified result.
3101
3102The simplification is performed without creation of the Internal shapes, i.e. shapes connections will never be broken. It is performed on the whole result shape.
3103Thus, if the input shapes contained connected tangent edges or faces unmodified during the operation they will also be unified.
3104
3105History of the simplification is merged into the main history of operation, thus it will be accounted when asking for Modified, Generated and Deleted shapes.
3106
3107Some options of the main operation are passed into the Unifier:
3108- Fuzzy tolerance of the operation is given to the Unifier as the linear tolerance.
3109- Non destructive mode here controls the safe input mode in Unifier.
3110
07f2b741 3111For controlling this possibility in DRAW the command **bsimplify** has been implemented. See the @ref occt_draw_bop_options "Boolean Operations options" chapter in draw user guide.
948fe6ca 3112
3113
6b6d06fa 3114@subsection specification__boolean_simplification_examples Examples
948fe6ca 3115
3116Here is the simple example of simplification of the result of Fuse operation of two boxes:
3117
3118~~~~
3119bsimplify -f 1
3120
3121box b1 10 10 15
3122box b2 3 7 0 10 10 15
3123bclearobjects
3124bcleartools
3125baddobjects b1
3126baddtools b2
3127bfillds
3128bapibop r 1
3129~~~~
3130
3131<table align="center">
3132 <tr>
6b6d06fa 3133 <td>@figure{/specification/boolean_operations/images/bop_simple_001.png, "Not simplified result", 420}</td>
3134 <td>@figure{/specification/boolean_operations/images/bop_simple_002.png, "Simplified result", 420}</td>
948fe6ca 3135 </tr>
3136</table>
3137
803a8caf 3138
6b6d06fa 3139@section specification__boolean_11b Usage
e9e33e91 3140
3141The chapter contains some examples of the OCCT Boolean Component usage. The usage is possible on two levels: C++ and Tcl.
3142
6b6d06fa 3143@subsection specification__boolean_11b_1 Package BRepAlgoAPI
e9e33e91 3144
3145The package *BRepAlgoAPI* provides the Application Programming Interface of the Boolean Component.
3146
3147The package consists of the following classes:
3f812249 3148* *BRepAlgoAPI_Algo* -- the root class that provides the interface for algorithms.
3149* *BRepAlgoAPI_BuilderAlgo* -- the class API level of General Fuse algorithm.
aeee70d3 3150* *BRepAlgoAPI_Splitter* -- the class API level of the Splitter algorithm.
3f812249 3151* *BRepAlgoAPI_BooleanOperation* -- the root class for the classes *BRepAlgoAPI_Fuse*. *BRepAlgoAPI_Common*, *BRepAlgoAPI_Cut* and *BRepAlgoAPI_Section*.
3152* *BRepAlgoAPI_Fuse* -- the class provides Boolean fusion operation.
3153* *BRepAlgoAPI_Common* -- the class provides Boolean common operation.
3154* *BRepAlgoAPI_Cut* -- the class provides Boolean cut operation.
3155* *BRepAlgoAPI_Section* -- the class provides Boolean section operation.
e9e33e91 3156
6b6d06fa 3157@figure{/specification/boolean_operations/images/operations_image065.png,"Diagram of BRepAlgoAPI package",420}
e9e33e91 3158
1511c7e9 3159The detailed description of the classes can be found in the corresponding .hxx files. The examples are below in this chapter.
e9e33e91 3160
6b6d06fa 3161@subsection specification__boolean_11b_2 Package BOPTest
e9e33e91 3162The package *BOPTest* provides the usage of the Boolean Component on Tcl level. The method *BOPTest::APICommands* contains corresponding Tcl commands:
3163
3f812249 3164* *bapibuild* -- for General Fuse Operator;
aeee70d3 3165* *bapisplit* -- for Splitter Operator;
3f812249 3166* *bapibop* -- for Boolean Operator and Section Operator.
e9e33e91 3167
3168The examples of how to use the commands are below in this chapter.
3169
6b6d06fa 3170@subsubsection specification__boolean_11b_2_1 Case 1. General Fuse operation
e9e33e91 3171
3172The following example illustrates how to use General Fuse operator:
3173
3174#### C++ Level
3175
3176~~~~
3177#include <TopoDS_Shape.hxx>
3178#include <TopTools_ListOfShape.hxx>
3179#include <BRepAlgoAPI_BuilderAlgo.hxx>
3180 {…
e9e33e91 3181 BRepAlgoAPI_BuilderAlgo aBuilder;
3182 //
3183 // prepare the arguments
3184 TopTools_ListOfShape& aLS=…;
3185 //
e9e33e91 3186 // set the arguments
3187 aBuilder.SetArguments(aLS);
944768d2 3188
3189 // Set options for the algorithm
3190 // setting options on this level is similar to setting options to GF algorithm on low level (see "GF Usage" chapter)
3191 ...
3192
e9e33e91 3193 // run the algorithm
3194 aBuilder.Build();
a743814b 3195 if (aBuilder.HasErrors()) {
e9e33e91 3196 // an error treatment
3197 return;
3198 }
3199 //
3200 // result of the operation aR
3201 const TopoDS_Shape& aR=aBuilder.Shape();
3202
3203}
3204~~~~
3205
3206#### Tcl Level
3207
3208~~~~
3209# prepare the arguments
3210box b1 10 10 10
3211box b2 3 4 5 10 10 10
3212box b3 5 6 7 10 10 10
3213#
3214# clear inner contents
3215bclearobjects; bcleartools;
3216#
3217# set the arguments
3218baddobjects b1 b2 b3
944768d2 3219
3220# set options for the algorithm (see "GF Usage" chapter)
3221...
3222
e9e33e91 3223# run the algorithm
3224# r is the result of the operation
3225bapibuild r
3226~~~~
3227
6b6d06fa 3228@subsubsection specification__boolean_11b_2_2 Case 2. Splitting operation
c58055ad 3229
aeee70d3 3230The following example illustrates how to use the Splitter operator:
c58055ad 3231
3232#### C++ Level
3233
3234~~~~
3235#include <TopoDS_Shape.hxx>
3236#include <TopTools_ListOfShape.hxx>
3237#include <BRepAlgoAPI_Splitter.hxx>
3238//
3239BRepAlgoAPI_BuilderAlgo aSplitter;
3240//
3241// prepare the arguments
3242// objects
3243TopTools_ListOfShape& aLSObjects = … ;
3244// tools
3245TopTools_ListOfShape& aLSTools = … ;
3246//
3247// set the arguments
3248aSplitter.SetArguments(aLSObjects);
3249aSplitter.SetTools(aLSTools);
3250//
944768d2 3251// Set options for the algorithm
3252// setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
3253...
c58055ad 3254//
3255// run the algorithm
3256aSplitter.Build();
3257// check error status
a743814b 3258if (aSplitter.HasErrors()) {
c58055ad 3259 return;
3260}
3261//
3262// result of the operation aResult
3263const TopoDS_Shape& aResult = aSplitter.Shape();
3264~~~~
3265
3266#### Tcl Level
3267
3268~~~~
3269# prepare the arguments
3270# objects
3271box b1 10 10 10
3272box b2 7 0 0 10 10 10
3273
3274# tools
3275plane p 10 5 5 0 1 0
3276mkface f p -20 20 -20 20
3277#
3278# clear inner contents
3279bclearobjects; bcleartools;
3280#
3281# set the objects
3282baddobjects b1 b2
3283# set the tools
3284baddtools f
3285#
944768d2 3286# set options for the algorithm (see "GF Usage" chapter)
3287...
c58055ad 3288#
3289# run the algorithm
3290# r is the result of the operation
3291bapisplit r
3292~~~~
3293
6b6d06fa 3294@subsubsection specification__boolean_11b_2_3 Case 3. Common operation
e9e33e91 3295
3296The following example illustrates how to use Common operation:
3297
3298#### C++ Level
3299
3300~~~~
3301#include <TopoDS_Shape.hxx>
3302#include <TopTools_ListOfShape.hxx>
3303#include < BRepAlgoAPI_Common.hxx>
3304 {…
3305 Standard_Boolean bRunParallel;
e9e33e91 3306 Standard_Real aFuzzyValue;
3307 BRepAlgoAPI_Common aBuilder;
3308
3309 // perpare the arguments
3310 TopTools_ListOfShape& aLS=…;
3311 TopTools_ListOfShape& aLT=…;
3312 //
3313 bRunParallel=Standard_True;
3314 aFuzzyValue=2.1e-5;
3315 //
3316 // set the arguments
3317 aBuilder.SetArguments(aLS);
3318 aBuilder.SetTools(aLT);
3319 //
944768d2 3320 // Set options for the algorithm
3321 // setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
3322 ...
c58055ad 3323 //
e9e33e91 3324 // run the algorithm
3325 aBuilder.Build();
a743814b 3326 if (aBuilder.HasErrors()) {
e9e33e91 3327 // an error treatment
3328 return;
3329 }
3330 //
3331 // result of the operation aR
3332 const TopoDS_Shape& aR=aBuilder.Shape();
3333
3334}
3335~~~~
3336
3337#### Tcl Level
3338
3339~~~~
3340# prepare the arguments
3341box b1 10 10 10
3342box b2 7 0 4 10 10 10
3343box b3 14 0 0 10 10 10
3344#
3345# clear inner contents
3346bclearobjects; bcleartools;
3347#
3348# set the arguments
3349baddobjects b1 b3
3350baddtools b2
3351#
944768d2 3352# set options for the algorithm (see "GF Usage" chapter)
3353...
c58055ad 3354#
e9e33e91 3355# run the algorithm
3356# r is the result of the operation
3357# 0 means Common operation
3358bapibop r 0
3359~~~~
3360
6b6d06fa 3361@subsubsection specification__boolean_11b_2_4 Case 4. Fuse operation
e9e33e91 3362
3363The following example illustrates how to use Fuse operation:
3364
3365#### C++ Level
3366
3367~~~~
3368#include <TopoDS_Shape.hxx>
3369#include <TopTools_ListOfShape.hxx>
3370#include < BRepAlgoAPI_Fuse.hxx>
3371 {…
3372 Standard_Boolean bRunParallel;
e9e33e91 3373 Standard_Real aFuzzyValue;
3374 BRepAlgoAPI_Fuse aBuilder;
3375
3376 // perpare the arguments
3377 TopTools_ListOfShape& aLS=…;
3378 TopTools_ListOfShape& aLT=…;
3379 //
3380 bRunParallel=Standard_True;
3381 aFuzzyValue=2.1e-5;
3382 //
3383 // set the arguments
3384 aBuilder.SetArguments(aLS);
3385 aBuilder.SetTools(aLT);
3386 //
944768d2 3387 // Set options for the algorithm
3388 // setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
3389 ...
c58055ad 3390 //
e9e33e91 3391 // run the algorithm
3392 aBuilder.Build();
a743814b 3393 if (aBuilder.HasErrors()) {
e9e33e91 3394 // an error treatment
3395 return;
3396 }
3397 //
3398 // result of the operation aR
3399 const TopoDS_Shape& aR=aBuilder.Shape();
3400
3401}
3402~~~~
3403
3404#### Tcl Level
1a457208 3405
e9e33e91 3406~~~~
3407# prepare the arguments
3408box b1 10 10 10
3409box b2 7 0 4 10 10 10
3410box b3 14 0 0 10 10 10
3411#
3412# clear inner contents
3413bclearobjects; bcleartools;
3414#
3415# set the arguments
3416baddobjects b1 b3
3417baddtools b2
3418#
944768d2 3419# set options for the algorithm (see "GF Usage" chapter)
3420...
c58055ad 3421#
e9e33e91 3422# run the algorithm
3423# r is the result of the operation
3424# 1 means Fuse operation
3425bapibop r 1
3426~~~~
1a457208 3427
6b6d06fa 3428@subsubsection specification__boolean_11b_2_5 Case 5. Cut operation
1a457208 3429
e9e33e91 3430The following example illustrates how to use Cut operation:
1a457208 3431
e9e33e91 3432#### C++ Level
3433
3434~~~~
3435#include <TopoDS_Shape.hxx>
3436#include <TopTools_ListOfShape.hxx>
3437#include < BRepAlgoAPI_Cut.hxx>
3438 {…
3439 Standard_Boolean bRunParallel;
e9e33e91 3440 Standard_Real aFuzzyValue;
3441 BRepAlgoAPI_Cut aBuilder;
3442
3443 // perpare the arguments
3444 TopTools_ListOfShape& aLS=…;
3445 TopTools_ListOfShape& aLT=…;
3446 //
3447 bRunParallel=Standard_True;
3448 aFuzzyValue=2.1e-5;
3449 //
3450 // set the arguments
3451 aBuilder.SetArguments(aLS);
3452 aBuilder.SetTools(aLT);
3453 //
944768d2 3454 // Set options for the algorithm
3455 // setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
3456 ...
c58055ad 3457 //
e9e33e91 3458 // run the algorithm
3459 aBuilder.Build();
a743814b 3460 if (aBuilder.HasErrors()) {
e9e33e91 3461 // an error treatment
3462 return;
3463 }
3464 //
3465 // result of the operation aR
3466 const TopoDS_Shape& aR=aBuilder.Shape();
3467
3468}
3469~~~~
1a457208 3470
e9e33e91 3471#### Tcl Level
1a457208 3472
e9e33e91 3473~~~~
3474# prepare the arguments
3475box b1 10 10 10
3476box b2 7 0 4 10 10 10
3477box b3 14 0 0 10 10 10
3478#
3479# clear inner contents
3480bclearobjects; bcleartools;
3481#
3482# set the arguments
3483baddobjects b1 b3
3484baddtools b2
3485#
944768d2 3486# set options for the algorithm (see "GF Usage" chapter)
3487...
c58055ad 3488#
e9e33e91 3489# run the algorithm
3490# r is the result of the operation
3491# 2 means Cut operation
3492bapibop r 2
3493~~~~
1a457208 3494
3495
6b6d06fa 3496@subsubsection specification__boolean_11b_2_6 Case 6. Section operation
1a457208 3497
e9e33e91 3498The following example illustrates how to use Section operation:
1a457208 3499
e9e33e91 3500#### C++ Level
1a457208 3501
e9e33e91 3502~~~~
3503#include <TopoDS_Shape.hxx>
3504#include <TopTools_ListOfShape.hxx>
3505#include < BRepAlgoAPI_Section.hxx>
3506 {…
3507 Standard_Boolean bRunParallel;
e9e33e91 3508 Standard_Real aFuzzyValue;
3509 BRepAlgoAPI_Section aBuilder;
3510
3511 // perpare the arguments
3512 TopTools_ListOfShape& aLS=…;
3513 TopTools_ListOfShape& aLT=…;
3514 //
3515 bRunParallel=Standard_True;
3516 aFuzzyValue=2.1e-5;
3517 //
3518 // set the arguments
3519 aBuilder.SetArguments(aLS);
3520 aBuilder.SetTools(aLT);
3521 //
944768d2 3522 // Set options for the algorithm
3523 // setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter)
3524 ...
c58055ad 3525 //
e9e33e91 3526 // run the algorithm
3527 aBuilder.Build();
a743814b 3528 if (aBuilder.HasErrors()) {
e9e33e91 3529 // an error treatment
3530 return;
3531 }
3532 //
3533 // result of the operation aR
3534 const TopoDS_Shape& aR=aBuilder.Shape();
3535
3536}
3537~~~~
3538
3539#### Tcl Level
3540
3541~~~~
3542# prepare the arguments
3543box b1 10 10 10
3544box b2 3 4 5 10 10 10
3545box b3 5 6 7 10 10 10
3546#
3547# clear inner contents
3548bclearobjects; bcleartools;
3549#
3550# set the arguments
3551baddobjects b1 b3
3552baddtools b2
3553#
944768d2 3554# set options for the algorithm (see "GF Usage" chapter)
3555...
c58055ad 3556#
e9e33e91 3557# run the algorithm
3558# r is the result of the operation
3559# 4 means Section operation
3560bapibop r 4
3561~~~~
d6b4d3d0 3562
0a6d9742 3563