0029351: Boolean Operations create invalid pcurves
authoremv <emv@opencascade.com>
Tue, 5 Dec 2017 11:22:22 +0000 (14:22 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 8 Dec 2017 13:39:34 +0000 (16:39 +0300)
When making pcurve for edge on face make sure that the produced 2D curve will have the same range as 3D curve of the edge.

src/BOPTools/BOPTools_AlgoTools2D.cxx
tests/bugs/modalg_4/bug697_1
tests/bugs/modalg_4/bug697_5

index 41d51b6..b24667e 100644 (file)
@@ -44,6 +44,7 @@
 #include <GeomAdaptor_HSurface.hxx>
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomInt.hxx>
 #include <GeomAdaptor_HSurface.hxx>
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomInt.hxx>
+#include <GeomLib.hxx>
 #include <GeomProjLib.hxx>
 #include <gp.hxx>
 #include <gp_Cylinder.hxx>
 #include <GeomProjLib.hxx>
 #include <gp.hxx>
 #include <gp_Cylinder.hxx>
@@ -618,12 +619,25 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
   }
   //
   TolReached2d=aTolR;
   }
   //
   TolReached2d=aTolR;
-  //
+
+  // Adjust curve for periodic surface
   Handle(Geom2d_Curve) aC2DA;
   BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
   Handle(Geom2d_Curve) aC2DA;
   BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
-  //
-  aC2D=aC2DA;
-  //
+  aC2D = aC2DA;
+
+  // Make sure that the range of the 2D curve is sufficient for representation of the 3D curve.
+  Standard_Real aTCFirst = aC2D->FirstParameter();
+  Standard_Real aTCLast  = aC2D->LastParameter();
+  if ((aTCFirst - aT1) > Precision::PConfusion() ||
+      (aT2 - aTCLast ) > Precision::PConfusion())
+  {
+    if (aTCFirst < aT1) aTCFirst = aT1;
+    if (aTCLast  > aT2) aTCLast  = aT2;
+
+    GeomLib::SameRange(Precision::PConfusion(), aC2D,
+                       aTCFirst, aTCLast, aT1, aT2, aC2D);
+  }
+
   // compute the appropriate tolerance for the edge
   Handle(Geom_Surface) aS = pBAS->Surface().Surface();
   aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));
   // compute the appropriate tolerance for the edge
   Handle(Geom_Surface) aS = pBAS->Surface().Surface();
   aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));
index 54e4fe3..8e1dd06 100755 (executable)
@@ -1,4 +1,3 @@
-puts "TODO OCC29351 ALL: Faulty shapes in variables faulty_1 to faulty_2 "
 puts "============"
 puts "OCC697"
 puts "============"
 puts "============"
 puts "OCC697"
 puts "============"
index 6148207..49c6f55 100755 (executable)
@@ -1,4 +1,3 @@
-puts "TODO OCC29351 ALL: Faulty shapes in variables faulty_1 to faulty_2 " 
 puts "============"
 puts "OCC697"
 puts "============"
 puts "============"
 puts "OCC697"
 puts "============"