1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef BOPDS_Interf_HeaderFile
16 #define BOPDS_Interf_HeaderFile
18 #include <IntTools_CommonPrt.hxx>
19 #include <NCollection_BaseAllocator.hxx>
20 #include <BOPDS_VectorOfCurve.hxx>
21 #include <BOPDS_VectorOfPoint.hxx>
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
29 //=======================================================================
30 //function : BOPDS_Interf
32 //=======================================================================
37 * Sets the indices of interferred shapes
39 * index of the first shape
41 * index of the second shape
43 void SetIndices(const Standard_Integer theIndex1,
44 const Standard_Integer theIndex2) {
50 * Returns the indices of interferred shapes
52 * index of the first shape
54 * index of the second shape
56 void Indices(Standard_Integer& theIndex1,
57 Standard_Integer& theIndex2) const {
63 * Sets the index of the first interferred shape
65 * index of the first shape
67 void SetIndex1(const Standard_Integer theIndex) {
72 * Sets the index of the second interferred shape
74 * index of the second shape
76 void SetIndex2(const Standard_Integer theIndex) {
81 * Returns the index of the first interferred shape
83 * index of the first shape
85 Standard_Integer Index1() const {
90 * Returns the index of the second interferred shape
92 * index of the second shape
94 Standard_Integer Index2() const {
99 * Returns the index of that are opposite to the given index
103 * index of opposite shape
105 Standard_Integer OppositeIndex(const Standard_Integer theI) const {
106 if (theI==myIndex1) {
109 else if(theI==myIndex2) {
118 * Returns true if the interference contains given index
122 * true if the interference contains given index
124 Standard_Boolean Contains(const Standard_Integer theIndex)const {
125 return (myIndex1==theIndex || myIndex2==theIndex);
129 * Sets the index of new shape
133 void SetIndexNew(const Standard_Integer theIndex) {
139 * Returns the index of new shape
141 * the index of new shape
143 Standard_Integer IndexNew() const {
148 * Returns true if the interference has index of new shape
149 * that is equal to the given index
152 * @return true if the interference has index of new shape
153 * that is equal to the given index
155 Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const {
157 return (myIndexNew>=0);
161 * Returns true if the interference has index of new shape
163 * @return true if the interference has index of new shape
165 Standard_Boolean HasIndexNew() const {
166 return (myIndexNew+1);
174 myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) {
177 BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) :
181 myAllocator(theAllocator) {
184 virtual ~BOPDS_Interf() {
188 Standard_Integer myIndex1;
189 Standard_Integer myIndex2;
190 Standard_Integer myIndexNew;
191 Handle(NCollection_BaseAllocator) myAllocator;
194 * The class BOPDS_InterfVV is is to store the information about
195 * the interference of the type vertex/vertex.
197 //=======================================================================
198 //function : BOPDS_InterfVV
200 //=======================================================================
201 class BOPDS_InterfVV : public BOPDS_Interf {
207 BOPDS_InterfVV() : BOPDS_Interf() {
212 * @param theAllocator
213 * allocator to manage the memory
215 BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator)
216 : BOPDS_Interf(theAllocator) {
222 virtual ~BOPDS_InterfVV() {
227 * The class BOPDS_InterfVE is is to store the information about
228 * the interference of the type vertex/edge.
230 //=======================================================================
231 //function : BOPDS_InterfVE
233 //=======================================================================
234 class BOPDS_InterfVE : public BOPDS_Interf {
248 * @param theAllocator
249 * allocator to manage the memory
251 BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator)
253 BOPDS_Interf(theAllocator),
260 virtual ~BOPDS_InterfVE() {
265 * Sets the value of parameter
266 * of the point of the vertex
267 * on the curve of the edge
271 void SetParameter(const Standard_Real theT) {
277 * Returrns the value of parameter
278 * of the point of the vertex
279 * on the curve of the edge
283 Standard_Real Parameter() const {
288 Standard_Real myParameter;
292 * The class BOPDS_InterfVF is is to store the information about
293 * the interference of the type vertex/face
295 //=======================================================================
296 //function : BOPDS_InterfVF
298 //=======================================================================
299 class BOPDS_InterfVF : public BOPDS_Interf {
313 * @param theAllocator
314 * allocator to manage the memory
316 BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator)
317 : BOPDS_Interf(theAllocator),
325 virtual ~BOPDS_InterfVF() {
330 * Sets the value of parameters
331 * of the point of the vertex
332 * on the surface of of the face
334 * value of U parameter
336 * value of U parameter
338 void SetUV(const Standard_Real theU,
339 const Standard_Real theV) {
346 * Returns the value of parameters
347 * of the point of the vertex
348 * on the surface of of the face
350 * value of U parameter
352 * value of U parameter
354 void UV(Standard_Real& theU,Standard_Real& theV) const {
365 * The class BOPDS_InterfEE is is to store the information about
366 * the interference of the type edge/edge.
368 //=======================================================================
369 //function : BOPDS_InterfEE
371 //=======================================================================
372 class BOPDS_InterfEE : public BOPDS_Interf {
378 BOPDS_InterfEE() : BOPDS_Interf() {
383 * @param theAllocator
384 * allocator to manage the memory
386 BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator)
387 : BOPDS_Interf(theAllocator) {
393 virtual ~BOPDS_InterfEE() {
398 * Sets the info of common part
402 void SetCommonPart(const IntTools_CommonPrt& theCP) {
408 * Returns the info of common part
412 const IntTools_CommonPrt& CommonPart() const {
417 IntTools_CommonPrt myCommonPart;
420 * The class BOPDS_InterfEF is is to store the information about
421 * the interference of the type edge/face.
423 //=======================================================================
424 //function : BOPDS_InterfEF
426 //=======================================================================
427 class BOPDS_InterfEF : public BOPDS_Interf {
433 BOPDS_InterfEF(): BOPDS_Interf() {
438 * @param theAllocator
439 * allocator to manage the memory
443 * @param theAllocator
444 * allocator to manage the memory
446 BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator)
447 : BOPDS_Interf(theAllocator) {
453 virtual ~BOPDS_InterfEF() {
458 * Sets the info of common part
462 void SetCommonPart(const IntTools_CommonPrt& theCP){
468 * Returns the info of common part
472 const IntTools_CommonPrt& CommonPart() const {
477 IntTools_CommonPrt myCommonPart;
480 * The class BOPDS_InterfFF is is to store the information about
481 * the interference of the type face/face.
483 //=======================================================================
484 //function : BOPDS_InterfFF
486 //=======================================================================
487 class BOPDS_InterfFF : public BOPDS_Interf {
496 myTangentFaces(Standard_False),
499 myCurves(myAllocator),
500 myPoints(myAllocator) {
505 * @param theAllocator
506 * allocator to manage the memory
509 BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator)
511 BOPDS_Interf(theAllocator),
512 myTangentFaces(Standard_False),
515 myCurves(myAllocator),
516 myPoints(myAllocator) {
523 virtual ~BOPDS_InterfFF() {
529 * number of intersection curves
531 * number of intersection points
533 void Init(const Standard_Integer theNbCurves,
534 const Standard_Integer theNbPoints) {
536 myCurves.SetStartSize(theNbCurves);
537 myCurves.SetIncrement(theNbCurves);
541 myPoints.SetStartSize(theNbPoints);
542 myPoints.SetIncrement(theNbPoints);
548 * Sets the flag of whether the faces are tangent
552 void SetTangentFaces(const Standard_Boolean theFlag) {
553 myTangentFaces=theFlag;
557 * Returns the flag whether the faces are tangent
561 Standard_Boolean TangentFaces()const {
562 return myTangentFaces;
566 * Sets the value of 3D tolerance
570 void SetTolR3D(const Standard_Real theTol) {
576 * Returns the value of 3D tolerance
580 Standard_Real TolR3D()const {
586 * Sets the value of 2D tolerance
590 void SetTolR2D(const Standard_Real theTol) {
596 * Returns the value of 2D tolerance
600 Standard_Real TolR2D()const {
606 * Returns the intersection curves
608 * intersection curves
610 const BOPDS_VectorOfCurve& Curves()const{
616 * Returns the intersection curves
618 * intersection curves
620 BOPDS_VectorOfCurve& ChangeCurves(){
626 * Returns the intersection points
628 * intersection points
630 const BOPDS_VectorOfPoint& Points()const{
636 * Returns the intersection points
638 * intersection points
640 BOPDS_VectorOfPoint& ChangePoints(){
645 Standard_Boolean myTangentFaces;
646 Standard_Real myTolR3D;
647 Standard_Real myTolR2D;
648 BOPDS_VectorOfCurve myCurves;
649 BOPDS_VectorOfPoint myPoints;
653 * The class BOPDS_InterfVZ is is to store the information about
654 * the interference of the type vertex/solid.
656 //=======================================================================
657 //function : BOPDS_InterfVZ
659 //=======================================================================
660 class BOPDS_InterfVZ : public BOPDS_Interf {
666 BOPDS_InterfVZ() : BOPDS_Interf() {
671 * @param theAllocator
672 * allocator to manage the memory
674 BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator)
675 : BOPDS_Interf(theAllocator) {
681 virtual ~BOPDS_InterfVZ() {
686 * The class BOPDS_InterfEZ is is to store the information about
687 * the interference of the type edge/solid.
689 //=======================================================================
690 //function : BOPDS_InterfEZ
692 //=======================================================================
693 class BOPDS_InterfEZ : public BOPDS_Interf {
699 BOPDS_InterfEZ() : BOPDS_Interf() {
704 * @param theAllocator
705 * allocator to manage the memory
707 BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator)
708 : BOPDS_Interf(theAllocator) {
714 virtual ~BOPDS_InterfEZ() {
719 * The class BOPDS_InterfFZ is is to store the information about
720 * the interference of the type face/solid.
722 //=======================================================================
723 //function : BOPDS_InterfFZ
725 //=======================================================================
726 class BOPDS_InterfFZ : public BOPDS_Interf {
732 BOPDS_InterfFZ() : BOPDS_Interf() {
737 * @param theAllocator
738 * allocator to manage the memory
740 BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator)
741 : BOPDS_Interf(theAllocator) {
747 virtual ~BOPDS_InterfFZ() {
752 * The class BOPDS_InterfZZ is is to store the information about
753 * the interference of the type solid/solid.
755 //=======================================================================
756 //function : BOPDS_InterfZZ
758 //=======================================================================
759 class BOPDS_InterfZZ : public BOPDS_Interf {
765 BOPDS_InterfZZ() : BOPDS_Interf() {
770 * @param theAllocator
771 * allocator to manage the memory
773 BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator)
774 : BOPDS_Interf(theAllocator) {
780 virtual ~BOPDS_InterfZZ() {