0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepOffset / BRepOffset_Inter3d.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 70a3722..627baf4
@@ -1,58 +1,54 @@
 // Created on: 1996-09-03
 // Created by: Yves FRICAUD
 // Copyright (c) 1996-1999 Matra Datavision
-// 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.
 
 //  Modified by skv - Fri Dec 26 12:20:14 2003 OCC4455
 
-#include <BRepOffset_Inter3d.ixx>
-#include <BRepOffset_Tool.hxx>
-#include <BRepOffset_Interval.hxx>
-#include <BRepOffset_ListOfInterval.hxx>
-#include <BRepOffset_DataMapOfShapeOffset.hxx>
-#include <BRepOffset_Offset.hxx>
-#include <BRepAdaptor_Curve.hxx>
 #include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <BRepAlgo_AsDes.hxx>
+#include <BRepAlgo_Image.hxx>
 #include <BRepLib_MakeVertex.hxx>
-
+#include <BRepOffset_Analyse.hxx>
+#include <BRepOffset_DataMapOfShapeOffset.hxx>
+#include <BRepOffset_Inter3d.hxx>
+#include <BRepOffset_Interval.hxx>
+#include <BRepOffset_ListOfInterval.hxx>
+#include <BRepOffset_Offset.hxx>
+#include <BRepOffset_Tool.hxx>
+#include <Extrema_ExtPC.hxx>
+#include <Precision.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Compound.hxx>
 #include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopOpeBRepTool_BoxSort.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_MapIteratorOfMapOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <Extrema_ExtPC.hxx>
 #include <TopTools_MapOfShape.hxx>
 
-
-
 //=======================================================================
 //function : BRepOffset_Inter3d
 //purpose  : 
 //=======================================================================
-
 BRepOffset_Inter3d::BRepOffset_Inter3d(const Handle(BRepAlgo_AsDes)& AsDes, 
                                       const TopAbs_State              Side ,
                                       const Standard_Real             Tol)
@@ -68,7 +64,7 @@ myTol(Tol)
 //purpose  : 
 //=======================================================================
 
-static void ExtentEdge(const TopoDS_Face& F,
+static void ExtentEdge(const TopoDS_Face& /*F*/,
                       const TopoDS_Edge& E,
                       TopoDS_Edge& NE) 
 {
@@ -103,8 +99,8 @@ static void ExtentEdge(const TopoDS_Face& F,
 //purpose  : 
 //=======================================================================
 
-static void SelectEdge (const TopoDS_Face& F,
-                       const TopoDS_Face& EF,
+static void SelectEdge (const TopoDS_Face& /*F*/,
+                       const TopoDS_Face& /*EF*/,
                        const TopoDS_Edge& E,
                        TopTools_ListOfShape& LInt)
 {
@@ -141,8 +137,8 @@ static void SelectEdge (const TopoDS_Face& F,
     Standard_Integer i;
     Standard_Real    aTol       = BRep_Tool::Tolerance(EI);
     Standard_Boolean isMinFound = Standard_False;
-    Standard_Real    aSqrDist1;
-    Standard_Real    aSqrDist2;
+    Standard_Real    aSqrDist1  = Precision::Infinite();
+    Standard_Real    aSqrDist2  = Precision::Infinite();
 
     anExt.Initialize(Ad2, Fst, Lst, aTol);
 
@@ -330,10 +326,10 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
 //purpose  : 
 //=======================================================================
 
-void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& SetOfFaces
-                                       const TopoDS_Shape&         ShapeInit, 
-                                       const BRepOffset_Analyse&   Analyse, 
-                                       const BRepAlgo_Image&     InitOffsetFace)
+void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces*/
+                                        const TopoDS_Shape&         ShapeInit, 
+                                        const BRepOffset_Analyse&   Analyse, 
+                                        const BRepAlgo_Image&       InitOffsetFace)
 {
   BRepOffset_Type    OT   = BRepOffset_Concave;
   if (mySide == TopAbs_OUT) OT   = BRepOffset_Convex;
@@ -773,7 +769,22 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
       //---------------------------------------------------
       const TopoDS_Shape SI = Analyse.Ancestors(E).First();
       OF1 = TopoDS::Face(InitOffsetFace.Image(SI).First());
-      OE  = TopoDS::Edge(InitOffsetEdge.Image(E).First());      
+      OE  = TopoDS::Edge(InitOffsetEdge.Image(E).First());     
+
+      {
+        //Check if OE has pcurve in CF
+
+        Standard_Real   f,l;
+
+        Handle (Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(OE,CF,f,l);
+        Handle (Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(OE,OF1,f,l); 
+
+        if(C1.IsNull() || C2.IsNull())
+        {
+          continue;
+        }
+      }
+
       //--------------------------------------------------
       // MAJ of OE on cap CF.
       //--------------------------------------------------
@@ -809,6 +820,21 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
            //-------------------------------------------------
            OF1 = TopoDS::Face(InitOffsetFace.Image(EV).First());
            OE  = TopoDS::Edge(InitOffsetEdge.Image(V[i]).First());
+
+      {
+        //Check if OE has pcurve in CF and OF1
+
+        Standard_Real   f,l;
+
+        Handle (Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(OE,CF,f,l);
+        Handle (Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(OE,OF1,f,l); 
+
+        if(C1.IsNull() || C2.IsNull())
+        {
+          continue;
+        }
+      }
+
            //--------------------------------------------------
            // MAj of OE on cap CF.
            //--------------------------------------------------
@@ -877,7 +903,7 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
 //purpose  : 
 //=======================================================================
 
-void BRepOffset_Inter3d::AddCommonEdges(const TopTools_ListOfShape& SetOfFaces)
+void BRepOffset_Inter3d::AddCommonEdges(const TopTools_ListOfShape&)
 {
 }