Salome HOME
debug salome tests
[modules/hydro.git] / src / HYDROData / HYDROData_TopoCurve.cxx
index ffa0361075c86d446a21d891f10633588a23ab78..2323240709a5ca436f4d7c3a041ed3de93549f0c 100644 (file)
@@ -39,7 +39,7 @@
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 #include <BRepTools.hxx>
 
@@ -283,12 +283,13 @@ static int IntersectCurve(
     if (ProjectPointToCurve(aEndPs[aPI], theCurve1, aParameter) <=
       Precision::SquareConfusion())
     {
+      DEBTRACE("aParameter " << aParameter);
       aIntCount += AddParameter(theCurve1, aParameter, theParameters);
     }
   }
 
   // Process the internal extremums.
-  Extrema_ExtCC aAlgo(theCurve1, theCurve2);
+  Extrema_ExtCC aAlgo(theCurve1, theCurve2); //, 1.e-6, 1.e-6);
   if (aAlgo.IsDone())
   {
     const int aECount = aAlgo.NbExt();
@@ -296,9 +297,11 @@ static int IntersectCurve(
     {
       Extrema_POnCurv aP1, aP2;
       aAlgo.Points(aEN, aP1, aP2);
+      DEBTRACE("SquareDistance " << aP1.Value().SquareDistance(aP2.Value()));
       if (aP1.Value().SquareDistance(aP2.Value()) <=
         Precision::SquareConfusion())
       {
+        DEBTRACE("aP1.Parameter() " << aP1.Parameter());
         aIntCount += AddParameter(theCurve1, aP1.Parameter(), theParameters);
       }
     }
@@ -373,7 +376,7 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
   TopExp::MapShapesAndAncestors(theWire,
     TopAbs_VERTEX, TopAbs_EDGE, aVertexToEdges);
   const int aVCount = aVertexToEdges.Extent();
-  //DEBTRACE("initialize VCount= "<< aVCount);
+  DEBTRACE("initialize VCount= "<< aVCount);
   if (aVCount == 0)
   {
     return false;
@@ -502,7 +505,7 @@ bool HYDROData_TopoCurve::Cut(
     aParamI ^= 1;
   }
   const bool isClosed = IsClosed();
-  //DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed);
+  DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed);
   if (aParamI < 0)
   {
     aEdge.Orientation(TopAbs_FORWARD);
@@ -660,26 +663,29 @@ int HYDROData_TopoCurve::Intersect(
   const TopoDS_Wire& theWire,
   std::deque<std::list<double> >& theParameters) const
 {
-  //std::string brepName = "theWireToIntersect";
-  //brepName += ".brep";
-  //BRepTools::Write( theWire, brepName.c_str() );
+  std::string brepName = "theWireToIntersect";
+  brepName += ".brep";
+  BRepTools::Write( theWire, brepName.c_str() );
 
   int aIntCount = 0;
   theParameters.resize(myEdges.size());
+  DEBTRACE("myEdges.size() " << myEdges.size());
   std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
   std::list<TopoDS_Edge>::const_iterator aLastEIt = myEdges.end();
   std::deque<std::list<double> >::iterator aPIt = theParameters.begin();
   for (; aEIt != aLastEIt; ++aPIt, ++aEIt)
   {
+    DEBTRACE("---");
     const TopoDS_Edge& aEdge = *aEIt;
     std::list<double>& aParams = *aPIt;
     TopExp_Explorer aEIt2(theWire, TopAbs_EDGE);
     for (; aEIt2.More(); aEIt2.Next())
     {
       aIntCount += IntersectEdge(aEdge,TopoDS::Edge(aEIt2.Current()), aParams);
+      DEBTRACE("aParams.size() " << aParams.size());
     }
   }
-  //DEBTRACE("aIntCount " << aIntCount);
+  DEBTRACE("aIntCount " << aIntCount);
   return aIntCount;
 }