0023640: Documentation for local sewing with BRepBuilderAPI_Sewing is missing
[occt.git] / dox / user_guides / boolean_operations / boolean_operations.md
1 Boolean Operations {#occt_user_guides__boolean_operations}
2 =========================
3
4 @tableofcontents
5
6 @section occt_algorithms_1 Introduction
7
8 This document provides comprehensive description of the Boolean Operation Algorithm (BOA) as implemented in Open CASCADE Technology. 
9 Boolean Operation Algorithm is based on General Fuse Algorithm (GFA) which is also described by this document.
10 General Fuse Algorithm is also a basis of the Partition Algorithm (PA) implemented in SALOME and described in SALOME documentation.
11
12 General Fuse Algorithm has a history-based architecture designed to allow using OCAF naming functionality.
13 The architecture of General Fuse Algorithm is expandable, that allows creating new algorithms basing on it.
14
15 @section occt_algorithms_1_1 Difference between Old and New Boolean Operations
16
17 In OCCT there exist two libraries providing Boolean Operations: 
18   * Old Boolean Operations (BOA) provided by <i>BRepAlgo</i> package designed and developed in Open CASCADE 6x in 2000; its architecture and content are out of date.
19   * New Boolean Operations (NBOA) provided by <i>BRepAlgoAPI</i> package designed and developed in 2001 and completely revised in 2013.
20
21 New Boolean Operations provide the following major benefits:
22
23   * The NBOA have an expandable architecture of inner sub-algorithms, which  allows to create specific algorithms for the Customers using existing inner sub-algorithms as root algorithms and to reduce the time for the development. 
24   * The architecture of inner sub-algorithms of NBOA provides their reusability with maximal independence from the environment of NBOA. The fact allows to create specific algorithms for the Customers using these sub-algorithms as they are or as root classes and thus to reduce the time for the development. 
25   * The architecture of NBOA is history-based. The implementation of NBOA internally sets up a correspondence between any sub-shape of the argument and its image in the result. The history is not imposed and thus it is not error-prone as it was in BOA. The fact allows direct and safely usage of the algorithm in parametric modeling.   
26   * NBOA provide a general algorithm. It correctly processes without using the workarounds even the cases that cannot be properly processed by BOA.
27   * The implementation of NBOA is based on NCollection classes. The usage of opportunities given by local memory allocators ( <i> NCollection_IncAllocator</i>) allows improving memory management and saving memory resources. 
28   * NBOA use modern algorithms of OCC as auxiliary tools. For e.g. the algorithm of unbalanced binary tree of overlapped bounding boxes <i> NCollection_UBTree</i>. The usage of the algorithm allows to improve the performance of NBOA if there is a big number of sub-shapes in the arguments.
29
30   
31 @section occt_algorithms_2 Overview 
32
33 @subsection occt_algorithms_2_1 Operators
34
35 @subsubsection occt_algorithms_2_1_1 Boolean operator
36
37 The Boolean operator provides the operations (Common, Fuse, Cut) between two arguments in terms of *TopoDS_Shape*.
38
39 The operator can be represented as:
40
41 <i>R<sub>B</sub>=B<sub>j</sub> (S<sub>1</sub>, S<sub>2</sub>),</i>      
42
43 where:
44 * *B<sub>j</sub>* - operation of type j (Common, Fuse, Cut),
45 * *R<sub>B</sub>* - result of the operation,
46 * *S<sub>1</sub>* and *S<sub>2</sub>* - arguments of the operation.
47
48 @subsubsection occt_algorithms_2_1_2 General Fuse operator
49
50 The General fuse operator can be applied to an arbitrary number of arguments in terms of *TopoDS_Shape*.
51
52 The GFA operator can be represented as:
53
54 <i>R<sub>GF</sub> = GF (S<sub>1</sub>, S<sub>2</sub> ... S<sub>n</sub>), </i>   
55
56 where
57 * *R<sub>GF</sub>* - result of the operation,
58 * *S<sub>1</sub>, S<sub>2</sub> ... S<sub>n</sub>* - arguments of the operation,
59 * *n* - number of arguments.
60
61 The result of the Boolean operator, *R<sub>B</sub>*, can be obtained from *R<sub>GF</sub>*.
62
63 For example, for two arguments *S<sub>1</sub>* and *S<sub>2</sub>* the result *R<sub>GF</sub>* is
64
65 <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>   
66
67 @figure{/user_guides/boolean_operations/images/operations_image001.svg,  "Operators"}
68
69 This Figure shows that 
70 * <i>B<sub>common</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p12</sub>;</i>
71 * <i>B<sub>cut12</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub>;</i>
72 * <i>B<sub>cut21</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p2</sub>;</i>
73 * <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>= R<sub>p</sub>;</i>
74
75 <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>
76
77 The 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.
78
79 @subsubsection occt_algorithms_2_1_3 Partition operator 
80
81 The Partition operator can be applied to an arbitrary number of arguments in terms of *TopoDS_Shape*. The arguments are divided on two groups: Objects, Tools. The result of PA contains all parts belonging to the Objects but does not contain the parts that belongs to the Tools only.
82
83 The PA operator can be represented as follows:
84
85 <i>R<sub>P</sub>=PA (S<sub>1o</sub>, S<sub>2o</sub> … S<sub>no</sub>, S<sub>1T</sub>, S<sub>2T</sub> … S<sub>nT</sub>),</i>
86 where:
87 * <i>R<sub>P</sub></i> - is the result of the operation; 
88 * <i>S<sub>1O</sub>, S<sub>2O</sub> … S<sub>nO</sub></i> - Arguments of the operation [Objects];
89 * <i>S<sub>1T</sub>, S<sub>2T</sub> … S<sub>nT</sub></i> - Arguments of the operation [Tools];
90 * *nO* - Number of arguments [Objects];
91 * *nT* - Number of arguments [Tools].
92
93 The result *R<sub>P</sub>* can be obtained from *R<sub>GF</sub>* .
94
95 For example, for two arguments *S<sub>1O</sub>* and  *S<sub>2T</sub>* the result *R<sub>P</sub>* is
96
97 <i>R<sub>P</sub>=PA(S<sub>1O</sub>,S<sub>2T</sub>)=S<sub>p1</sub>+S<sub>p12</sub>.</i>      
98
99 In case when all arguments of the PA are Objects (no Tools), the result of PA is equivalent to the result of GFA. 
100
101 For example, for two arguments *S<sub>1O</sub>* and *S<sub>2O</sub>* the result *R<sub>P</sub>* is
102
103 <i>R<sub>P</sub>=PA(S<sub>1O</sub>, S<sub>2O</sub>) = S<sub>p1</sub> + S<sub>p2</sub> + S<sub>p12</sub> = GF (S<sub>1</sub>, S<sub>2</sub>)</i>
104
105 The fact that the *R<sub>GF</sub>* contains the components of *R<sub>P</sub>* allows considering GFA as the general case of PA. Thus, it is possible to implement PA as a subclass of GFA.
106
107 @subsection occt_algorithms_2_2 Parts of algorithms 
108
109 GFA, BOA and PA 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.
110
111 GFA, BOA and PA consist of two main parts:
112 *       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.
113 *       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.
114
115 As it follows from the definition of *R<sub>GF</sub>* and *R<sub>P</sub>* the main differences between GFA, BOA and PA are in the Building Part. The Intersection Part is the same for the algorithms.
116
117 @section occt_algorithms_3 Terms and Definitions
118
119 This chapter provides the background terms and definitions that are necessary to understand how the algorithms work. 
120
121 @subsection occt_algorithms_3_1 Interferences
122
123 Each shape having a boundary representation (vertex, edge, face) contains an internal value of geometrical tolerance. The shapes interferes between each other in terms of theirs tolerances.
124
125 The shapes are interfered 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. For the three types of shapes (vertex, edge, face) there are six types of interferences. 
126
127 @subsubsection occt_algorithms_3_1_1 Vertex/Vertex interference
128
129 Two vertices *Vi* and *Vj* have the distance between corresponding 3D points that is less then sum of the tolerances *Tol(Vi)* and *Tol(Vj)* of the vertices.
130
131 @figure{/user_guides/boolean_operations/images/operations_image002.svg,  "Vertex/vertex interference"}
132
133
134
135 The result is a new vertex Vn with 3D point Pn and tolerance value Tol(Vn) that are computed by the formulas:
136
137 ~~~~~
138 Pn = 0.5 * (Pi + Pj)
139 Tol(Vn) = max (Tol(Vi), Tol(Vj)) + 0.5 * D
140 ~~~~~
141
142 where <i>D = distance (Pi, Pj)</i>
143
144 @subsubsection occt_algorithms_3_1_2    Vertex/Edge interference
145
146 For a vertex *Vi* and an edge *Ej* the distance *D* between 3D point of the vertex and its projection on the 3D curve of the edge *Ej* is less or equal than sum of tolerances of the vertex *Tol(Vi)* and the edge *Tol(Ej)*.
147
148 @figure{/user_guides/boolean_operations/images/operations_image003.svg,  "Vertex/edge interference"}
149
150
151 The result is vertex *Vi* with the corresponding tolerance value
152 ~~~~~
153 Tol(Vi) = max (Tol(Vi), Tol(Ej)) + 0.5 • D
154 ~~~~~
155 where <i>D = distance (Pi, PPi)</i>;
156
157 and parameter *t<sub>i</sub>* of the projected point *PPi* on 3D curve *Cj* of edge *Ej*.
158
159 @subsubsection occt_algorithms_3_1_3    Vertex/Face interference
160
161 For 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)*. 
162
163 @figure{/user_guides/boolean_operations/images/operations_image004.svg,  "Vertex/face interference"}
164
165 The result is vertex *Vi* with the corresponding tolerance value:
166 ~~~~~
167 Tol(Vi) = max (Tol(Vi), Tol(Ej)) + 0.5 • D
168 ~~~~~
169 where <i>D = distance (Pi, PPi)</i>
170
171 and parameters u<sub>i</sub>, v<sub>i</sub> of the projected point PPi on surface Sj of face Fj.
172
173 @subsubsection occt_algorithms_3_1_4    Edge/Edge interference
174
175 For 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. 
176
177 Let us examine two cases:
178
179 In  the first case two edges have one or several common parts of 3D curves in terms of tolerance.
180
181 @figure{/user_guides/boolean_operations/images/operations_image005.svg,  "Edge/edge interference: common parts"}
182
183 The results are: 
184 * Parametric range <i>[t<sub>i1</sub>, t<sub>i2</sub> ]</i> for 3D curve *Ci* of edge *Ei*.
185 * Parametric range <i>[t<sub>j1</sub>, t<sub>j2</sub> ]</i> for 3D curve *Cj* of edge *Ej*. 
186
187 In the second case two edges have one or several common points in terms of tolerance.
188
189 @image html /user_guides/boolean_operations/images/operations_image006.svg  "Edge/edge interference: common points"
190 @image latex /user_guides/boolean_operations/images/operations_image006.svg  "Edge/edge interference: common points"
191
192 The results are as follows:
193
194 * one or several new vertices *Vn* with 3D point *Pn* and tolerance value *Tol(Vn)* that are calculated by the formulas:
195   @code 
196   Pn = 0.5 • (Pi + Pj) 
197   Tol(Vn) = max (Tol(Ei), Tol(Ej)) + 0.5 • D 
198   @endcode
199   where:
200   * <i>D = distance (Pi, Pj)</i>
201   * *Pi* and *Pj* are the nearest 3D points for curves *Ci* and *Cj*.
202
203 * Parameter *t<sub>i</sub>* of *Pi* for the 3D curve *Ci*.
204 * Parameter *t<sub>j</sub>* of *Pj* for the 3D curve *Cj*.
205
206 @subsubsection occt_algorithms_3_1_5    Edge/Face interference
207
208 For 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*.
209
210 Let us examine two cases:
211
212 In the first case Edge *Ei* and Face *Fj* have one or several common parts in terms of tolerance. 
213
214 @figure{/user_guides/boolean_operations/images/operations_image007.svg, "Edge/face interference: common parts"}
215
216 The result is a parametric range <i>[t<sub>i1</sub>, t<sub>i2</sub>]</i> for the 3D curve *Ci* of the edge *Ei*.
217
218 In the second case Edge *Ei* and Face *Fj* have one or several common points in terms of tolerance.
219
220 @figure{/user_guides/boolean_operations/images/operations_image008.svg,  "Edge/face interference: common points"}
221
222 The results are as follows:
223 * one or several new vertices *Vn* with 3D point *Pn* and tolerance value *Tol(Vn)* that are calculated by the formulas @code Pn = 0.5 • (Pi + Pj) @endcode and @code  Tol(Vn) = max (Tol(Ei), Tol(Fj)) + 0.5 • D @endcode  where:
224         * <i>D = distance (Pi, Pj)</i>,
225         * *Pi* and *Pj* are nearest 3D points for the curve *Ci* and surface *Sj*.
226
227 *       Parameter *t<sub>i</sub>* of *Pi* for the 3D curve *Ci*.
228 *       Parameters *u<sub>i</sub>* and *v<sub>i</sub>* of the projected point *PPi* on the surface *Sj* of the face *Fj*.
229
230 @subsubsection occt_algorithms_3_1_6    Face/Face Interference
231
232 For 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.
233
234 In the first case Face *Fi* and face *Fj* have one or several common curves <i>C<sub>ijk</sub> (k = 0, 1, 2…k<sub>N</sub>)</i> in terms of tolerance.
235
236 @figure{/user_guides/boolean_operations/images/operations_image009.svg,  "Face/face interference: common curves"}
237
238 The result is an intersection of 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>)*.
239
240 In the second case Face *Fi* and face *Fj* have one or several common points in terms of tolerance 
241
242 @figure{/user_guides/boolean_operations/images/operations_image010.svg, "Face/face interference: common points"}
243
244 The results are as follows:
245
246 * one or several new vertices *V<sub>ijm</sub>* with 3D point *Pn* and tolerance value *Tol(Vn)* that are calculated by the formulas @code      Pn = 0.5 • (Pi + Pj) @endcode and @code Tol(Vijm) = max (Tol(Fi), Tol(Fj)) + 0.5 • D @endcode       where:
247         * <i>D = distance (Pi, Pj)</i>,
248         * *Pi* and *Pj* are nearest 3D points for surfaces *Si* and *Sj*.
249
250 * Parameters *u<sub>j</sub>*, *v<sub>j</sub>* of the projected point *PPj* on surface *Sj* of face *Fj*;
251 * Parameters *u<sub>i</sub>* and *v<sub>i</sub>* of the projected point *PPi* on surface *Si* of face *Fi*. 
252
253 @subsubsection occt_algorithms_3_1_7 Computation Order
254
255 The interferences between shapes are computed on the basis of increasing of the dimension value of the shape in the following order: 
256 * Vertex/Vertex, 
257 * Vertex/Edge, 
258 * Edge/Edge, 
259 * Vertex/Face, 
260 * Edge/Face, 
261 * Face/Face. 
262
263 This 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*.
264
265 @subsubsection occt_algorithms_3_1_8    Results
266
267 * The result of the interference is a shape that can be either interfered shape itself (or its part) or a new shape.
268 * 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.
269 * The result of the interference splits the source shapes on the parts each time as it can do that.
270
271 @subsection occt_algorithms_3_2 Paves
272
273 The 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.
274
275 The result of interferences of the type Face/Face in most cases is intersection curves, which go through some vertices lying on the faces.
276
277 The 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.
278 Pave *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.
279
280 @figure{/user_guides/boolean_operations/images/operations_image011.svg,  "Paves"}
281
282 Two paves *PV1* and *PV2* on the same curve *C* can be compared using the parameter value @code PV1 > PV2 if t1 > t2 @endcode  
283
284 The usage of paves allows binding of the vertex to the curve (or any structure that contains a curve: edge, intersection curve).
285
286
287 @subsection occt_algorithms_3_3 Pave Blocks
288
289 A 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*.
290
291 A pave block *PBi* is a part of the object (edge, intersection curve) between neighboring paves. 
292
293 @figure{/user_guides/boolean_operations/images/operations_image012.svg, "Pave Blocks"}
294
295 Any finite source edge *E* has at least one pave block that contains two paves *PVb* and *PVe*:
296 * Pave *PVb* corresponds to the vertex *Vb* with minimal parameter <i>t<sub>b</sub></i> on the curve of the edge.
297 * Pave *PVe* corresponds to the vertex *Ve* with maximal parameter <i>t<sub>e</sub></i> on the curve of the edge.
298
299 @subsection occt_algorithms_3_4 Shrunk Range
300
301 Pave block *PV* of curve *C* is bounded by vertices *V1* and *V2* with tolerance values *Tol(V1)* and *Tol(V2)*. Curve *C* has own value of tolerance *Tol(C)*:
302 * In case of edge, the value of this tolerance is tolerance of the edge.
303 * In case of intersection curve, the value of the tolerance is tolerance obtained from an intersection algorithm.
304
305 @figure{/user_guides/boolean_operations/images/operations_image013.svg, "Shrunk Range"}
306
307 The theoretical parametric range of the pave block is <i>[t1C, t2C]</i>.
308
309 The positions of the vertices *V1* and *V2* of the pave block can be different. The positions are determined by the following conditions:
310 ~~~~
311 Distance (P1, P1c) ≤ Tol(V1) + Tol(C)
312 Distance (P2, P2c) ≤ Tol(V2) + Tol(C)
313 ~~~~
314 The 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. 
315
316 The shrunk range of the pave block is the part of 3D curve that can interfere with other shapes.
317
318 @subsection occt_algorithms_3_5 Common Blocks
319
320 The interferences of the type Edge/Edge, Edge/Face produce results as common parts.
321
322 In case of Edge/Edge interference the common parts are pave blocks that have different base edges. 
323
324 @figure{/user_guides/boolean_operations/images/operations_image014.svg, "Common Blocks: Edge/Edge interference"}
325
326 If 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*.
327         
328
329 In case of Edge/Face interference the common parts are pave blocks lying on a face(s).
330
331 @figure{/user_guides/boolean_operations/images/operations_image015.svg, "Common Blocks: Edge/Face interference"}
332
333 If the pave blocks *PBi* geometrically coincide with a face *Fj*, the pave blocks form common block *CB*.
334
335 In general case a common block *CB* contains:
336 * Pave blocks *PBi (i=0,1,2, 3… NbPB)*.
337 * A set of faces *Fj (j=0,1... NbF), NbF* - number of faces.
338
339
340 @subsection occt_algorithms_3_6 FaceInfo
341
342 The structure *FaceInfo* contains the following information:
343 * Pave blocks that have state **In** for the face;
344 * Vertices that have state **In** for the face;
345 * Pave blocks that have state **On** for the face;
346 * Vertices that have state **On** for the face;
347 * Pave blocks built up from intersection curves for the face;
348 * Vertices built up from intersection points for the face.
349
350 @figure{/user_guides/boolean_operations/images/operations_image016.svg,  "Face Info"}
351
352 In the figure, for face *F1*:
353 * Pave blocks that have state **In** for the face: *PB<sub>in1</sub>*.
354 * Vertices that have state **In** for the face: *V<sub>in1</sub>*.
355 * 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>*.
356 * Vertices that have state **On** for the face: *V1, V2, V3, V4, V5, V6*.
357 * Pave blocks built up from intersection curves for the face: *PB<sub>sc1</sub>*.
358 * Vertices built up from intersection points for the face: none
359
360
361 @section occt_algorithms_4 Data Structure
362
363 Data Structure (DS) is used to:
364 * Store information about input data and intermediate results;
365 * Provide the access to the information;
366 * Provide the links between the chunks of information.
367
368 This information includes:
369 * Arguments;
370 * Shapes (and sub-shapes);
371 * Interferences;
372 * Pave Blocks;
373 * Common Blocks.
374
375 Data Structure is implemented in the class *BOPDS_DS*.
376
377 @subsection occt_algorithms_4_1 Arguments
378
379 The arguments are shapes (in terms of *TopoDS_Shape*):
380 * Number of arguments is unlimited.
381 * Each argument is a valid shape (in terms of *BRepCheck_Analyzer*).
382 * Each argument can be of one of the following types (see the Table):
383
384 | No    | Type  | Index of Type |
385 | :----- | :----- | :----- |
386 | 1     | COMPOUND      | 0 |
387 | 2     | COMPSOLID     | 1 |
388 | 3     | SOLID | 2 |
389 | 4     | SHELL | 3 |
390 | 5     | FACE  | 4 |
391 | 6     | WIRE  | 5 | 
392 | 7     | EDGE  | 6 | 
393 | 8     | VERTEX | 7 | 
394
395 * The argument of type *0 (COMPOUND)* can include any number of shapes of an arbitrary type (0, 1…7).
396 * 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.
397 * 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*). 
398
399 @subsection occt_algorithms_4_2 Shapes
400 The 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).
401 The structure *BOPDS_ShapeInfo* has the following contents:
402
403
404 | Name  | Contents |
405 | :-------- | :----- |
406 | *myShape* |   Shape itself |
407 | *myType* |    Type of shape |
408 | *myBox* |     3D bounding box of the shape |
409 | *mySubShapes* | List of DS indices of sub-shapes |
410 | *myReference* | Storage for some auxiliary information |
411 | *myFlag* | Storage for some auxiliary information |
412
413 @subsection occt_algorithms_4_3 Interferences 
414
415 The information about interferences is stored in the instances of classes that are inherited from class <i>BOPDS_Interf</i>. 
416
417 | Name  | Contents |
418 | :----- | :----- | 
419 | *BOPDS_Interf* |      Root class for interference |
420 | *Index1*      | DS index of the shape 1 |
421 | *Index2*      | DS index of the shape 2 |
422 | *BOPDS_InterfVV* | Storage for Vertex/Vertex interference |
423 | *BOPDS_InterfVE* | Storage for Vertex/Edge interference |
424 | *myParam* | The value of parameter of the point of the vertex on the curve of the edge |
425 | *BOPDS_InterfVF* | Storage for Vertex/Face interference |
426 | *myU, myV* |  The value of parameters of the point of the vertex on the surface of the face |
427 | *BOPDS_InterfEE* | Storage for Edge/Edge interference |
428 | *myCommonPart* | Common part (in terms of *IntTools_CommonPart* ) |
429 | *BOPDS_InterfEF* | Storage for Edge/Face interference |
430 | *myCommonPart | Common part (in terms of *IntTools_CommonPart* ) | 
431 | *BOPDS_InterfFF* | Storage for Face/Face interference |
432 | *myTolR3D, myTolR2D* | The value of tolerances of curves (points) reached in 3D and 2D |
433 | *myCurves* | Intersection Curves (in terms of *BOPDS_Curve*) |
434 | *myPoints* | Intersection Points (in terms of *BOPDS_Point*) |
435
436
437 The Figure shows inheritance diagram for *BOPDS_Interf* classes.
438
439 @figure{/user_guides/boolean_operations/images/operations_image017.svg,  "BOPDS_Interf classes"}
440
441
442 @subsection occt_algorithms_4_4 Pave, PaveBlock and CommonBlock
443
444 The information about the pave is stored in objects of type *BOPDS_Pave*.
445
446 | Name | Contents |
447 | :--- | :------ |
448 | *BOPDS_Pave*  | |
449 | *myIndex1* |  DS index of the vertex |
450 | *myParam* |   Value of the parameter of the 3D point of vertex on curve. |
451
452 The information about pave blocks is stored in objects of type *BOPDS_PaveBlock*.
453
454 | Name  | Contents |
455 | :--- | :------ |
456 | *BOPDS_PaveBlock*     | |
457 | *myEdge* | DS index of the edge produced from the pave block |
458 | *myOriginalEdge* | DS index of the source edge |
459 | *myPave1* | Pave 1 (in terms of *BOPDS_Pave*) |
460 | *myPave2* | Pave 2 (in terms of *BOPDS_Pave*) |
461 | *myExtPaves* | The list of paves (in terms of *BOPDS_Pave*) that is used to store paves lying inside the pave block during intersection process |
462 | *myCommonBlock* | The reference to common block (in terms of *BOPDS_CommonBlock*) if  the pave block is a common block |
463 | *myShrunkData* | The shrunk range of the pave block |
464
465 * 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>.
466 * 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*.
467
468 The information about common block is stored in objects of type *BOPDS_CommonBlock*.
469
470 | Name  | Contents |
471 | :---- | :------ |
472 | *BOPDS_CommonBlock* | |       
473 | *myPaveBlocks* | The list of pave blocks that are common in terms of @ref occt_algorithms_3_5 "Common Blocks" |
474 | *myFaces* | The list of DS indices of the faces, on which the pave blocks lie. |
475
476
477 @subsection occt_algorithms_4_5 Points and Curves
478 The information about intersection point is stored in objects of type *BOPDS_Point*. 
479
480 | Name  | Contents |
481 | :---- | :----- |
482 | *BOPDS_Point* | |     
483 | *myPnt* |     3D point |
484 | *myPnt2D1* |  2D point on the face1 |
485 | *myPnt2D2* | 2D point on the face2 |
486
487 The information about intersection curve is stored in objects of type *BOPDS_Curve*.
488
489 | Name  | Contents |
490 | :---- | :----- | 
491 | *BOPDS_Curve* | |
492 | *myCurve* | The intersection curve (in terms of *IntTools_Curve* ) |
493 | *myPaveBlocks* | The list of pave blocks that belong to the curve | 
494 | *myBox* | The bounding box of the curve (in terms of *Bnd_Box* ) |
495
496 @subsection occt_algorithms_4_6 FaceInfo
497 The information about *FaceInfo* is stored in a structure *BOPDS_FaceInfo*. 
498 The structure *BOPDS_FaceInfo* has the following contents.
499
500 | Name  | Contents |
501 | :---- | :----- |
502 | *BOPDS_FaceInfo* | |  
503 | *myPaveBlocksIn* | Pave blocks that have state In for the face |
504 | *myVerticesIn* | Vertices that have state In for the face | 
505 | *myPaveBlocksOn* | Pave blocks that have state On for the face |
506 | *myVerticesOn* | Vertices that have state On for the face | 
507 | *myPaveBlocksSc* | Pave blocks built up from intersection curves for the face |
508 | *myVerticesSc* | Vertices built up from intersection points for the face +
509
510 The 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*.
511
512 @section occt_algorithms_5      Intersection Part
513
514 Intersection Part (IP) is used to
515 * Initialize the Data Structure;
516 * Compute interferences between the arguments (or their sub-shapes);
517 * Compute same domain vertices, edges;
518 * Build split edges;
519 * Build section edges;
520 * Build p-curves;
521 * Store all obtained information in DS.
522 IP uses DS as input data. IP is implemented in the class *BOPAlgo_PaveFiller*.
523 The description provided in the next paragraphs is coherent with the implementation of the method *BOPAlgo_PaveFiller::Perform()*.
524
525 @subsection occt_algorithms_5_1 Initialization
526 The input data for the step is the Arguments. The description of initialization step is shown in the Table.
527
528 | No    | Contents |    Implementation |
529 | :--- | :----- | :----- |
530 | 1     | Initialization the array of shapes (in terms of @ref occt_algorithms_4_2 "Shapes"). Filling the array of shapes. | *BOPDS_DS::Init()* |
531 | 2     | Initialization the array pave blocks (in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock, CommonBlock") | *BOPDS_DS::Init()* |
532 | 3     | Initialization of intersection Iterator. The intersection Iterator is the object that computes intersections between BRep 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 occt_algorithms_3_1 "Interferences") | *BOPDS_Iterator* |
533 | 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. | *BOPInt_Context* |
534
535
536 @subsection occt_algorithms_5_2 Compute Vertex/Vertex Interferences
537
538 The input data for this step is the DS after the @ref occt_algorithms_5_1 "Initialization". The description of this step is shown in the table :
539
540
541 | No | Contents | Implementation |
542 | :--- | :---- | :----- | 
543 | 1 | Initialize array of Vertex/Vertex interferences. | *BOPAlgo_PaveFiller::PerformVV()* |
544 | 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* |
545 | 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()* |
546 | 4     | Build new vertices from the chains *VNc. C=0, 1…nCs.* |     *BOPAlgo_PaveFiller::PerformVV()* |
547 | 5     | Append new vertices in DS. |  *BOPDS_DS::Append()* |
548 | 6     | Append same domain vertices in DS. | *BOPDS_DS::AddShapeSD()* |
549 | 7 | Append Vertex/Vertex interferences  in DS. | *BOPDS_DS::AddInterf()* |
550
551 * 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> 
552 * These pairs produce two chains: <i>(nV11, nV12, nV13, nV14, nV15)</i> and <i>(nV21, nV22, nV23);</i>
553 * Each chain is used to create a new vertex,  *VN1* and *VN2*, correspondingly.
554
555 The example of connexity chains of interfered vertices is given in the image:
556
557 @figure{/user_guides/boolean_operations/images/operations_image018.svg, "Connexity chains of interfered vertices"}
558
559
560 @subsection occt_algorithms_5_3 Compute Vertex/Edge Interferences
561
562 The input data for this step is the DS after computing Vertex/Vertex interferences.
563
564 | No | Contents | Implementation  | 
565 | :--- | :--- | :--- |
566 | 1     | Initialize array of Vertex/Edge interferences | *BOPAlgo_PaveFiller::PerformVE()* |
567 | 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* |
568 | 3     | Compute paves. See  @ref occt_algorithms_3_1_2 "Vertex/Edge Interference" | *BOPInt_Context::ComputeVE()* | 
569 | 4     | Initialize pave blocks for the edges *Ej* involved in the interference | *BOPDS_DS:: ChangePaveBlocks()* |
570 | 5     | Append the paves into the pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock" | *BOPDS_PaveBlock:: AppendExtPave()* |
571 | 6     | Append Vertex/Edge interferences in DS | *BOPDS_DS::AddInterf()* |
572
573 @subsection occt_algorithms_5_4 Update Pave Blocks
574 The input data for this step is the DS after computing Vertex/Edge Interferences.
575
576 | No | Contents | Implementation | 
577 | :--- | :---- | :--- | 
578 | 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()* | 
579
580 @subsection occt_algorithms_5_5 Compute Edge/Edge Interferences
581
582 The input data for this step is the DS after updating Pave Blocks. 
583
584 | No | Contents | Implementation  | 
585 | :---- | :---- | :----- | 
586 | 1 | Initialize array of Edge/Edge interferences | *BOPAlgo_PaveFiller::PerformEE()* |
587 | 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* |
588 | 3     | Initialize pave blocks for the edges involved in the interference, if it is necessary. |      *BOPDS_DS:: ChangePaveBlocks()* |
589 | 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()* |
590 | 5     | Compute shrunk data for pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock", if it is necessary. | *BOPAlgo_PaveFiller::FillShrunkData()* |
591 | 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* |
592 | 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()* |
593 | 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()* |
594 | 8     | Post-processing. Append the paves of *VNXi* into the corresponding pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock" | *BOPDS_PaveBlock:: AppendExtPave()* |
595 | 9     | Split common blocks CBc by the paves. | *BOPDS_DS:: UpdateCommonBlock()* |
596 | 10 | Append Edge/Edge interferences in the DS. |      *BOPDS_DS::AddInterf()* |
597
598 The example of coinciding chains of pave blocks is given in the image:
599
600 @figure{/user_guides/boolean_operations/images/operations_image019.png,  "Coinciding chains of pave blocks"}
601
602 * The pairs of coincided pave blocks are: <i>(PB11, PB12), (PB11, PB13), (PB12, PB13), (PB21, PB22), (PB21, PB23), (PB22, PB23).</i>
603 * The pairs produce  two chains: <i>(PB11, PB12, PB13)</i> and <i>(PB21, PB22, PB23).</i>
604
605 @subsection occt_algorithms_5_6 Compute Vertex/Face Interferences
606
607 The input data for this step is the DS after computing Edge/Edge interferences.
608
609 | No | Contents | Implementation  |
610 | :---- | :--- | :---- |
611 | 1     | Initialize array of Vertex/Face interferences | *BOPAlgo_PaveFiller::PerformVF()* |
612 | 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* |
613 | 3     | Compute interference  See  @ref occt_algorithms_3_1_3 "Vertex/Face Interference" | *BOPInt_Context::ComputeVF()* |
614 | 4     | Append Vertex/Edge interferences in the DS |  *BOPDS_DS::AddInterf()* |
615 | 5     | Repeat steps 2-4 for each new vertex *VNXi (i=1, 2…,NbVNX),* where *NbVNX* is the number of vertices. | *BOPAlgo_PaveFiller::TreatVerticesEE()* |
616
617 @subsection occt_algorithms_5_7 Compute Edge/Face Interferences
618 The input data for this step is the DS after computing Vertex/Face Interferences. 
619
620 | No | Contents | Implementation |
621 | :---- | :---- | :---- | 
622 | 1     | Initialize array of Edge/Face interferences | *BOPAlgo_PaveFiller::PerformEF()* |
623 | 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* |
624 | 3     | Initialize pave blocks for the edges involved in the interference, if it is necessary. | *BOPDS_DS::ChangePaveBlocks()* |
625 | 4     | Access to the pave blocks of interfered edge <i>(PBi1, PBi2…PBiNi)</i> for edge *Ei*        | *BOPAlgo_PaveFiller::PerformEF()* |
626 | 5     | Compute shrunk data for pave blocks (in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock") if it is necessary. |    *BOPAlgo_PaveFiller::FillShrunkData()* |
627 | 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* |
628 | 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()* |
629 | 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()* |
630 | 8     | Post-processing. Append the paves of *VNXi* into the corresponding pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock". | *BOPDS_PaveBlock:: AppendExtPave()* |
631 | 9     | Split pave blocks and common blocks *CBc* by the paves. |     *BOPAlgo_PaveFiller::PerformVertices1()*, *BOPDS_DS:: UpdatePaveBlock()* and *BOPDS_DS:: UpdateCommonBlock()* |
632 | 10 | Append Edge/Face interferences in the DS | *BOPDS_DS::AddInterf()* |
633 | 11 | Update *FaceInfo*  for all faces having EF common parts. | *BOPDS_DS:: UpdateFaceInfoIn()* |
634
635
636 @subsection occt_algorithms_5_8 Build Split Edges
637
638 The input data for this step is the DS after computing Edge/Face Interferences.
639
640 For each pave block *PB* take the following steps: 
641         
642 | No | Contents | Implementation |
643 | :--- | :--- | :--- | 
644 | 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 occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock". | *BOPAlgo_PaveFiller::MakeSplitEdges()* | 
645 | 2     | Build the split edge *Esp* using the information from *DS* and *PBR*. | *BOPTools_Tools::MakeSplitEdge()* |
646 | 3     | Compute *BOPDS_ShapeInfo* contents for Esp | *BOPAlgo_PaveFiller::MakeSplitEdges()* |
647 | 4     | Append *BOPDS_ShapeInfo* contents to the DS | *BOPDS_DS::Append()* |
648
649 @subsection occt_algorithms_5_9 Compute Face/Face Interferences
650
651 The input data for this step is DS after building Split Edges. 
652
653 | No | Contents | Implementation |
654 | :--- | :--- | :--- | 
655 | 1 | Initialize array of Edge/Face interferences | *BOPAlgo_PaveFiller::PerformFF()* |
656 | 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* |
657 | 3     | Compute Face/Face interference | *IntTools_FaceFace* |
658 | 4     | Append Face/Face interferences in the DS. | *BOPDS_DS::AddInterf()* |
659
660 @subsection occt_algorithms_5_10        Build Section Edges
661
662 The input data for this step is the DS after building Split Edges.
663
664 | No | Contents | Implementation  |
665 | :---- | :---- | :---- |
666 | 1 | For each Face/Face interference *nFi, nFj*, retrieve @ref occt_algorithms_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 occt_algorithms_3_1_1 "Vertex/Vertex interference". | *BOPAlgo_PaveFiller::MakeBlocks()* |
667 | 2     | For each intersection curve *Cijk* | |        
668 | 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()* |
669 | 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()* |
670 | 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()* |
671 | 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 occt_algorithms_3_1_3 "Vertex/Face interference"). | *BOPTools_Tools::MakeEdge()* |
672 | 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 occt_algorithms_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()* |
673 | 4     | Update face info (sections about pave blocks and vertices) | *BOPAlgo_PaveFiller::PerformFF()* |
674
675 @subsection occt_algorithms_5_11 Build P-Curves
676 The input data for this step is the DS after building section edges.
677
678 | No | Contents | Implementation |
679 | :---- | :---- | :---- |
680 | 1     | For each Face/Face interference *nFi* and *nFj* build p-Curves on *nFi* and *nFj* for each section edge *ESXk*. |     *BOPAlgo_PaveFiller::MakePCurves()* |
681 | 2     | For each pave block that is common for faces *nFi* and *nFj* build p-Curves on *nFi* and *nFj*. |     *BOPAlgo_PaveFiller::MakePCurves()* |
682
683 @subsection occt_algorithms_5_12        Process Degenerated Edges
684 The input data for this step is the DS  after building P-curves.
685
686 | No | Contents | Implementation |
687 | :---- | :---- | :---- |
688 | | For each degenerated edge *ED* having vertex *VD* | BOPAlgo_PaveFiller::ProcessDE() |
689 | 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()* |
690 | 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()* |
691 | 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()* |
692
693 @section occt_algorithms_6      General description of the Building Part
694
695 Building Part (BP) is used to 
696 * Build the result of the operation 
697 * Provide history information (in terms of <i>\::Generated(), \::Modified()</i> and <i>\::IsDeleted()</i>)
698 BP uses the DS prepared by *BOPAlgo_PaveFiller* described at chapter 5 as input data.
699 BP is implemented in the following classes:
700 * *BOPAlgo_Builder* - for the General Fuse Algorithm (GFA).
701 * *BOPAlgo_BOP* - for the Boolean Operation Algorithm (BOA).
702
703 @figure{/user_guides/boolean_operations/images/operations_image020.svg, "Diagram for BP classes"}
704
705 The class *BOPAlgo_Algo* provides the base interface for all algorithms:
706 * Error status;
707 * Warning status;
708 * Checking data;
709 * Checking the result;
710 * Memory allocator.
711 The class *BOPAlgo_BuilderShape* provides the interface for algorithms that have:
712 * A Shape as the result;
713 * History information (in terms of <i>\::Generated(), \::Modified()</i> and <i>\::IsDeleted()).</i>
714
715 @section occt_algorithms_7      General Fuse Algorithm
716 @subsection occt_algorithms_7_1 Arguments
717 The arguments of the algorithm are shapes (in terms of *TopoDS_Shape*). The main requirements for the arguments are described in @ref occt_algorithms_4_1 "Algorithms" chapter.
718
719 @subsection occt_algorithms_7_2 Results
720
721 During 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*.
722 * The result of the General Fuse (GF) operation is a compound. Each sub-shape of the compound (resulting shape) corresponds to the certain argument shape S1, S2…Sn and has shared sub-shapes in accordance with interferences between the arguments.
723 * For the arguments of the type EDGE, FACE, SOLID the result contains split parts of the argument.
724 * 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).
725 The types of resulting shapes depend on the type of the corresponding argument participating in the operation. See the table below:
726
727 | No | Type of argument | Type of resulting shape | Comments |
728 | :--- | :---- | :--- | :--- |
729 | 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. | 
730 | 2     | COMPSOLID     | COMPSOLID     | The resulting COMPSOLID is built from split SOLIDs. |
731 | 3     | SOLID | Set of split SOLIDs | |
732 | 4     | SHELL | SHELL | The resulting SHELL is built from split FACEs |
733 | 5     | FACE  | Set of split FACEs | |
734 | 6     | WIRE | WIRE | The resulting WIRE is built from split EDGEs |
735 | 7     | EDGE  | Set of split EDGEs    | |
736 | 8     | VERTEX | VERTEX | |
737
738 @subsection occt_algorithms_7_3 Examples
739
740 Please, have a look at the examples of compounds, which can help to better understand the definitions.
741
742 @subsubsection occt_algorithms_7_3_1    Example 1: Three edges intersecting at a point 
743
744 Let us consider three edges: *E1, E2* and *E3* that intersect in one 3D point.
745
746 @figure{/user_guides/boolean_operations/images/operations_image021.svg, "Three Intersecting Edges"}
747
748 The 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*.
749
750 In this case:
751 * The argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*).
752 * The argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
753 * The argument edge *E3* has resulting split edges *E31* and *E32* (image of *E3*).
754
755 @subsubsection occt_algorithms_7_3_2 Example 2: Two wires and an edge
756
757 Let us consider two wires *W1 (Ew11, Ew12, Ew13)* and *W2 (Ew21, Ew22, Ew23)* and edge *E1*.
758
759 @figure{/user_guides/boolean_operations/images/operations_image022.svg,  "Two wires and an edge"}
760
761 The 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*. 
762
763 In this case :
764 * The argument *W1* has image *Wn1*.
765 * The argument *W2* has image *Wn2*.
766 * The argument edge *E1* has split edges *E11* and *E12*. (image of *E1*).
767 The 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*.
768
769 @subsubsection occt_algorithms_7_3_3 Example 3: An edge intersecting with a face
770
771 Let us consider edge *E1* and face *F2*:
772
773 @figure{/user_guides/boolean_operations/images/operations_image023.svg,  "An edge intersecting with a face"}
774
775 The result of the GF operation is a compound consisting of 3 shapes: 
776 * Split edge parts *E11* and *E12* (image of *E1*).
777 * New face *F21* with internal edge *E12* (image of *F2*).
778
779 @subsubsection occt_algorithms_7_3_4 Example 4: An edge lying on a face
780
781 Let us consider edge *E1* and face *F2*:
782
783 @figure{/user_guides/boolean_operations/images/operations_image024.svg,  "An edge lying on a face"}
784
785 The result of the GF operation is a compound consisting of 5 shapes: 
786 * Split edge parts *E11, E12* and *E13* (image of *E1*).
787 * Split face parts  *F21* and *F22* (image of *F2*).
788
789
790 @subsubsection occt_algorithms_7_3_5 Example 5: An edge and a shell
791
792 Let us consider edge *E1* and shell *Sh2* that consists of 2 faces: *F21* and *F22*
793
794 @figure{/user_guides/boolean_operations/images/operations_image025.svg, "An edge and a shell"}
795
796 The result of the GF operation is a compound consisting of 5 shapes: 
797 * Split edge parts *E11, E12 , E13* and *E14* (image of *E1*).
798 * Image shell *Sh21* (that contains split face parts  *F211, F212, F221* and *F222*).
799
800 @subsubsection occt_algorithms_7_3_6 Example 6: A wire and a shell
801
802 Let us consider  wire *W1 (E1, E2, E3, E4)* and  shell *Sh2 (F21, F22)*. 
803 @figure{/user_guides/boolean_operations/images/operations_image026.svg,  "A wire and a shell"}
804
805 The result of the GF operation is a compound consisting of 2 shapes: 
806
807 * Image wire *W11* that consists of split edge parts from wire *W1: E11, E12, E13* and *E14*.
808 * Image shell *Sh21* that contains split face parts: *F211, F212, F213, F221, F222* and *F223*.
809
810 @subsubsection occt_algorithms_7_3_7 Example 7: Three faces
811
812 Let us consider 3 faces: *F1, F2* and *F3*. @figure{/user_guides/boolean_operations/images/operations_image027.png,  "Three faces"}
813
814 The result of the GF operation is a compound consisting of 7 shapes:
815 * Split face parts: *Fn1, Fn2, Fn3, Fn4, Fn5, Fn6* and *Fn7*.
816
817 @subsubsection occt_algorithms_7_3_8 Example 8: A face and a shell
818
819 Let us consider shell *Sh1 (F11, F12, F13)* and face *F2*.
820 @figure{/user_guides/boolean_operations/images/operations_image028.png,  "A face and a shell"}
821
822 The result of the GF operation is a compound consisting of 4 shapes:
823 * Image shell *Sh11* that consists of split face parts from shell *Sh1: Fn1, Fn2, Fn3, Fn4, Fn5* and *Fn6*.
824 * Split parts of face *F2: Fn3, Fn6* and *Fn7*.
825
826 @subsubsection occt_algorithms_7_3_9    Example 9: A shell and a solid
827
828 Let us consider shell *Sh1 (F11, F12…F16)* and solid *So2*. @figure{/user_guides/boolean_operations/images/operations_image029.png,  "A shell and a solid: arguments"}
829
830 The result of the GF operation is a compound consisting of 2 shapes:
831 * Image shell *Sh11* consisting of split face parts of *Sh1: Fn1, Fn2 ... Fn8.*
832 * Solid *So21* with internal shell. (image of *So2*).
833 @figure{/user_guides/boolean_operations/images/operations_image030.png,  "A shell and a solid: results"}
834
835 @subsubsection occt_algorithms_7_3_10 Example 10: A compound and a solid
836
837 Let us consider compound *Cm1* consisting of 2 solids *So11* and *So12*) and solid *So2*.
838 @figure{/user_guides/boolean_operations/images/operations_image031.png, "A compound and a solid: arguments"}
839
840 The result of the GF operation is a compound consisting of 4 shapes:
841 * Image compound *Cm11* consisting of split solid parts from *So11* and *So12 (Sn1, Sn2, Sn3, Sn4)*.
842 * Split parts of solid *So2 (Sn2, Sn3, Sn5)*.
843
844 @figure{/user_guides/boolean_operations/images/operations_image032.png, "A compound and a solid: results"}
845
846 @subsection occt_algorithms_7_4 Class BOPAlgo_Builder
847
848 GFA is implemented in the class *BOPAlgo_Builder*.
849
850 @subsubsection occt_algorithms_7_4_1 Fields
851
852 The main fields of the class are described in the Table: 
853
854 | Name | Contents |
855 | :---- | :---- |
856 | *myPaveFiller* |      Pointer to the *BOPAlgo_PaveFiller* object |
857 | *myDS* |      Pointer to the *BOPDS_DS* object |
858 | *myContext* | Pointer to the intersection Context |
859 | *myImages* | The Map between the source shape and its images | 
860 | *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. |
861
862 @subsubsection occt_algorithms_7_4_2 Initialization
863
864 The input data for this step is a *BOPAlgo_PaveFiller* object (in terms of @ref  occt_algorithms_5 "Intersection") at the state after @ref occt_algorithms_5_12 "Processing of degenerated edges"  with the corresponding DS.
865
866 | No | Contents | Implementation |
867 | :---- | :---- | :---- |
868 | 1     | Check the readiness of the DS and *BOPAlgo_PaveFiller*. | *BOPAlgo_Builder::CheckData()* | 
869 | 2     | Build an empty result of type Compound. | *BOPAlgo_Builder::Prepare()* |
870
871 @subsubsection occt_algorithms_7_4_3 Build Images for Vertices
872
873 The input data for this step is *BOPAlgo_Builder* object  after Initialisation.
874
875 | No | Contents | Implementation  |
876 | :--- | :--- | :--- | 
877 | 1     | Fill *myShapesSD*  by SD vertices using the information from the DS. |        *BOPAlgo_Builder::FillImagesVertices()* |
878
879 @subsubsection occt_algorithms_7_4_4 Build Result of Type Vertex
880
881 The input data for this step is *BOPAlgo_Builder* object  after building images for vertices and *Type*, which is the shape type (*TopAbs_VERTEX*).
882
883 | No | Contents | Implementation |
884 | :--- | :--- | :----- |
885 | 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()* |
886
887 @subsubsection occt_algorithms_7_4_5 Build Images for Edges
888
889 The input data for this step is *BOPAlgo_Builder object* after building result of type vertex.
890
891 | No | Contents | Implementation |
892 | :---- | :---- | :----- | 
893 | 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()* |
894
895 @subsubsection occt_algorithms_7_4_6 Build Result of Type Edge
896
897 This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type *Edge*.
898
899 @subsubsection occt_algorithms_7_4_7 Build Images for Wires
900
901 The input data for this step is: 
902 * *BOPAlgo_Builder* object after building result of type *Edge*;
903 * Original Shape - Wire
904 * *Type* - the shape type <i>(TopAbs_WIRE).</i>
905
906 | No | Contents | Implementation |
907 | :---- | :---- | :----- | 
908 | 1     | For all arguments of the type *Type*. Create a container C of the type *Type*. | *BOPAlgo_Builder::FillImagesContainers()* |
909 | 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()* |
910 | 3     | Fill *myImages*  for the *Original Shape* by the information above. | *BOPAlgo_Builder::FillImagesContainers()* | 
911
912 @subsubsection occt_algorithms_7_4_8    Build Result of Type Wire
913
914 This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex" but for the type *Wire*.
915
916 @subsubsection occt_algorithms_7_4_9    Build Images for Faces
917
918 The input data for this step is *BOPAlgo_Builder* object after building result of type *Wire*.
919  
920 | No | Contents | Implementation |
921 | :--- | :--- | :--- |
922 | 1     | Build Split Faces     for all interfered DS shapes *Fi* of type *FACE*. | |   
923 | 1.1 | Collect all edges or their images of *Fi(ESPij)*. |     *BOPAlgo_Builder::BuildSplitFaces()* |
924 | 1.2 | Impart to ESPij the orientation to be coherent with the original one. | *BOPAlgo_Builder::BuildSplitFaces()* |
925 | 1.3 | Collect all section edges *SEk* for *Fi*. | *BOPAlgo_Builder::BuildSplitFaces()* |
926 | 1.4 | Build split faces for *Fi (Fi1, Fi2…FiNbSp)*, where *NbSp* is the number of split parts (see @ref occt_algorithms_7_2 "Building faces from a set of edges" for more details). | *BOPAlgo_BuilderFace* | 
927 | 1.5 | Impart to <i>(Fi1, Fi2…FiNbSp)</i> the orientation coherent with the original face *Fi*. | *BOPAlgo_Builder::BuildSplitFaces()* | 
928 | 1.6 | Fill the map mySplits with *Fi/(Fi1, Fi2…FiNbSp)* | *BOPAlgo_Builder::BuildSplitFaces()* |
929 | 2 | Fill Same Domain faces | *BOPAlgo_Builder::FillSameDomainFaces* | 
930 | 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()* |
931 | 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()* | 
932 | 2.3 | Fill *myShapesSD* using the chains <i>(F1C, F2C… FnC)k</i> |  *BOPAlgo_Builder::FillSameDomainFaces()* |
933 | 2.4 | Add internal vertices to split faces. | *BOPAlgo_Builder::FillSameDomainFaces()* |
934 | 2.5 | Fill *myImages* using *myShapesSD* and *mySplits*.      | *BOPAlgo_Builder::FillSameDomainFaces()* |
935
936
937 The example of chains of same domain faces is given in the image:
938
939 @figure{/user_guides/boolean_operations/images/operations_image033.svg,  "Chains of same domain faces"}
940
941 * The pairs of same domain faces are: <i>(F11, F21), (F22, F31), (F41, F51) , (F41, F6)</i> and <i>(F51, F6)</i>.
942 * The pairs produce the three chains: <i>(F11, F21), (F22, F31)</i> and <i>(F41, F51, F6)</i>.
943
944 @subsubsection occt_algorithms_7_4_10   Build Result of Type Face
945 This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex" but for the type *Face*.
946
947 @subsubsection occt_algorithms_7_4_11   Build Images for Shells
948 The input data for this step is:
949 * *BOPAlgo_Builder* object  after building result of type face;
950 * *Original Shape* - Shell;
951 * *Type* - the type of the shape <i>(TopAbs_SHELL)</i>.
952
953 The procedure is the same as for building images for wires. 
954
955 @subsubsection occt_algorithms_7_4_12   Build Result of Type Shell
956 This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex" but for the type *Shell*.
957
958 @subsubsection occt_algorithms_7_4_13 Build Images for Solids
959
960 The input data for this step is *BOPAlgo_Builder* object after building result of type *Shell*. 
961
962 The following procedure is executed for all interfered DS shapes *Si* of type *SOLID*.  
963
964 | No | Contents | Implementation | 
965 | :--- | :--- | :--- | 
966 | 1     | Collect all images or non-split parts for all faces <i>(FSPij)</i> that have 3D state *In Si*. | *BOPAlgo_Builder::FillIn3DParts ()* | 
967 | 2     | Collect all images or non-split parts for all faces of *Si* | *BOPAlgo_Builder::BuildSplitSolids()* |
968 | 3     | Build split solids for *Si -> (Si1, Si2…SiNbSp)*, where *NbSp* is the number of split parts (see @ref occt_algorithms_7_2 "Building faces from a set of edges" for more details) | *BOPAlgo_BuilderSolid* |
969 | 4     | Fill the map Same Domain solids *myShapesSD* | *BOPAlgo_Builder::BuildSplitSolids()* |
970 | 5     | Fill the map *myImages* |  *BOPAlgo_Builder::BuildSplitSolids()* |
971 | 6     | Add internal vertices to split solids | *BOPAlgo_Builder::FillInternalShapes()* |
972
973 @subsubsection occt_algorithms_7_4_14 Build Result of Type Solid
974 This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type Solid.
975
976 @subsubsection occt_algorithms_7_4_15 Build Images for Type CompSolid
977
978 The input data for this step is:
979 * *BOPAlgo_Builder* object after building result of type solid;
980 * *Original Shape* - Compsolid;
981 * *Type* - the type of the shape <i>(TopAbs_COMPSOLID)</i>.
982
983 The procedure is the same as for building images for wires. 
984
985 @subsubsection occt_algorithms_7_4_16 Build Result of Type Compsolid
986 This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type Compsolid.
987
988 @subsubsection occt_algorithms_7_4_17 Build Images for Compounds
989 The input data for this step is as follows:
990 * *BOPAlgo_Builder* object after building results of type compsolid;
991 * *Original Shape* - Compound;
992 * *Type* - the type of the shape <i>(TopAbs_COMPOUND)</i>.
993
994 The procedure is the same as for building images for wires. 
995
996 @subsubsection occt_algorithms_7_4_18 Build Result of Type Compound
997
998 This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type Compound.
999
1000 @subsubsection occt_algorithms_7_4_19 Post-Processing
1001 The purpose of the step is to correct tolerances of the result to provide its validity in terms of *BRepCheck_Analyzer.*
1002
1003 The input data for this step is a *BOPAlgo_Builder* object after building result of type compound.
1004
1005 | No |  Contents | Implementation  |
1006 | :---- | :---- | :----- |
1007 | 1     | Correct tolerances of vertices on curves | *BOPTools_Tools::CorrectPointOnCurve()* |
1008 | 2     | Correct tolerances of edges on faces | *BOPTools_Tools::CorrectCurveOnSurface()* |
1009
1010
1011 @section occt_algorithms_9      Boolean Operations Algorithm
1012
1013 @subsection occt_algorithms_9_1 Arguments
1014
1015 * The arguments of BOA are shapes in terms of *TopoDS_Shape*. The main requirements for the arguments are described in @ref occt_algorithms_4_1 "Algorithms"
1016 * There are only two  arguments in BOA @ref occt_algorithms_2_1 "Operators":
1017         * Object (S1);
1018         * Tool (S2).
1019 * Each argument should contain objects of a single dimension (see the Table).
1020
1021 | No | Type of Argument | Index of Type | Dimension |
1022 | :---- | :---- | :----- | :---- |
1023 | 1 | COMPOUND | 0 | One of 0, 1, 2, 3 |
1024 | 2     | COMPSOLID     | 1     | 3 |
1025 | 3     | SOLID | 2     | 3 |
1026 | 4     | SHELL | 3     | 2 |
1027 | 5     | FACE | 4 | 2 |
1028 | 6     | WIRE | 5 | 1 |
1029 | 7 | EDGE | 6 | 1 |
1030 | 8 | VERTEX | 7 | 0 |
1031
1032 * For Boolean operation Fuse the arguments should have equal dimensions.
1033 * For Boolean operation Cut the dimension of *S1* should not be less then the dimension of *S2*.
1034
1035 @subsection occt_algorithms_9_2 Results
1036
1037 During the operation the argument *Si* can be spited into parts *Si1, Si2 ... Si1NbSp*, where *NbSp* is the number of parts. The set <i>(Si1, Si2… Si1NbSp)</i> is an image of the argument *Si*.
1038
1039 @subsection occt_algorithms_9_3 General Rules
1040
1041 * The result of the BOA operation is a compound (if defined). Each sub-shape of the compound corresponds to the concrete argument *S1* and *S2* and has shared sub-shapes in accordance with interferences between the arguments. 
1042 * The content of the result depends on the type of the operation (Common, Fuse, Cut12, Cut21) and the dimensions of the arguments. 
1043 * 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.
1044 * 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.
1045 * 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.
1046 * The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The dimension of the result is equal to the lower dimension of the arguments. For example, the result of the operation Common between edges can not be a vertex. 
1047 * 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.
1048 * The result of the operation *Cut12[Cut21]* is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S1)≤Dim(S2) [Dim(S1)≥Dim(S2)]*. The dimension of the result is equal to the lower dimension of the arguments. The result of the operation *Cut12[Cut21]* is not defined for other cases. For example, it is impossible to cut a solid from an edge, because such shape type as a solid without an edge is not defined. 
1049 * 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*.
1050 * 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*.
1051
1052 @subsection occt_algorithms_9_4 Examples
1053
1054 @subsubsection occt_algorithms_9_4_1    Case 1: Two Vertices
1055
1056 Let us consider two interfering vertices *V1* and *V2*:
1057
1058 @figure{/user_guides/boolean_operations/images/boolean_image001.svg}
1059
1060 * The result of *Fuse* operation is the compound that contains new vertex *V*.
1061
1062 @figure{/user_guides/boolean_operations/images/boolean_image002.svg}
1063
1064 * The result of *Common* operation is a compound containing new vertex *V*.
1065 This compound is identical to the result of *Fuse* operation. 
1066
1067 * The result of *Cut12* operation is an empty compound.
1068 * The result of *Cut21* operation is an empty compound.
1069
1070 @subsubsection occt_algorithms_9_4_2    Case 2: A Vertex and an Edge
1071
1072 Let us consider vertex *V1* and the edge *E2*, that intersect in a 3D point:
1073
1074 @figure{/user_guides/boolean_operations/images/boolean_image004.png}
1075
1076 * 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).
1077
1078 * The result of *Common* operation is a compound containing a new vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with edge *E2*.
1079
1080 @figure{/user_guides/boolean_operations/images/boolean_image005.png}
1081
1082 * The result of *Cut12* operation is an empty compound.
1083 * The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the edge (1).
1084
1085 @subsubsection occt_algorithms_9_4_3    Case 3: A Vertex and a Face
1086
1087 Let us consider  vertex *V1* and face *F2*, that intersect in a 3D point:
1088
1089 @figure{/user_guides/boolean_operations/images/boolean_image006.png}
1090
1091 * 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).
1092
1093 * The result of *Common* operation is a compound containing a new vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with face *F2*.
1094
1095 @figure{/user_guides/boolean_operations/images/boolean_image007.png}
1096
1097 * The result of *Cut12* operation is an empty compound.
1098 * The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the face (2).
1099
1100 @subsubsection occt_algorithms_9_4_4    Case 4: A Vertex abd a Solid
1101
1102 Let us consider  vertex *V1* and solid *S2*, that intersect in a 3D point:
1103
1104 @figure{/user_guides/boolean_operations/images/boolean_image008.png}
1105
1106 * 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).
1107
1108 * The result of *Common* operation is a compound containing a new vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with solid *S2*.
1109
1110 @figure{/user_guides/boolean_operations/images/boolean_image009.png}
1111
1112 * The result of *Cut12* operation is an empty compound.
1113 * The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the solid (3).
1114
1115 @subsubsection occt_algorithms_9_4_5    Case 5: Two edges intersecting at one point
1116
1117 Let us consider edges *E1* and *E2*, that intersect in a 3D point:
1118
1119 @figure{/user_guides/boolean_operations/images/boolean_image010.svg}
1120
1121 * 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*. 
1122 In this case: 
1123         * argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*);
1124         * argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
1125         
1126 @figure{/user_guides/boolean_operations/images/boolean_image011.svg}    
1127
1128 * 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).
1129
1130 * 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*. 
1131
1132 In this case the argument edge *E1* has resulting split edges *E11* and *E12 (image of *E1*).
1133
1134 @figure{/user_guides/boolean_operations/images/boolean_image012.svg}    
1135
1136 * 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*. 
1137
1138 In this case the argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
1139
1140 @figure{/user_guides/boolean_operations/images/boolean_image013.svg}    
1141
1142 @subsubsection occt_algorithms_9_4_6    Case 6: Two edges having a common block
1143
1144 Let us consider edges *E1* and *E2*, that have a common block:
1145
1146 @figure{/user_guides/boolean_operations/images/boolean_image014.svg}
1147
1148 * 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. 
1149 In this case: 
1150         * argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*);
1151         * argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*);
1152         * edge *E12* is common for the images of *E1* and *E2*.
1153         
1154 @figure{/user_guides/boolean_operations/images/boolean_image015.svg}    
1155
1156 * The result of *Common* operation is an empty 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*. 
1157 The common part between the edges (edge) has the same dimension (1) as the dimension of the arguments (1).
1158
1159 @figure{/user_guides/boolean_operations/images/boolean_image016.svg}    
1160
1161 * The result of *Cut12* operation is a compound containing a split part of argument  *E1*, i.e. new edge *E11*. 
1162
1163 @figure{/user_guides/boolean_operations/images/boolean_image017.svg}    
1164
1165 * The result of *Cut21* operation is a compound containing a split part of argument  *E2*, i.e. new edge *E22*.
1166
1167 @figure{/user_guides/boolean_operations/images/boolean_image018.svg}    
1168
1169
1170 @subsubsection occt_algorithms_9_4_7    Case 7: An Edge and a Face intersecting at a point
1171
1172 Let us consider edge *E1* and face *F2*, that intersect at a 3D point:
1173
1174 @figure{/user_guides/boolean_operations/images/boolean_image019.png}
1175
1176 * 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).
1177         
1178 * 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).
1179
1180 * The result of *Cut12* operation is a compound containing split parts of the argument  *E1*, i.e. 2 new edges *E11* and *E12*.  
1181
1182 In this case the argument edge *E1* has no common parts with the face *F2* so the whole image of *E1* is in the result.
1183
1184 @figure{/user_guides/boolean_operations/images/boolean_image020.png}    
1185
1186 * The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the face (2).
1187
1188 @subsubsection occt_algorithms_9_4_8    Case 8: A Face and an Edge that have a common block
1189
1190 Let us consider edge *E1* and face *F2*, that have a common block:
1191
1192 @figure{/user_guides/boolean_operations/images/boolean_image021.png}
1193
1194 * 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).
1195         
1196 * The result of *Common* operation is a compound containing a split part of the argument  *E1*, i.e. new edge *E12*. 
1197
1198 In 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*.
1199
1200 @figure{/user_guides/boolean_operations/images/boolean_image022.png}
1201
1202 * The result of *Cut12* operation is a compound containing split part of the argument  *E1*, i.e. new edge *E11*.  
1203
1204 In 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.
1205
1206 @figure{/user_guides/boolean_operations/images/boolean_image023.png}    
1207
1208 * The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the face (2).
1209
1210 @subsubsection occt_algorithms_9_4_9    Case 9: An Edge and a Solid intersecting at a point 
1211
1212 Let us consider edge *E1* and solid *S2*, that intersect at a point:
1213
1214 @figure{/user_guides/boolean_operations/images/boolean_image024.png}
1215
1216 * 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).
1217         
1218 * The result of *Common* operation is a compound containing a split part of the argument  *E1*, i.e. new edge *E12*. 
1219
1220 In 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*.
1221
1222 @figure{/user_guides/boolean_operations/images/boolean_image025.png}
1223
1224 * The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.  
1225
1226 In 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*.
1227
1228 @figure{/user_guides/boolean_operations/images/boolean_image071.png}    
1229
1230 * The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the solid (3).
1231
1232 @subsubsection occt_algorithms_9_4_10   Case 10: An Edge and a Solid that have a common block 
1233
1234 Let us consider edge *E1* and solid *S2*, that have a common block:
1235
1236 @figure{/user_guides/boolean_operations/images/boolean_image072.png}
1237
1238 * 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).
1239         
1240 * The result of *Common* operation is a compound containing a split part of the argument  *E1*, i.e. new edge *E12*. 
1241
1242 In 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*.
1243
1244 @figure{/user_guides/boolean_operations/images/boolean_image073.png}
1245
1246 * The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.  
1247
1248 In this case the argument edge *E1* has 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*.
1249
1250 @figure{/user_guides/boolean_operations/images/boolean_image026.png}    
1251
1252 * The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the solid (3).
1253
1254 @subsubsection occt_algorithms_9_4_11   Case 11: Two intersecting faces 
1255
1256 Let us consider two intersecting faces *F1* and *F2*:
1257
1258 @figure{/user_guides/boolean_operations/images/boolean_image027.png}
1259
1260 * The result of *Fuse* operation is an empty compound containing split parts of arguments  i.e. 2 new faces *F11* and *F21*. These faces have one shared edge *En1*.
1261
1262 @figure{/user_guides/boolean_operations/images/boolean_image028.png}
1263
1264
1265 * 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).
1266
1267 * The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.  
1268
1269 @figure{/user_guides/boolean_operations/images/boolean_image029.png}    
1270
1271 * The result of *Cut21* operation is a compound containing split parts of the argument  *F2*, i.e. 1 new face *F21*.
1272
1273 @figure{/user_guides/boolean_operations/images/boolean_image030.png}
1274         
1275 @subsubsection occt_algorithms_9_4_12   Case 12: Two faces that have a common part
1276
1277 Let us consider two faces *F1* and *F2* that have a common planar part:
1278
1279 @figure{/user_guides/boolean_operations/images/boolean_image031.png}
1280
1281 * 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: 
1282         * the argument edge *F1* has resulting split faces *F11* and *F12* (image of *F1*)
1283         * the argument face *F2* has resulting split faces *F12* and *F22* (image of *F2*)
1284         * the face *F12* is common for the images of *F1* and *F2*.
1285         
1286 @figure{/user_guides/boolean_operations/images/boolean_image032.png}
1287
1288 * The result of *Common* operation is a compound containing split parts of arguments i.e. 1 new face *F12*. 
1289 In this case: face *F12* is common for the images of *F1* and *F2*.
1290 The common part between the faces (face) has the same dimension (2) as the dimension of the arguments (2).
1291
1292
1293 @figure{/user_guides/boolean_operations/images/boolean_image033.png}
1294
1295 * The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.  
1296         
1297 @figure{/user_guides/boolean_operations/images/boolean_image034.png}    
1298         
1299 * The result of *Cut21* operation is a compound containing split parts of the argument  *F2*, i.e. 1 new face *F21*.
1300
1301 @figure{/user_guides/boolean_operations/images/boolean_image035.png}
1302
1303 @subsubsection occt_algorithms_9_4_13   Case 13: Two faces that have a common edge
1304
1305 Let us consider two faces *F1* and *F2* that have a common edge:
1306
1307 @figure{/user_guides/boolean_operations/images/boolean_image036.png}
1308
1309 * 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*.
1310         
1311 @figure{/user_guides/boolean_operations/images/boolean_image037.png}
1312
1313 * 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)
1314
1315 * 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.
1316         
1317 @figure{/user_guides/boolean_operations/images/boolean_image038.png}    
1318         
1319 * 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.
1320
1321 @figure{/user_guides/boolean_operations/images/boolean_image039.png}
1322
1323 @subsubsection occt_algorithms_9_4_14   Case 14: Two faces that have a common vertex
1324
1325 Let us consider two faces *F1* and *F2* that have a common vertex:
1326
1327 @figure{/user_guides/boolean_operations/images/boolean_image040.png}
1328
1329 * 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 *Vn1*.
1330         
1331 @figure{/user_guides/boolean_operations/images/boolean_image041.png}
1332
1333 * 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)
1334
1335 * The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.  
1336         
1337 @figure{/user_guides/boolean_operations/images/boolean_image042.png}    
1338         
1339 * The result of *Cut21* operation is a compound containing split parts of the argument  *F2*, i.e. 1 new face *F21*. 
1340
1341 @figure{/user_guides/boolean_operations/images/boolean_image043.png}
1342
1343
1344 @subsubsection occt_algorithms_9_4_15   Case 15: A Face and a Solid that have an intersection curve.
1345
1346 Let us consider face *F1* and solid *S2* that have an intersection curve:
1347
1348 @figure{/user_guides/boolean_operations/images/boolean_image044.png}
1349
1350 * 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).
1351         
1352 * The result of *Common* operation is a compound contain 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*.
1353
1354 @figure{/user_guides/boolean_operations/images/boolean_image045.png}
1355
1356 * 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*.
1357         
1358 @figure{/user_guides/boolean_operations/images/boolean_image046.png}    
1359         
1360 * The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1361
1362 @subsubsection occt_algorithms_9_4_16   Case 16: A Face and a Solid that have a common face.
1363
1364 Let us consider face *F1* and solid *S2* that have a common part on face:
1365
1366 @figure{/user_guides/boolean_operations/images/boolean_image047.png}
1367
1368 * 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).
1369
1370 * The result of *Common* operation is a compound contain 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*.
1371
1372 @figure{/user_guides/boolean_operations/images/boolean_image048.png}
1373
1374 * 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*.
1375         
1376 @figure{/user_guides/boolean_operations/images/boolean_image049.png}    
1377         
1378 * The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1379
1380
1381 @subsubsection occt_algorithms_9_4_17   Case 17: A Face and a Solid that have a common edge.
1382
1383 Let us consider face *F1* and solid *S2* that have a common part on edge:
1384
1385 @figure{/user_guides/boolean_operations/images/boolean_image050.png}
1386
1387 * 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).
1388         
1389 * 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).
1390
1391 * 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*.
1392         
1393 @figure{/user_guides/boolean_operations/images/boolean_image051.png}    
1394         
1395 * The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1396
1397 @subsubsection occt_algorithms_9_4_18   Case 18: A Face and a Solid that have a common vertex.
1398
1399 Let us consider face *F1* and solid *S2* that have a common part on vertex:
1400
1401 @figure{/user_guides/boolean_operations/images/boolean_image052.png}
1402
1403 * 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).
1404         
1405 * 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).
1406
1407 * 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*.
1408         
1409 @figure{/user_guides/boolean_operations/images/boolean_image053.png}    
1410         
1411 * The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1412
1413 @subsubsection occt_algorithms_9_4_19   Case 19: Two intersecting Solids.
1414
1415 Let us consider two intersecting solids *S1* and *S2*:
1416
1417 @figure{/user_guides/boolean_operations/images/boolean_image054.png}
1418
1419 * The result of *Fuse* operation is a compound composed from the split parts of arguments *S11, S12* and *S22* *(Cut12, Common, Cut21)*. All inner webs are removed, so the result is one new solid *R*. 
1420         
1421 @figure{/user_guides/boolean_operations/images/boolean_image055.png}    
1422         
1423 * 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*. 
1424
1425 @figure{/user_guides/boolean_operations/images/boolean_image056.png}    
1426
1427 * The result of *Cut12* operation is a compound containing split part of the argument *S1*, i.e. 1 new solid *S11*.
1428         
1429 @figure{/user_guides/boolean_operations/images/boolean_image057.png}    
1430         
1431 * The result of *Cut21* operation is a compound containing split part of the argument *S2*, i.e. 1 new solid *S21*.
1432
1433 @figure{/user_guides/boolean_operations/images/boolean_image058.png}
1434
1435 @subsubsection occt_algorithms_9_4_20   Case 20: Two Solids that have a shared face.
1436
1437 Let us consider two solids *S1* and *S2* that have a common part on face:
1438
1439 @figure{/user_guides/boolean_operations/images/boolean_image059.png}
1440
1441 * The result of *Fuse* operation is a compound composed from the split parts of arguments *S11, S12* and *S22* *(Cut12, Common, Cut21)*. All inner webs are removed, so the result is one new solid *R*. 
1442         
1443 @figure{/user_guides/boolean_operations/images/boolean_image060.png}    
1444         
1445 * 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). 
1446
1447 * The result of *Cut12* operation is a compound containing split part of the argument *S1*, i.e. 1 new solid *S11*.
1448         
1449 @figure{/user_guides/boolean_operations/images/boolean_image061.png}    
1450         
1451 * The result of *Cut21* operation is a compound containing split part of the argument *S2*, i.e. 1 new solid *S21*.
1452 @figure{/user_guides/boolean_operations/images/boolean_image062.png}
1453
1454
1455 @subsubsection occt_algorithms_9_4_21   Case 21: Two Solids that have a shared edge.
1456
1457 Let us consider two solids *S1* and *S2* that have a shared edge:
1458
1459 @figure{/user_guides/boolean_operations/images/boolean_image063.png}
1460
1461 * 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*.
1462         
1463 @figure{/user_guides/boolean_operations/images/boolean_image064.png}    
1464         
1465 * 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). 
1466
1467 * The result of *Cut12* operation is a compound containing split part of the argument *S1*. In this case 
1468 argument *S1* has a common part with solid *S2* so the corresponding part is not included into the result.
1469         
1470 @figure{/user_guides/boolean_operations/images/boolean_image065.png}    
1471         
1472 * The result of *Cut21* operation is a  compound containing split part of the argument *S2*. In this case 
1473 argument *S2* has a common part with solid *S1* so the corresponding part is not included into the result.
1474 @figure{/user_guides/boolean_operations/images/boolean_image066.png}
1475
1476 @subsubsection occt_algorithms_9_4_22   Case 22: Two Solids that have a shared vertex.
1477
1478 Let us consider two solids *S1* and *S2* that have a shared vertex:
1479
1480 @figure{/user_guides/boolean_operations/images/boolean_image067.png}
1481
1482 * 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 *Vn1*.
1483         
1484 @figure{/user_guides/boolean_operations/images/boolean_image068.png}    
1485         
1486 * The result of *Common* operation is an  empty compound because the dimension (1) of the common part between *S1* and *S2* (vertex) is less than the lower dimension of the arguments (3). 
1487
1488 * The result of *Cut12* operation is a compound containing split part of the argument *S1*. In this case 
1489 argument *S1* has a common part with solid *S2* so the corresponding part is not included into the result.
1490         
1491 @figure{/user_guides/boolean_operations/images/boolean_image069.png}    
1492         
1493 * The result of *Cut21* operation is a  compound containing split part of the argument *S2*. In this case 
1494 argument *S2* has a common part with solid *S1* so the corresponding part is not included into the result.
1495
1496 @figure{/user_guides/boolean_operations/images/boolean_image070.png}
1497
1498
1499 @subsection occt_algorithms_9_5 Class BOPAlgo_BOP
1500
1501 BOA is implemented in the class *BOPAlgo_BOP*. The main fields of this class are described in the Table:
1502
1503 | Name | Contents |
1504 | :---- | :--- |        
1505 | *myOperation* | The type of the Boolean operation (Common, Fuse, Cut) |
1506 | *myArgs[2]* | The arguments |
1507 | *myDims[2]* | The values of the dimensions of the arguments |
1508 | *myRC* | The draft result (shape) |
1509
1510 The main steps of the *BOPAlgo_BOP* are the same as of @ref occt_algorithms_7_4 "BOPAlgo_Builder" except for some aspects described in the next paragraphs.
1511
1512 @subsection occt_algorithms_9_6 Building Draft Result
1513
1514 The input data for this step is as follows:
1515 * *BOPAlgo_BOP* object after building result of type *Compound*;
1516 * *Type* of the Boolean operation.
1517
1518 | No | Contents | Implementation |
1519 | :---- | :----- | :----- | 
1520 | 1 |   For the Boolean operation *Fuse* add to *myRC* all images of arguments. | *BOPAlgo_BOP::BuildRC()* |
1521 | 2 |   For the Boolean operation *Common* or *Cut* add to *myRC* all images of argument *S1* that are
1522 *Common* for the Common operation and are *Not Common* for the Cut operation |  *BOPAlgo_BOP::BuildRC()* |
1523  
1524 @subsection occt_algorithms_9_7 Building the Result
1525
1526 The input data for this step is as follows:
1527 * *BOPAlgo_BOP* object the state after building draft result. 
1528
1529 | No | Contents | Implementation |
1530 | :---- | :---- | :------ |
1531 | 1 | For the Type of the Boolean operation Common, Cut and *myDim[0] < 3* | |
1532 | 1.1 | Compute minimal dimension *Dmin = min(myDim[0], myDim[1])*      | *BOPAlgo_BOP:: BuildShape()* |
1533 | 1.2 | Make connexity blocks from sub-shapes of *myRS*, taking into account the value of *Dmin* |      *BOPTools_Tools::MakeConnexityBlocks()* |
1534 | 1.3 | Build the result from shapes made from the connexity blocks | *BOPAlgo_BOP:: BuildShape()* |
1535 | 2     | For the Type of the Boolean operation Common, Cut and *myDim[0] = 3* | |      
1536 | 2.1 | *myShape = myRC* | BOPAlgo_BOP::BuildShape () |
1537 | 3     | For the Type of the Boolean operation Fuse and *myDim[0] = 3* | |     
1538 | 3.1 | Find internal faces <i>(FWi)</i> in *myRC* | *BOPAlgo_BOP::BuildSolid()* |
1539 | 3.2 | Collect all faces of *myRC* except for internal faces <i>(FWi) -> SFS</i> | *BOPAlgo_BOP::BuildSolid ()* |
1540 | 3.3 | Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
1541 | 3.4 | Add the solids <i>(SDi)</i> to the result       | |
1542
1543 @section occt_algorithms_10     Algorithm Limitations 
1544
1545 The 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.
1546
1547 A lot of bugs and failures of GFA algorithm can be caused by problems in low-level algorithms: Intersection Algorithm, Projection Algorithm, Approximation Algorithm, Classification Algorithm, etc.
1548 * 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.
1549 * 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. 
1550 * 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.
1551
1552 The 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.
1553
1554
1555 @subsection occt_algorithms_10_1        Arguments
1556
1557 @subsubsection occt_algorithms_10_1_1   Common requirements 
1558
1559 Each 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.
1560
1561 The 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.
1562
1563 However, 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.
1564
1565 Let us consider the following example:
1566
1567 The 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 pre-defined value (e.g. 23). 
1568
1569 Let us consider the case when edge *E* is recognized valid (in terms of *BRepCheck_Analyzer*).
1570
1571 Further, 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*. 
1572
1573 Let 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*. 
1574
1575 Thus, 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*.
1576
1577 The 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.
1578
1579 @subsubsection occt_algorithms_10_1_3   Pure self-interference
1580
1581 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) should share these entities.
1582
1583 #### Example 1: Compound of two edges
1584 The compound of two edges *E1* and *E2* is a self-interfered shape and cannot be used as the argument of the Algorithms.
1585
1586 @figure{/user_guides/boolean_operations/images/operations_image036.svg, "Compound of two edges"}
1587
1588 #### Example 2: Self-interfered Edge
1589 The edge *E* is a self-interfered shape and cannot be used as an argument of the Algorithms.
1590
1591 @figure{/user_guides/boolean_operations/images/operations_image037.svg, "Self-interfered Edge"}
1592  
1593 #### Example 3: Self-interfered Face
1594 The face *F* is a self-interfered shape and cannot be used as an argument of the Algorithms.
1595
1596 @figure{/user_guides/boolean_operations/images/operations_image038.svg, "Self-interfered Face"}
1597  
1598 ####    Example 4: Face of Revolution
1599 The face *F* has been obtained by revolution of edge *E* around line *L*.
1600
1601 @figure{/user_guides/boolean_operations/images/operations_image039a.png, "Face of Revolution: Arguments"} 
1602 @figure{/user_guides/boolean_operations/images/operations_image039b.png, "Face of Revolution: Result"} 
1603
1604 In 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.
1605
1606 @subsubsection occt_algorithms_10_1_4   Self-interferences due to tolerances
1607 #### Example 1: Non-closed Edge
1608
1609 Let us consider edge *E* based on a non-closed circle. @figure{/user_guides/boolean_operations/images/operations_image040.png, "Edge based on a non-closed circle"}
1610
1611 The distance between the vertices of *E* is *D=0.69799*. The values of the tolerances *Tol(V1)=Tol(V2)=0.5*.
1612 @figure{/user_guides/boolean_operations/images/operations_image041.png,  "Distance and Tolerances"}
1613  
1614 In 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.
1615
1616 #### Example 2: Solid containing an interfered vertex
1617
1618 Let us consider solid *S* containing vertex V. @figure{/user_guides/boolean_operations/images/operations_image042.png,  "Solid containing an interfered vertex"}
1619
1620 The value of  tolerance Tol(V)= 50.000075982061.
1621
1622 @figure{/user_guides/boolean_operations/images/operations_image043.png,  "Tolerance"}
1623
1624 In 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.
1625
1626 @subsubsection occt_algorithms_10_1_5 Parametric representation
1627 The parameterization of some surfaces (cylinder, cone, surface of revolution) can be the cause of limitation.
1628
1629 ####    Example 1: Cylindrical surface
1630 The parameterization range for cylindrical surface is:
1631
1632 ~~~~
1633 U: [0, 2π], V: ]-∞, + ∞[
1634 ~~~~
1635
1636 The range of *U* coordinate is always restricted while the range of *V* coordinate is non-restricted.
1637
1638 Let us consider a cylinder-based *Face 1* with radii *R=3* and *H=6*. 
1639
1640 @figure{/user_guides/boolean_operations/images/operations_image044.png, "Face 1"}
1641
1642 @figure{/user_guides/boolean_operations/images/operations_image045.png, "P-Curves for Face 1"}
1643
1644 Let 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*). 
1645
1646 @figure{/user_guides/boolean_operations/images/operations_image046.png, "Face 2"}
1647
1648 @figure{/user_guides/boolean_operations/images/operations_image047.png, "P-Curves for Face 2"}
1649
1650 Please, pay attention to the Zoom value of the Figures.
1651
1652 It 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.
1653
1654
1655 @subsubsection occt_algorithms_10_1_6   How to fix gaps using tolerance
1656
1657 It is possible to create shapes that use sub-shapes of lower order to avoid gaps in the tolerance-based data model.
1658
1659 Let us consider the following example:
1660
1661 @figure{/user_guides/boolean_operations/images/operations_image048.png, "Example"}
1662
1663 * Face *F* has two edges *E1* and *E2* and two vertices, the base plane is <i>{0,0,0, 0,0,1}</i>;
1664 * Edge *E1* is based on line <i>{0,0,0, 1,0,0}, Tol(E1) = 1.e-7; </i>
1665 * Edge *E2* is based on line <i>{0,1,0, 1,0,0}, Tol(E2) = 1.e-7;</i>
1666 * Vertex *V1*, point <i>{0,0.5,0}, Tol(V1) = 1;</i>
1667 * Vertex *V2*, point <i>{10,0.5,0}, Tol(V2) = 1;</i>
1668 * Face *F* is valid (in terms of *BRepCheck_Analyzer*).
1669  
1670 The 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. 
1671
1672
1673 @subsection occt_algorithms_11_1        Intersection problems
1674 @subsubsection occt_algorithms_11_1_1 Pure intersections and common zones 
1675
1676 #### Example: Intersecting Edges
1677
1678 Let us consider the intersection between two edges:
1679 * *E1* is based on a line: <i>{0,-10,0, 1,0,0}, Tol(E1)=2.</i>
1680 * *E2* is based on a circle: <i>{0,0,0, 0,0,1}, R=10, Tol(E2)=2.</i>
1681
1682 @figure{/user_guides/boolean_operations/images/operations_image049.png, "Intersecting Edges"} 
1683
1684 The result of pure intersection between *E1* and *E2* is vertex *Vx {0,-10,0}*.
1685
1686 The 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. 
1687
1688 The Intersection Part of Algorithms uses the result of pure intersection *Vx* instead of *CZ* for the following reasons: 
1689 * 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.
1690 * The algorithm of intersection between two surfaces *IntPatch_Intersection* does not compute *CZ* of the intersection between curves and points. So even if *CZ* is computed by Edge/Edge intersection algorithm, its result cannot be treated by Face/Face intersection algorithm.
1691
1692 @subsubsection occt_algorithms_11_2_2 Tolerances and inaccuracies
1693
1694 The following limitations result from modeling errors or inaccuracies.
1695
1696 #### Example: Intersection of planar faces
1697
1698 Let us consider two planar rectangular faces *F1* and *F2*.
1699
1700 The 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, EC12)* go through two vertices, which is  impossible in this case.
1701
1702 @figure{/user_guides/boolean_operations/images/operations_image050.svg, "Intersecting Faces"} 
1703
1704
1705 The 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.
1706
1707 In a particular case the problem can be solved in several ways:
1708 * Reduce, if possible, the values of *Tol(V1)* and *Tol(V2)* (refinement of *F1*).
1709 * 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*.
1710
1711 It is easy to see that if *C12* is slightly above the tolerance spheres of *V1* and *V2* the problem does not appear. 
1712
1713 #### Example: Intersection of two edges
1714
1715 Let 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>.*
1716
1717 *C1* practically coincides in 3D with *C2*. The value of deflection is *Dmax* (e.g. *Dmax=1.e<sup>-6</sup>*). 
1718
1719 @figure{/user_guides/boolean_operations/images/operations_image051.svg, "Intersecting Edges"} 
1720
1721 The evident and prospective result should be the Common Block between *E1* and *E2*. However, the result of intersection differs. 
1722
1723 @figure{/user_guides/boolean_operations/images/operations_image052.svg, "Result of Intersection"} 
1724
1725 However, the result contains three new vertices *Vx1, Vx2* and *Vx3*, 8 new edges *(V1, Vx1, Vx2, Vx3, V2)* 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 *Dmax=1.e<sup>-6</sup>.
1726
1727 In this particular case the problem can be solved by several ways:
1728 * Increase, if possible, the values *Tol(E1)* and *Tol(E2)* to get coincidence in 3D between *E1* and *E2* in terms of tolerance.
1729 * Replace *E1* by a more accurate model.
1730
1731 The example can be extended from 1D (edges) to 2D (faces).
1732
1733 @figure{/user_guides/boolean_operations/images/operations_image053.svg, "Intersecting Faces"} 
1734
1735 The comments and recommendations are the same as for 1D case above.
1736
1737
1738 @subsubsection occt_algorithms_11_2_3 Acquired Self-interferences
1739 ####    Example 1: Vertex and edge
1740
1741 Let us consider vertex *V1* and edge *E2*. 
1742
1743 @figure{/user_guides/boolean_operations/images/operations_image054.svg, "Vertex and Edge"} 
1744
1745 Vertex *V1* interferes with vertices *V12* and *V22*.
1746 So 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*.
1747
1748 The 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*).
1749
1750 In 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)*.
1751
1752 It is easy to see that if *E2* is slightly above than tolerance sphere of *V1* the problem does not appear at all.
1753
1754 #### Example 2: Vertex and wire
1755   
1756 Let us consider vertex *V2* and wire consisting of edges *E11* and *E12*. 
1757
1758 @figure{/user_guides/boolean_operations/images/operations_image055.svg, "Vertex and Wire"} 
1759
1760 The arguments themselves are not self-intersected.
1761 Vertex *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.
1762  
1763 The 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.
1764
1765 @section occt_algorithms_12     Appendix
1766
1767 @subsection occt_algorithms_12_1        Building faces from set of edges 
1768
1769 The algorithm builds a set of faces from a surface and a set of edges having p-curves on the surface. 
1770
1771 @subsubsection occt_algorithms_12_1_1   Terms and definitions
1772
1773 * **Original Face** - the source face *F* having an underlying surface *S* that is used as 2D domain.
1774 * **ES** - a set of source edges having p-curves on surface *S*.
1775 * **Contour** - a set of edges that is subset of *ES*.
1776 * **Loop** - a closed Contour (in 2D).
1777 * **Hole** - a Loop that has a negative mass property.
1778 * **Growth** - a Loop that has a positive mass property.
1779 * **Area** - a set of Loops within the one Growth and a number of Holes that are inside the Growth.
1780 * **Deadlock** - a Contour that cannot be used as a Loop.
1781 * **Result** - a set of faces LFR.
1782
1783 See the illustration for the terms in the image:
1784
1785 @figure{/user_guides/boolean_operations/images/operations_image056.svg, "Terms and definitions"}
1786
1787  
1788 @subsubsection occt_algorithms_12_1_2   Class BOPAlgo_BuilderArea
1789 The class *BOPAlgo_BuilderArea* is a root class for implementations of algorithms to build areas (faces, solids) from a set of components (edges, faces).
1790
1791 @figure{/user_guides/boolean_operations/images/operations_image057.svg, "Class inheritance diagram"}
1792
1793 The main fields of the class *BOPAlgo_BuilderArea* are described in the Table: 
1794
1795 | Name | Contents |
1796 | :---- | :---- |
1797 | *myContext* | Pointer to the intersection Context |
1798 | *myShapes* | Container for source shapes (edges, faces) |
1799 | *myLoops*     | Container for Loops | 
1800 | *myAreas* | Container for Areas |
1801 | *myShapesToAvoid* | Container for Deadlocks |
1802
1803 @subsubsection occt_algorithms_12_1_3   Class BOPAlgo_BuilderFace
1804
1805 The class *BOPAlgo_BuilderFace* implements the algorithm to build faces from a set of edges. 
1806
1807 The main fields of the class BOPAlgo_BuilderFace are described in the Table:
1808
1809 | Name  | Contents |
1810 | :---- | :----- |
1811 | *myFace* | Original face |
1812
1813 The main steps of the algorithm are described in the Table:
1814
1815 | No | Contents | Implementation  |
1816 | :---- | :---- | :----- |
1817 | 1     | Collect the Deadlocks <i>(myShapesToAvoid)</i>. | *BOPAlgo_BuilderFace::PerformShapesToAvoid()* | 
1818 | 2     | Build Loops <i>(myLoops)</i>.  | *BOPAlgo_BuilderFace::PerformLoops()*, *BOPAlgo_WireSplitter* |
1819 | 3     | Classify the Loops and build Areas <i>(myAreas)</i> | *BOPAlgo_BuilderFace::PerformAreas()* |
1820 | 4     | Add internal shapes to the Areas | *BOPAlgo_BuilderFace::PerformInternalShapes()* |
1821 | 5     | Build the Result using the Areas and *myFace*. |      *BOPAlgo_BuilderFace::PerformInternalShapes()* |
1822
1823 @subsubsection occt_algorithms_12_1_4   Class BOPAlgo_WireSplitter
1824
1825 The class *BOPAlgo_WireSplitter* implements the algorithm to build Loops from a set of edges *ES* and face *F*.
1826  
1827 The main idea is to trace paths (in 2D) along the edges from the ES using the following conditions:
1828 * Connectivity of the edges through vertices.
1829 * Minimal clockwise angle (in 2D) between adjacent edges.
1830 * Loop is closed.
1831
1832 See the illustration in the figure:
1833
1834 @figure{/user_guides/boolean_operations/images/operations_image058.svg}
1835
1836 The input edges are *E1, E2...E16*. The edges in parentheses <i>(E11, E15), (E12, E16), (E9, E13), (E10, E14)</i> are the same with different orientations.
1837
1838 The angles <i>βij</i> are computed in the node *k* between the direction of the edge that enters in the node *Ei* and all directions of the edges *j* that leave the node.
1839 * Let us start from edge *E3*;
1840 * For node *A* and entering edge *E3* there are 3 leaving edges *E10, E15* and *E4* and three angles: 
1841         * <i>β<sub>3,10</sub>=angle(E3, E10),</i>
1842         * <i>β<sub>3,15</sub>=angle(E3, E15),</i> 
1843         * <i>β<sub>3,4</sub>=angle(E3, E4).</i>
1844 * The minimal clockwise angle is <i>β<sub>3,10</sub>,</i> so:
1845         * edge *E10* will be next to edge *E3*;
1846         * edge *E2* will be next to edge *E10*.
1847 * The edges *E3, E10* and *E2* form Loop *L1*.
1848 * Let us start from the next non-processed edge (e.g. for *E4*).
1849 * ... and so on
1850
1851 The  main steps of the algorithm are as follows:
1852
1853 | No | Contents | Implementation |
1854 | :---- | :---- | :----- |
1855 | 1     | Build connexity blocks *CBi(i=1,2…NbCB)*, where *NbCB* is the number of connexity blocks from the ES. |     *BOPAlgo_WireSplitter::MakeConnexityBlocks()* |  
1856 | 2     | For each connexity block *CBi*: a) Compute angles <i>βij</i> for each node (for entering and leaving edges); b) Compute Loops |      *BOPAlgo_WireSplitter::SplitBlock()* |
1857
1858
1859 @subsection occt_algorithms_12_2        Building solids from set of faces
1860 The algorithm is to build a set of solids from a set of faces.
1861
1862 @subsubsection occt_algorithms_12_2_1   Terms and definitions
1863
1864 * **FS** - a set of source faces.
1865 * **Contour** - a set of faces that is subset of FS.
1866 * **Loop** - a closed Contour (in 3D).
1867 * **Hole** - a Loop that has a negative mass property.
1868 * **Growth** - a Loop that has a positive mass property.
1869 * **Area** - a set of Loops within the one Growth and a number of Holes that are inside the Growth.
1870 * **Deadlock** - a Contour that cannot be used as a Loop.
1871 * **Result** - a set of solids *LSo*.
1872
1873 @subsubsection occt_algorithms_12_2_2   Class BOPAlgo_BuilderSolid
1874
1875 The class *BOPAlgo_BuilderSolid* contains the implementation of the algorithm to build solids from a set of faces.
1876 The content of the main steps of the algorithm is described in the Table.
1877
1878 | No | Contents | Implementation |
1879 | :--- | :--- | :---- | 
1880 | 1 | Collect the Deadlocks <i>(myShapesToAvoid)</i>. | *BOPAlgo_BuilderSolid::PerformShapesToAvoid()* |
1881 | 2 | Build Loops <i>(myLoops)</i>. | *BOPAlgo_BuilderSolid::PerformLoops()* |
1882 | 3     | Classify the Loops and build Areas <i>(myAreas)</i>. | *BOPAlgo_BuilderSolid::PerformAreas()* |
1883 | 4     | Add to Areas the internal shapes. | *BOPAlgo_BuilderSolid::PerformInternalShapes()* |
1884 | 5     | Build the Result using the Areas and *myFace*. | *BOPAlgo_BuilderSolid::PerformInternalShapes()* |
1885
1886 @subsection occt_algorithms_12_3        Packaging
1887
1888 The following packages contain the implementation of the algorithm:
1889
1890 | No | Name     | Contents |
1891 | :---- | :---- | :---- |
1892 | 1     | *BOPCol* | Collection classes for all algorithms |
1893 | 2     | *BOPInt* | Auxiliary classes for IP |
1894 | 3     | *BOPDS* |     DS and a set of auxiliary classes for DS |
1895 | 4     | *BOPTools* | Auxiliary classes for BP |
1896 | 5     | *BOPAlgo* | IP, BP |
1897 | 6     | *BOPTest* | Testing commands for Draw application |
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908