0026619: Tolerances of operands are modified using bop
[occt.git] / src / BOPDS / BOPDS_Interf.hxx
index eb848db..5a42949 100644 (file)
@@ -1,43 +1,25 @@
 // Created by: Peter KURNEV
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 #ifndef BOPDS_Interf_HeaderFile
 #define BOPDS_Interf_HeaderFile
 
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-
-#ifndef _IntTools_CommonPrt_HeaderFile
 #include <IntTools_CommonPrt.hxx>
-#endif
-
 #include <NCollection_BaseAllocator.hxx>
 #include <BOPDS_VectorOfCurve.hxx>
 #include <BOPDS_VectorOfPoint.hxx>
+
 /**
  * The class BOPDS_Interf is is to store the information about
  * the interference between two shapes. 
@@ -59,10 +41,10 @@ class BOPDS_Interf  {
    *   index of the second shape
    */
   void SetIndices(const Standard_Integer theIndex1,
-                 const Standard_Integer theIndex2) {
+    const Standard_Integer theIndex2) {
     myIndex1=theIndex1; 
     myIndex2=theIndex2; 
-  }
+  }
   //
   /**
    * Returns the indices of interferred shapes
@@ -72,10 +54,10 @@ class BOPDS_Interf  {
    *   index of the second shape
    */
   void Indices(Standard_Integer& theIndex1,
-              Standard_Integer& theIndex2) const {
-                theIndex1=myIndex1; 
-                theIndex2=myIndex2; 
-              };
+        Standard_Integer& theIndex2) const {
+   theIndex1=myIndex1; 
+   theIndex2=myIndex2; 
+        }
   //
   /**
    * Sets the index of the first interferred shape
@@ -84,7 +66,7 @@ class BOPDS_Interf  {
    */
   void SetIndex1(const Standard_Integer theIndex) {
     myIndex1=theIndex; 
-  };
+  }
   //
   /**
    * Sets the index of the second interferred shape
@@ -93,7 +75,7 @@ class BOPDS_Interf  {
    */
   void SetIndex2(const Standard_Integer theIndex) {
     myIndex2=theIndex;
-  };
+  }
   //
   /**
    * Returns the index of the first interferred shape
@@ -102,7 +84,7 @@ class BOPDS_Interf  {
    */
   Standard_Integer Index1() const {
     return myIndex1; 
-  };
+  }
   //
   /**
    * Returns the index of the second interferred shape
@@ -111,7 +93,7 @@ class BOPDS_Interf  {
    */
   Standard_Integer Index2() const {
     return myIndex2; 
-  };
+  }
   //
   /**
    * Returns the index of that are opposite to the given index
@@ -130,7 +112,7 @@ class BOPDS_Interf  {
     else {
       return -1;
     }
-  };
+  }
   //
   /**
    * Returns true if the interference contains given index
@@ -150,7 +132,7 @@ class BOPDS_Interf  {
    */
   void SetIndexNew(const Standard_Integer theIndex) {
     myIndexNew=theIndex;
-  };
+  }
   //
   //
   /**
@@ -160,7 +142,7 @@ class BOPDS_Interf  {
    */
   Standard_Integer IndexNew() const {
     return myIndexNew; 
-  };
+  }
   //
   /**
    * Returns true if the interference has index of new shape
@@ -173,7 +155,7 @@ class BOPDS_Interf  {
   Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const {
     theIndex=myIndexNew;
     return (myIndexNew>=0);
-  };
+  }
   //
   /**
    * Returns true if the interference has index of new shape
@@ -181,8 +163,8 @@ class BOPDS_Interf  {
    * @return true if the interference has index of new shape
    */
   Standard_Boolean HasIndexNew() const {
-    return (myIndexNew>=0);
-  };
+    return (myIndexNew+1);
+  }
   //
  protected:     
   BOPDS_Interf() :
@@ -190,19 +172,19 @@ class BOPDS_Interf  {
     myIndex2(-1),
     myIndexNew(-1),
     myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) {
-  };
+  }
   //
   BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) :
     myIndex1(-1), 
     myIndex2(-1),
     myIndexNew(-1),
     myAllocator(theAllocator) {
-  };
+  }
   //
   virtual ~BOPDS_Interf() {
-  };
+  }
   
- protected:    
+ protected:   
   Standard_Integer myIndex1;
   Standard_Integer myIndex2;
   Standard_Integer myIndexNew;
@@ -223,7 +205,7 @@ class BOPDS_InterfVV  : public BOPDS_Interf {
    *  Constructor
    */
   BOPDS_InterfVV() : BOPDS_Interf() {
-  };
+  }
   //
   /**
    *  Constructor
@@ -232,13 +214,13 @@ class BOPDS_InterfVV  : public BOPDS_Interf {
    */
   BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator) 
     : BOPDS_Interf(theAllocator) {
-  };
+  }
   //
   /**
    *  Destructor
    */
   virtual ~BOPDS_InterfVV() {
-  };
+  }
   //
 };
 /**
@@ -259,7 +241,7 @@ class BOPDS_InterfVE  : public BOPDS_Interf {
     :
       BOPDS_Interf(),
       myParameter(0.) {
-  };
+  }
   //
   /**
    *  Constructor
@@ -270,13 +252,13 @@ class BOPDS_InterfVE  : public BOPDS_Interf {
     :
       BOPDS_Interf(theAllocator),
       myParameter(0.) {
-  };
+  }
   //
   /**
    *  Destructor
    */
   virtual ~BOPDS_InterfVE() {
-  };
+  }
   //
   /**
    *  Modifier
@@ -288,7 +270,7 @@ class BOPDS_InterfVE  : public BOPDS_Interf {
    */
   void SetParameter(const Standard_Real theT) {
     myParameter=theT;
-  };
+  }
   //
   /**
    *  Selector
@@ -300,7 +282,7 @@ class BOPDS_InterfVE  : public BOPDS_Interf {
    */
   Standard_Real Parameter() const {
     return myParameter;
-  };
+  }
   
  protected:
   Standard_Real myParameter;
@@ -324,7 +306,7 @@ class BOPDS_InterfVF  : public BOPDS_Interf {
     : BOPDS_Interf(),
       myU(0.),
       myV(0.) {
-  };
+  }
   //
   /**
    *  Constructor
@@ -335,13 +317,13 @@ class BOPDS_InterfVF  : public BOPDS_Interf {
     : BOPDS_Interf(theAllocator),
       myU(0.),
       myV(0.) {
-  };
+  }
   //
   /**
    *  Destructor
    */  
   virtual ~BOPDS_InterfVF() {
-  };
+  }
   //
   /**
    * Modifier
@@ -354,10 +336,10 @@ class BOPDS_InterfVF  : public BOPDS_Interf {
    *   value of U parameter 
    */
   void SetUV(const Standard_Real theU,
-            const Standard_Real theV) {
+      const Standard_Real theV) {
     myU=theU;
     myV=theV;
-  };
+  }
   //
   /**
    * Selector
@@ -372,7 +354,7 @@ class BOPDS_InterfVF  : public BOPDS_Interf {
   void UV(Standard_Real& theU,Standard_Real& theV) const {
     theU=myU;
     theV=myV;
-  };
+  }
   
  protected:
   Standard_Real myU;
@@ -394,7 +376,7 @@ class BOPDS_InterfEE  : public BOPDS_Interf {
    *  Constructor
    */
   BOPDS_InterfEE() : BOPDS_Interf() {
-  };
+  }
   //
   /**
    *  Constructor
@@ -403,13 +385,13 @@ class BOPDS_InterfEE  : public BOPDS_Interf {
    */
   BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator)
     : BOPDS_Interf(theAllocator) {
-  };
+  }
   //
   /**
    *  Destructor
    */
   virtual ~BOPDS_InterfEE() {
-  };
+  }
   //
   /**
    *  Modifier
@@ -419,7 +401,7 @@ class BOPDS_InterfEE  : public BOPDS_Interf {
    */
   void SetCommonPart(const IntTools_CommonPrt& theCP) {
     myCommonPart=theCP;
-  };
+  }
   //
   /**
    *  Selector
@@ -429,7 +411,7 @@ class BOPDS_InterfEE  : public BOPDS_Interf {
    */
   const IntTools_CommonPrt& CommonPart() const {
     return myCommonPart;
-  };
+  }
   
  protected:
   IntTools_CommonPrt myCommonPart;
@@ -449,7 +431,7 @@ class BOPDS_InterfEF  : public BOPDS_Interf {
    *  Constructor
    */
   BOPDS_InterfEF(): BOPDS_Interf() {
-  };
+  }
   //
   /**
    *  Constructor
@@ -463,13 +445,13 @@ class BOPDS_InterfEF  : public BOPDS_Interf {
    */
   BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator)
     : BOPDS_Interf(theAllocator) {
-  };
+  }
   //
   /**
    *  Destructor
    */
   virtual ~BOPDS_InterfEF() {
-  };
+  }
   //
   /**
    * Modifier
@@ -479,7 +461,7 @@ class BOPDS_InterfEF  : public BOPDS_Interf {
    */
   void SetCommonPart(const IntTools_CommonPrt& theCP){
     myCommonPart=theCP;
-  };
+  }
   //
   /**
    *  Selector
@@ -489,7 +471,7 @@ class BOPDS_InterfEF  : public BOPDS_Interf {
    */
   const IntTools_CommonPrt& CommonPart() const {
     return myCommonPart;
-  };
+  }
   //
  protected:
   IntTools_CommonPrt myCommonPart;
@@ -511,32 +493,20 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
   BOPDS_InterfFF()
     : 
       BOPDS_Interf(),
+      myTangentFaces(Standard_False),
       myTolR3D(1.e-7),
       myTolR2D(1.e-7),
-      myCurves(myAllocator),
-      myPoints(myAllocator) {
-  };
-  //
-  /**
-   *  Constructor
-   * @param theAllocator
-   *   allocator to manage the memory
-   */
-  /**
-  BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator)
-    : 
-      BOPDS_Interf(theAllocator),
-      myTolR3D(1.e-7),
-      myTolR2D(1.e-7),
-      myCurves(myAllocator),
-      myPoints(myAllocator) {
-  };
+      myTolReal(1.e-7),
+      myCurves(0, myAllocator),
+      myPoints(0, myAllocator) 
+  {
+  }
   //
   /**
    *  Destructor
    */
   virtual ~BOPDS_InterfFF() {
-  };
+  }
   //
   /**
    * Initializer
@@ -545,20 +515,48 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
    * @param theNbPoints
    *   number of intersection points
    */
-  void Init(const Standard_Size theNbCurves,
-           const Standard_Size theNbPoints) {
-    if (theNbCurves) {
+  
+  void Init(const Standard_Integer theNbCurves,
+            const Standard_Integer theNbPoints) {
+    //modified by NIZNHY-PKV Mon Jan 26 09:01:06 2015f
+    if (theNbCurves>0) {
+      myCurves.SetIncrement(theNbCurves);
+    }
+    if (theNbPoints>0) {
+      myPoints.SetIncrement(theNbPoints);
+    }
+    /*
+    if (theNbCurves>0) {
       myCurves.SetStartSize(theNbCurves);
       myCurves.SetIncrement(theNbCurves);
       myCurves.Init();
     }
-    if (theNbPoints) {
+    if (theNbPoints>0) {
       myPoints.SetStartSize(theNbPoints);
       myPoints.SetIncrement(theNbPoints);
       myPoints.Init();
     }
+    */
+    //modified by NIZNHY-PKV Mon Jan 26 09:01:12 2015t
+  }
+  /**
+   * Modifier
+   * Sets the flag of whether the faces are tangent  
+   * @param theFlag
+   *   the flag 
+   */
+  void SetTangentFaces(const Standard_Boolean theFlag) {
+     myTangentFaces=theFlag;
+  }
+  /**
+   * Selector
+   * Returns the flag whether the faces are tangent  
+   * @return
+   *   the flag 
+   */
+  Standard_Boolean TangentFaces()const {
+    return myTangentFaces;
   }
-  //
   /**
    * Modifier
    * Sets the value of 3D tolerance  
@@ -598,6 +596,25 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
   Standard_Real TolR2D()const {
     return myTolR2D;
   }
+  /**
+  * Modifier
+  * Sets the value of real not increased 3D tolerance
+  * @param theTol
+  *   3D tolerance
+  */
+  void SetTolReal(const Standard_Real theTol) {
+    myTolReal = theTol;
+  }
+  //
+  /**
+  * Selector
+  * Returns the value of real not increased 3D tolerance
+  * @return
+  *   3D tolerance
+  */
+  Standard_Real TolReal()const {
+    return myTolReal;
+  }
   //
   /**
    * Selector
@@ -607,7 +624,7 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
    */
   const BOPDS_VectorOfCurve& Curves()const{
     return myCurves;
-  };
+  }
   //
   /**
    * Selector/Modifier
@@ -617,7 +634,7 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
    */
   BOPDS_VectorOfCurve& ChangeCurves(){
     return myCurves;
-  };
+  }
   //
   /**
    * Selector
@@ -627,7 +644,7 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
    */
   const BOPDS_VectorOfPoint& Points()const{
     return myPoints;
-  };
+  }
   //
   /**
    * Selector/Modifier
@@ -637,13 +654,148 @@ class BOPDS_InterfFF  : public BOPDS_Interf {
    */
   BOPDS_VectorOfPoint& ChangePoints(){
     return myPoints;
-  };
+  }
   //
  protected:
+  Standard_Boolean myTangentFaces;
   Standard_Real myTolR3D;
   Standard_Real myTolR2D;
+  Standard_Real myTolReal;
   BOPDS_VectorOfCurve myCurves;
   BOPDS_VectorOfPoint myPoints;
 };
 
+/**
+ * The class BOPDS_InterfVZ is is to store the information about
+ * the interference of the type vertex/solid. 
+*/
+//=======================================================================
+//function : BOPDS_InterfVZ
+//purpose  : 
+//=======================================================================
+class BOPDS_InterfVZ  : public BOPDS_Interf {
+ public:
+  //
+  /**
+   *  Constructor
+   */
+  BOPDS_InterfVZ() : BOPDS_Interf() {
+  };
+  //
+  /**
+   *  Constructor
+   * @param theAllocator
+   *   allocator to manage the memory
+   */
+  BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
+    : BOPDS_Interf(theAllocator) {
+  };
+  //
+  /**
+   *  Destructor
+   */
+  virtual ~BOPDS_InterfVZ() {
+  };
+  //
+};
+/**
+ * The class BOPDS_InterfEZ is is to store the information about
+ * the interference of the type edge/solid. 
+*/
+//=======================================================================
+//function : BOPDS_InterfEZ
+//purpose  : 
+//=======================================================================
+class BOPDS_InterfEZ  : public BOPDS_Interf {
+ public:
+  //
+  /**
+   *  Constructor
+   */
+  BOPDS_InterfEZ() : BOPDS_Interf() {
+  };
+  //
+  /**
+   *  Constructor
+   * @param theAllocator
+   *   allocator to manage the memory
+   */
+  BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
+    : BOPDS_Interf(theAllocator) {
+  };
+  //
+  /**
+   *  Destructor
+   */
+  virtual ~BOPDS_InterfEZ() {
+  };
+  //
+};
+/**
+ * The class BOPDS_InterfFZ is is to store the information about
+ * the interference of the type face/solid. 
+*/
+//=======================================================================
+//function : BOPDS_InterfFZ
+//purpose  : 
+//=======================================================================
+class BOPDS_InterfFZ  : public BOPDS_Interf {
+ public:
+  //
+  /**
+   *  Constructor
+   */
+  BOPDS_InterfFZ() : BOPDS_Interf() {
+  };
+  //
+  /**
+   *  Constructor
+   * @param theAllocator
+   *   allocator to manage the memory
+   */
+  BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
+    : BOPDS_Interf(theAllocator) {
+  };
+  //
+  /**
+   *  Destructor
+   */
+  virtual ~BOPDS_InterfFZ() {
+  };
+  //
+};
+/**
+ * The class BOPDS_InterfZZ is is to store the information about
+ * the interference of the type solid/solid. 
+*/
+//=======================================================================
+//function : BOPDS_InterfZZ
+//purpose  : 
+//=======================================================================
+class BOPDS_InterfZZ  : public BOPDS_Interf {
+ public:
+  //
+  /**
+   *  Constructor
+   */
+  BOPDS_InterfZZ() : BOPDS_Interf() {
+  };
+  //
+  /**
+   *  Constructor
+   * @param theAllocator
+   *   allocator to manage the memory
+   */
+  BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
+    : BOPDS_Interf(theAllocator) {
+  };
+  //
+  /**
+   *  Destructor
+   */
+  virtual ~BOPDS_InterfZZ() {
+  };
+  //
+};
+
 #endif