]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOMAlgo/GEOMAlgo_Tools3D.cxx
Salome HOME
0021672: [CEA 565] Dump Study from script
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_Tools3D.cxx
index a46a011dff4fa94c673905294e3b6bdbbea67f3e..81d7b75e17c76322c294483a588e63a35af60ed3 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -23,7 +23,7 @@
 //  Created :
 //  Author  : Peter KURNEV
 
-#include <GEOMAlgo_Tools3D.ixx>
+#include <GEOMAlgo_Tools3D.hxx>
 
 #include <Precision.hxx>
 
@@ -117,7 +117,7 @@ static
                                     Standard_Real aT,
                                     gp_Pnt& aPF,
                                     gp_Dir& aDNF,
-                                    IntTools_Context& aCtx);
+                                    const Handle(IntTools_Context)& aCtx);
 
 //=======================================================================
 //function : IsInternalFace
@@ -127,7 +127,7 @@ Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
                                                   const TopoDS_Solid& theSolid,
                                                   const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
                                                   const Standard_Real theTol,
-                                                  IntTools_Context& theContext)
+                                                  const Handle(IntTools_Context)& theContext)
 {
   Standard_Boolean bRet;
   Standard_Integer aNbF;
@@ -193,7 +193,7 @@ Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
   Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
                                                     const TopoDS_Edge& theEdge,
                                                     const TopTools_ListOfShape& theLF,
-                                                    IntTools_Context& theContext)
+                                                    const Handle(IntTools_Context)& theContext)
 {
   Standard_Boolean bRet;
   Standard_Boolean aNbF;
@@ -236,7 +236,7 @@ Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
                                                     const TopoDS_Edge& theEdge,
                                                     const TopoDS_Face& theFace1,
                                                     const TopoDS_Face& theFace2,
-                                                    IntTools_Context& theContext)
+                                                    const Handle(IntTools_Context)& theContext)
 {
   Standard_Boolean bRet;
   Standard_Real aT1, aT2, aT, aDt2D, aDt2Dx;
@@ -278,7 +278,7 @@ Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
   GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1, theContext);
   GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2, theContext);
   //
-  aTwoPI=2.*PI;
+  aTwoPI = 2.*M_PI;
   gp_Vec aVBF (aPx, aPF );
   gp_Vec aVBF1(aPx, aPF1);
   gp_Vec aVBF2(aPx, aPF2);
@@ -321,7 +321,7 @@ Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
   NMTTools_ListIteratorOfListOfCoupleOfShape aIt;
   //
   aAngleMin=100.;
-  aTwoPI=PI+PI;
+  aTwoPI = M_PI+M_PI;
   BRep_Tool::Range(theE1, aT1, aT2);
   aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
   // Ref
@@ -338,7 +338,7 @@ Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
     const TopoDS_Face& aF2=TopoDS::Face(aCS.Shape2());
     //
     if (aF2==theF1) {
-      aAngle=PI;
+      aAngle=M_PI;
     }
     else if (aF2.IsSame(theF1)) {
       aAngle=aTwoPI;
@@ -426,7 +426,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
                                              const TopoDS_Solid& theRef,
                                              const Standard_Real theTol,
                                              const TopTools_IndexedMapOfShape& theBounds,
-                                             IntTools_Context& theCtx)
+                                             const Handle(IntTools_Context)& theCtx)
 {
   TopAbs_State aState;
   TopExp_Explorer aExp;
@@ -467,7 +467,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
   TopAbs_State GEOMAlgo_Tools3D::ComputeStateByOnePoint(const TopoDS_Shape& theS,
                                                        const TopoDS_Solid& theRef,
                                                        const Standard_Real theTol,
-                                                       IntTools_Context& theCtx)
+                                                       const Handle(IntTools_Context)& theCtx)
 {
   TopAbs_State aState;
   TopAbs_ShapeEnum aType;
@@ -491,7 +491,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
   TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Vertex& theV,
                                              const TopoDS_Solid& theRef,
                                              const Standard_Real theTol,
-                                             IntTools_Context& theCtx)
+                                             const Handle(IntTools_Context)& theCtx)
 {
   TopAbs_State aState;
   gp_Pnt aP3D;
@@ -507,7 +507,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
   TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Edge& theE,
                                              const TopoDS_Solid& theRef,
                                              const Standard_Real theTol,
-                                             IntTools_Context& theCtx)
+                                             const Handle(IntTools_Context)& theCtx)
 {
   Standard_Real aT1, aT2, aT = 0.;
   TopAbs_State aState;
@@ -557,11 +557,11 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
   TopAbs_State GEOMAlgo_Tools3D::ComputeState(const gp_Pnt& theP,
                                              const TopoDS_Solid& theRef,
                                              const Standard_Real theTol,
-                                             IntTools_Context& theCtx)
+                                             const Handle(IntTools_Context)& theCtx)
 {
   TopAbs_State aState;
   //
-  BRepClass3d_SolidClassifier& aSC=theCtx.SolidClassifier(theRef);
+  BRepClass3d_SolidClassifier& aSC=theCtx->SolidClassifier(theRef);
   aSC.Perform(theP, theTol);
   //
   aState=aSC.State();
@@ -574,7 +574,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
 //=======================================================================
   Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Shape& theSp,
                                                      const TopoDS_Shape& theSr,
-                                                     IntTools_Context& theCtx)
+                                                     const Handle(IntTools_Context)& theCtx)
 {
   Standard_Boolean bRet;
   TopAbs_ShapeEnum aType;
@@ -608,7 +608,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
 //=======================================================================
   Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Face& theFSp,
                                                      const TopoDS_Face& theFSr,
-                                                     IntTools_Context& theContext)
+                                                     const Handle(IntTools_Context)& theContext)
 {
   Standard_Boolean bRet, bFound, bInFace;
   Standard_Real aT1, aT2, aT, aU, aV, aScPr;
@@ -677,7 +677,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
   //modified by NIZNHY-PKV Tue Nov 22 10:50:37 2011t
   //
   // Parts of theContext.ComputeVS(..)
-  GeomAPI_ProjectPointOnSurf& aProjector=theContext.ProjPS(theFSr);
+  GeomAPI_ProjectPointOnSurf& aProjector=theContext->ProjPS(theFSr);
   aProjector.Perform(aPFSp);
   if (!aProjector.IsDone()) {
     return bRet;
@@ -685,7 +685,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
   //
   aProjector.LowerDistanceParameters(aU, aV);
   gp_Pnt2d aP2D(aU, aV);
-  bInFace=theContext.IsPointInFace (theFSr, aP2D);
+  bInFace=theContext->IsPointInFace (theFSr, aP2D);
   if (!bInFace) {
     return bRet;
   }
@@ -709,7 +709,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
 //=======================================================================
   Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Edge& theSplit,
                                                      const TopoDS_Edge& theEdge,
-                                                     IntTools_Context& theContext)
+                                                     const Handle(IntTools_Context)& theContext)
 {
   Standard_Boolean bRet, aFlag, bIsDegenerated;
   Standard_Real aTE, aTS, aScPr, aTa, aTb, aT1, aT2;
@@ -741,7 +741,7 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
   aFlag=BOPTools_Tools2D::EdgeTangent(theSplit, aTS, aVS);
   gp_Dir aDTS(aVS);
   //
-  aFlag=theContext.ProjectPointOnEdge(aP, theEdge, aTE);
+  aFlag=theContext->ProjectPointOnEdge(aP, theEdge, aTE);
   aFlag=BOPTools_Tools2D::EdgeTangent(theEdge, aTE, aVE);
   gp_Dir aDTE(aVE);
   //
@@ -1055,7 +1055,7 @@ Standard_Real AngleWithRef(const gp_Dir& theD1,
   Standard_Real aCosinus, aSinus, aBeta, aHalfPI, aScPr;
   gp_XYZ aXYZ;
   //
-  aHalfPI=0.5*PI;
+  aHalfPI=0.5*M_PI;
   //
   const gp_XYZ& aXYZ1=theD1.XYZ();
   const gp_XYZ& aXYZ2=theD2.XYZ();
@@ -1068,7 +1068,7 @@ Standard_Real AngleWithRef(const gp_Dir& theD1,
     aBeta=aHalfPI*(1.-aCosinus);
   }
   else {
-    aBeta=2.*PI-aHalfPI*(3.+aCosinus);
+    aBeta=2.*M_PI-aHalfPI*(3.+aCosinus);
   }
   //
   aScPr=aXYZ.Dot(theDRef.XYZ());
@@ -1086,7 +1086,7 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
                                   Standard_Real aT,
                                   gp_Pnt& aPF,
                                   gp_Dir& aDNF,
-                                  IntTools_Context& aCtx)
+                                  const Handle(IntTools_Context)& aCtx)
 {
   Standard_Boolean bReverse;
   Standard_Real aT1, aT2, dT, aU, aV;
@@ -1166,7 +1166,7 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
     aDNF.Reverse();
   }
   //
-  GeomAPI_ProjectPointOnSurf& aProjector=aCtx.ProjPS(aF);
+  GeomAPI_ProjectPointOnSurf& aProjector=aCtx->ProjPS(aF);
   //
   aProjector.Perform(aPFx);
   if(aProjector.IsDone()) {
@@ -1182,9 +1182,9 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
 //modified by NIZNHY-PKV Tue Nov 22 10:36:59 2011f
 //=======================================================================
 //function : PntInFace
-//purpose  : 
+//purpose  :
 //=======================================================================
-Standard_Integer GEOMAlgo_Tools3D::PntInFace(const TopoDS_Face& aF, 
+Standard_Integer GEOMAlgo_Tools3D::PntInFace(const TopoDS_Face& aF,
                                             gp_Pnt& theP,
                                             gp_Pnt2d& theP2D)
 {
@@ -1210,8 +1210,8 @@ Standard_Integer GEOMAlgo_Tools3D::PntInFace(const TopoDS_Face& aF,
   aTolTangfIntr=1.e-10;
   //
   Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
-  Geom2dHatch_Hatcher aHatcher(aIntr, 
-                              aTolHatch2D, aTolHatch3D, 
+  Geom2dHatch_Hatcher aHatcher(aIntr,
+                              aTolHatch2D, aTolHatch3D,
                               Standard_True, Standard_False);
   //
   iErr=0;
@@ -1219,7 +1219,7 @@ Standard_Integer GEOMAlgo_Tools3D::PntInFace(const TopoDS_Face& aF,
   //
   aFF=aF;
   aFF.Orientation (TopAbs_FORWARD);
-  // 
+  //
   aS=BRep_Tool::Surface(aFF);
   BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
   //