0026619: Tolerances of operands are modified using bop
[occt.git] / src / BOPDS / BOPDS_Interf.hxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
4e57c75e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
4e57c75e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
4e57c75e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
4e57c75e 14
15#ifndef BOPDS_Interf_HeaderFile
16#define BOPDS_Interf_HeaderFile
17
4e57c75e 18#include <IntTools_CommonPrt.hxx>
4e57c75e 19#include <NCollection_BaseAllocator.hxx>
20#include <BOPDS_VectorOfCurve.hxx>
21#include <BOPDS_VectorOfPoint.hxx>
ebc93ae7 22
4e57c75e 23/**
24 * The class BOPDS_Interf is is to store the information about
25 * the interference between two shapes.
26 * The class BOPDS_Interf is root class
27 *
28*/
29//=======================================================================
30//function : BOPDS_Interf
31//purpose :
32//=======================================================================
33class BOPDS_Interf {
34 public:
35 //
36 /**
37 * Sets the indices of interferred shapes
38 * @param theIndex1
39 * index of the first shape
40 * @param theIndex2
41 * index of the second shape
42 */
43 void SetIndices(const Standard_Integer theIndex1,
f1baf495 44 const Standard_Integer theIndex2) {
4e57c75e 45 myIndex1=theIndex1;
46 myIndex2=theIndex2;
5640d653 47 }
4e57c75e 48 //
49 /**
50 * Returns the indices of interferred shapes
51 * @param theIndex1
52 * index of the first shape
53 * @param theIndex2
54 * index of the second shape
55 */
56 void Indices(Standard_Integer& theIndex1,
f1baf495 57 Standard_Integer& theIndex2) const {
58 theIndex1=myIndex1;
59 theIndex2=myIndex2;
60 }
4e57c75e 61 //
62 /**
63 * Sets the index of the first interferred shape
64 * @param theIndex
65 * index of the first shape
66 */
67 void SetIndex1(const Standard_Integer theIndex) {
68 myIndex1=theIndex;
5640d653 69 }
4e57c75e 70 //
71 /**
72 * Sets the index of the second interferred shape
73 * @param theIndex
74 * index of the second shape
75 */
76 void SetIndex2(const Standard_Integer theIndex) {
77 myIndex2=theIndex;
5640d653 78 }
4e57c75e 79 //
80 /**
81 * Returns the index of the first interferred shape
82 * @return
83 * index of the first shape
84 */
85 Standard_Integer Index1() const {
86 return myIndex1;
5640d653 87 }
4e57c75e 88 //
89 /**
90 * Returns the index of the second interferred shape
91 * @return
92 * index of the second shape
93 */
94 Standard_Integer Index2() const {
95 return myIndex2;
5640d653 96 }
4e57c75e 97 //
98 /**
99 * Returns the index of that are opposite to the given index
100 * @param theI
101 * the index
102 * @return
103 * index of opposite shape
104 */
105 Standard_Integer OppositeIndex(const Standard_Integer theI) const {
106 if (theI==myIndex1) {
107 return myIndex2;
108 }
109 else if(theI==myIndex2) {
110 return myIndex1;
111 }
112 else {
113 return -1;
114 }
5640d653 115 }
4e57c75e 116 //
117 /**
118 * Returns true if the interference contains given index
119 * @param theIndex
120 * the index
121 * @return
122 * true if the interference contains given index
123 */
124 Standard_Boolean Contains(const Standard_Integer theIndex)const {
125 return (myIndex1==theIndex || myIndex2==theIndex);
126 }
127 //
128 /**
129 * Sets the index of new shape
130 * @param theIndex
131 * the index
132 */
133 void SetIndexNew(const Standard_Integer theIndex) {
134 myIndexNew=theIndex;
5640d653 135 }
4e57c75e 136 //
137 //
138 /**
139 * Returns the index of new shape
140 * @return theIndex
141 * the index of new shape
142 */
143 Standard_Integer IndexNew() const {
144 return myIndexNew;
5640d653 145 }
4e57c75e 146 //
147 /**
148 * Returns true if the interference has index of new shape
149 * that is equal to the given index
150 * @param theIndex
151 * the index
152 * @return true if the interference has index of new shape
153 * that is equal to the given index
154 */
155 Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const {
156 theIndex=myIndexNew;
157 return (myIndexNew>=0);
5640d653 158 }
4e57c75e 159 //
160 /**
161 * Returns true if the interference has index of new shape
162 * the index
163 * @return true if the interference has index of new shape
164 */
165 Standard_Boolean HasIndexNew() const {
f1baf495 166 return (myIndexNew+1);
5640d653 167 }
4e57c75e 168 //
169 protected:
170 BOPDS_Interf() :
171 myIndex1(-1),
172 myIndex2(-1),
173 myIndexNew(-1),
174 myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) {
5640d653 175 }
4e57c75e 176 //
177 BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) :
178 myIndex1(-1),
179 myIndex2(-1),
180 myIndexNew(-1),
181 myAllocator(theAllocator) {
5640d653 182 }
4e57c75e 183 //
184 virtual ~BOPDS_Interf() {
5640d653 185 }
4e57c75e 186
f1baf495 187 protected:
4e57c75e 188 Standard_Integer myIndex1;
189 Standard_Integer myIndex2;
190 Standard_Integer myIndexNew;
191 Handle(NCollection_BaseAllocator) myAllocator;
192};
193/**
194 * The class BOPDS_InterfVV is is to store the information about
195 * the interference of the type vertex/vertex.
196*/
197//=======================================================================
198//function : BOPDS_InterfVV
199//purpose :
200//=======================================================================
201class BOPDS_InterfVV : public BOPDS_Interf {
202 public:
203 //
204 /**
205 * Constructor
206 */
207 BOPDS_InterfVV() : BOPDS_Interf() {
5640d653 208 }
4e57c75e 209 //
210 /**
211 * Constructor
212 * @param theAllocator
213 * allocator to manage the memory
214 */
215 BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator)
216 : BOPDS_Interf(theAllocator) {
5640d653 217 }
4e57c75e 218 //
219 /**
220 * Destructor
221 */
222 virtual ~BOPDS_InterfVV() {
5640d653 223 }
4e57c75e 224 //
225};
226/**
227 * The class BOPDS_InterfVE is is to store the information about
228 * the interference of the type vertex/edge.
229*/
230//=======================================================================
231//function : BOPDS_InterfVE
232//purpose :
233//=======================================================================
234class BOPDS_InterfVE : public BOPDS_Interf {
235 public:
236 //
237 /**
238 * Constructor
239 */
240 BOPDS_InterfVE()
241 :
242 BOPDS_Interf(),
243 myParameter(0.) {
5640d653 244 }
4e57c75e 245 //
246 /**
247 * Constructor
248 * @param theAllocator
249 * allocator to manage the memory
250 */
251 BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator)
252 :
253 BOPDS_Interf(theAllocator),
254 myParameter(0.) {
5640d653 255 }
4e57c75e 256 //
257 /**
258 * Destructor
259 */
260 virtual ~BOPDS_InterfVE() {
5640d653 261 }
4e57c75e 262 //
263 /**
264 * Modifier
265 * Sets the value of parameter
266 * of the point of the vertex
267 * on the curve of the edge
268 * @param theT
269 * value of parameter
270 */
271 void SetParameter(const Standard_Real theT) {
272 myParameter=theT;
5640d653 273 }
4e57c75e 274 //
275 /**
276 * Selector
277 * Returrns the value of parameter
278 * of the point of the vertex
279 * on the curve of the edge
280 * @return
281 * value of parameter
282 */
283 Standard_Real Parameter() const {
284 return myParameter;
5640d653 285 }
4e57c75e 286
287 protected:
288 Standard_Real myParameter;
289
290};
291/**
292 * The class BOPDS_InterfVF is is to store the information about
293 * the interference of the type vertex/face
294*/
295//=======================================================================
296//function : BOPDS_InterfVF
297//purpose :
298//=======================================================================
299class BOPDS_InterfVF : public BOPDS_Interf {
300 public:
301 //
302 /**
303 * Constructor
304 */
305 BOPDS_InterfVF()
306 : BOPDS_Interf(),
307 myU(0.),
308 myV(0.) {
5640d653 309 }
4e57c75e 310 //
311 /**
312 * Constructor
313 * @param theAllocator
314 * allocator to manage the memory
315 */
316 BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator)
317 : BOPDS_Interf(theAllocator),
318 myU(0.),
319 myV(0.) {
5640d653 320 }
4e57c75e 321 //
322 /**
323 * Destructor
324 */
325 virtual ~BOPDS_InterfVF() {
5640d653 326 }
4e57c75e 327 //
328 /**
329 * Modifier
330 * Sets the value of parameters
331 * of the point of the vertex
332 * on the surface of of the face
333 * @param theU
334 * value of U parameter
335 * @param theV
336 * value of U parameter
337 */
338 void SetUV(const Standard_Real theU,
f1baf495 339 const Standard_Real theV) {
4e57c75e 340 myU=theU;
341 myV=theV;
5640d653 342 }
4e57c75e 343 //
344 /**
345 * Selector
346 * Returns the value of parameters
347 * of the point of the vertex
348 * on the surface of of the face
349 * @param theU
350 * value of U parameter
351 * @param theV
352 * value of U parameter
353 */
354 void UV(Standard_Real& theU,Standard_Real& theV) const {
355 theU=myU;
356 theV=myV;
5640d653 357 }
4e57c75e 358
359 protected:
360 Standard_Real myU;
361 Standard_Real myV;
362
363};
364/**
365 * The class BOPDS_InterfEE is is to store the information about
366 * the interference of the type edge/edge.
367*/
368//=======================================================================
369//function : BOPDS_InterfEE
370//purpose :
371//=======================================================================
372class BOPDS_InterfEE : public BOPDS_Interf {
373 public:
374 //
375 /**
376 * Constructor
377 */
378 BOPDS_InterfEE() : BOPDS_Interf() {
5640d653 379 }
4e57c75e 380 //
381 /**
382 * Constructor
383 * @param theAllocator
384 * allocator to manage the memory
385 */
386 BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator)
387 : BOPDS_Interf(theAllocator) {
5640d653 388 }
4e57c75e 389 //
390 /**
391 * Destructor
392 */
393 virtual ~BOPDS_InterfEE() {
5640d653 394 }
4e57c75e 395 //
396 /**
397 * Modifier
398 * Sets the info of common part
399 * @param theCP
400 * common part
401 */
402 void SetCommonPart(const IntTools_CommonPrt& theCP) {
403 myCommonPart=theCP;
5640d653 404 }
4e57c75e 405 //
406 /**
407 * Selector
408 * Returns the info of common part
409 * @return
410 * common part
411 */
412 const IntTools_CommonPrt& CommonPart() const {
413 return myCommonPart;
5640d653 414 }
4e57c75e 415
416 protected:
417 IntTools_CommonPrt myCommonPart;
418};
419/**
420 * The class BOPDS_InterfEF is is to store the information about
421 * the interference of the type edge/face.
422*/
423//=======================================================================
424//function : BOPDS_InterfEF
425//purpose :
426//=======================================================================
427class BOPDS_InterfEF : public BOPDS_Interf {
428 public:
429 //
430 /**
431 * Constructor
432 */
433 BOPDS_InterfEF(): BOPDS_Interf() {
5640d653 434 }
4e57c75e 435 //
436 /**
437 * Constructor
438 * @param theAllocator
439 * allocator to manage the memory
440 */
441 /**
442 * Constructor
443 * @param theAllocator
444 * allocator to manage the memory
445 */
446 BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator)
447 : BOPDS_Interf(theAllocator) {
5640d653 448 }
4e57c75e 449 //
450 /**
451 * Destructor
452 */
453 virtual ~BOPDS_InterfEF() {
5640d653 454 }
4e57c75e 455 //
456 /**
457 * Modifier
458 * Sets the info of common part
459 * @param theCP
460 * common part
461 */
462 void SetCommonPart(const IntTools_CommonPrt& theCP){
463 myCommonPart=theCP;
5640d653 464 }
4e57c75e 465 //
466 /**
467 * Selector
468 * Returns the info of common part
469 * @return
470 * common part
471 */
472 const IntTools_CommonPrt& CommonPart() const {
473 return myCommonPart;
5640d653 474 }
4e57c75e 475 //
476 protected:
477 IntTools_CommonPrt myCommonPart;
478}
479/**
480 * The class BOPDS_InterfFF is is to store the information about
481 * the interference of the type face/face.
482*/;
483//=======================================================================
484//function : BOPDS_InterfFF
485//purpose :
486//=======================================================================
487class BOPDS_InterfFF : public BOPDS_Interf {
488 public:
489 //
490 /**
491 * Constructor
492 */
493 BOPDS_InterfFF()
494 :
495 BOPDS_Interf(),
7ff8f019 496 myTangentFaces(Standard_False),
4e57c75e 497 myTolR3D(1.e-7),
498 myTolR2D(1.e-7),
3510db62 499 myTolReal(1.e-7),
402bfe81 500 myCurves(0, myAllocator),
501 myPoints(0, myAllocator)
502 {
5640d653 503 }
4e57c75e 504 //
505 /**
4e57c75e 506 * Destructor
507 */
508 virtual ~BOPDS_InterfFF() {
5640d653 509 }
4e57c75e 510 //
511 /**
512 * Initializer
513 * @param theNbCurves
514 * number of intersection curves
515 * @param theNbPoints
516 * number of intersection points
517 */
402bfe81 518
a82b7ef7 519 void Init(const Standard_Integer theNbCurves,
520 const Standard_Integer theNbPoints) {
402bfe81 521 //modified by NIZNHY-PKV Mon Jan 26 09:01:06 2015f
522 if (theNbCurves>0) {
523 myCurves.SetIncrement(theNbCurves);
524 }
525 if (theNbPoints>0) {
526 myPoints.SetIncrement(theNbPoints);
527 }
528 /*
a82b7ef7 529 if (theNbCurves>0) {
4e57c75e 530 myCurves.SetStartSize(theNbCurves);
531 myCurves.SetIncrement(theNbCurves);
532 myCurves.Init();
533 }
a82b7ef7 534 if (theNbPoints>0) {
4e57c75e 535 myPoints.SetStartSize(theNbPoints);
536 myPoints.SetIncrement(theNbPoints);
537 myPoints.Init();
538 }
402bfe81 539 */
540 //modified by NIZNHY-PKV Mon Jan 26 09:01:12 2015t
4e57c75e 541 }
7ff8f019 542 /**
543 * Modifier
544 * Sets the flag of whether the faces are tangent
545 * @param theFlag
546 * the flag
547 */
548 void SetTangentFaces(const Standard_Boolean theFlag) {
549 myTangentFaces=theFlag;
550 }
551 /**
552 * Selector
553 * Returns the flag whether the faces are tangent
554 * @return
555 * the flag
556 */
557 Standard_Boolean TangentFaces()const {
558 return myTangentFaces;
559 }
4e57c75e 560 /**
561 * Modifier
562 * Sets the value of 3D tolerance
563 * @param theTol
564 * 3D tolerance
565 */
566 void SetTolR3D(const Standard_Real theTol) {
567 myTolR3D=theTol;
568 }
569 //
570 /**
571 * Selector
572 * Returns the value of 3D tolerance
573 * @return
574 * 3D tolerance
575 */
576 Standard_Real TolR3D()const {
577 return myTolR3D;
578 }
579 //
580 /**
581 * Modifier
582 * Sets the value of 2D tolerance
583 * @param theTol
584 * 2D tolerance
585 */
586 void SetTolR2D(const Standard_Real theTol) {
587 myTolR2D=theTol;;
588 }
589 //
590 /**
591 * Selector
592 * Returns the value of 2D tolerance
593 * @return
594 * 2D tolerance
595 */
596 Standard_Real TolR2D()const {
597 return myTolR2D;
598 }
3510db62 599 /**
600 * Modifier
601 * Sets the value of real not increased 3D tolerance
602 * @param theTol
603 * 3D tolerance
604 */
605 void SetTolReal(const Standard_Real theTol) {
606 myTolReal = theTol;
607 }
608 //
609 /**
610 * Selector
611 * Returns the value of real not increased 3D tolerance
612 * @return
613 * 3D tolerance
614 */
615 Standard_Real TolReal()const {
616 return myTolReal;
617 }
4e57c75e 618 //
619 /**
620 * Selector
621 * Returns the intersection curves
622 * @return
623 * intersection curves
624 */
625 const BOPDS_VectorOfCurve& Curves()const{
626 return myCurves;
5640d653 627 }
4e57c75e 628 //
629 /**
630 * Selector/Modifier
631 * Returns the intersection curves
632 * @return
633 * intersection curves
634 */
635 BOPDS_VectorOfCurve& ChangeCurves(){
636 return myCurves;
5640d653 637 }
4e57c75e 638 //
639 /**
640 * Selector
641 * Returns the intersection points
642 * @return
643 * intersection points
644 */
645 const BOPDS_VectorOfPoint& Points()const{
646 return myPoints;
5640d653 647 }
4e57c75e 648 //
649 /**
650 * Selector/Modifier
651 * Returns the intersection points
652 * @return
653 * intersection points
654 */
655 BOPDS_VectorOfPoint& ChangePoints(){
656 return myPoints;
5640d653 657 }
4e57c75e 658 //
659 protected:
7ff8f019 660 Standard_Boolean myTangentFaces;
4e57c75e 661 Standard_Real myTolR3D;
662 Standard_Real myTolR2D;
3510db62 663 Standard_Real myTolReal;
4e57c75e 664 BOPDS_VectorOfCurve myCurves;
665 BOPDS_VectorOfPoint myPoints;
666};
667
ceaa5e27 668/**
669 * The class BOPDS_InterfVZ is is to store the information about
670 * the interference of the type vertex/solid.
671*/
672//=======================================================================
673//function : BOPDS_InterfVZ
674//purpose :
675//=======================================================================
676class BOPDS_InterfVZ : public BOPDS_Interf {
677 public:
678 //
679 /**
680 * Constructor
681 */
682 BOPDS_InterfVZ() : BOPDS_Interf() {
683 };
684 //
685 /**
686 * Constructor
687 * @param theAllocator
688 * allocator to manage the memory
689 */
690 BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator)
691 : BOPDS_Interf(theAllocator) {
692 };
693 //
694 /**
695 * Destructor
696 */
697 virtual ~BOPDS_InterfVZ() {
698 };
699 //
700};
701/**
702 * The class BOPDS_InterfEZ is is to store the information about
703 * the interference of the type edge/solid.
704*/
705//=======================================================================
706//function : BOPDS_InterfEZ
707//purpose :
708//=======================================================================
709class BOPDS_InterfEZ : public BOPDS_Interf {
710 public:
711 //
712 /**
713 * Constructor
714 */
715 BOPDS_InterfEZ() : BOPDS_Interf() {
716 };
717 //
718 /**
719 * Constructor
720 * @param theAllocator
721 * allocator to manage the memory
722 */
723 BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator)
724 : BOPDS_Interf(theAllocator) {
725 };
726 //
727 /**
728 * Destructor
729 */
730 virtual ~BOPDS_InterfEZ() {
731 };
732 //
733};
734/**
735 * The class BOPDS_InterfFZ is is to store the information about
736 * the interference of the type face/solid.
737*/
738//=======================================================================
739//function : BOPDS_InterfFZ
740//purpose :
741//=======================================================================
742class BOPDS_InterfFZ : public BOPDS_Interf {
743 public:
744 //
745 /**
746 * Constructor
747 */
748 BOPDS_InterfFZ() : BOPDS_Interf() {
749 };
750 //
751 /**
752 * Constructor
753 * @param theAllocator
754 * allocator to manage the memory
755 */
756 BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator)
757 : BOPDS_Interf(theAllocator) {
758 };
759 //
760 /**
761 * Destructor
762 */
763 virtual ~BOPDS_InterfFZ() {
764 };
765 //
766};
767/**
768 * The class BOPDS_InterfZZ is is to store the information about
769 * the interference of the type solid/solid.
770*/
771//=======================================================================
772//function : BOPDS_InterfZZ
773//purpose :
774//=======================================================================
775class BOPDS_InterfZZ : public BOPDS_Interf {
776 public:
777 //
778 /**
779 * Constructor
780 */
781 BOPDS_InterfZZ() : BOPDS_Interf() {
782 };
783 //
784 /**
785 * Constructor
786 * @param theAllocator
787 * allocator to manage the memory
788 */
789 BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator)
790 : BOPDS_Interf(theAllocator) {
791 };
792 //
793 /**
794 * Destructor
795 */
796 virtual ~BOPDS_InterfZZ() {
797 };
798 //
799};
800
4e57c75e 801#endif