0027267: [Regression to 6.9.1] geom/boolean_operations_06/G3: Cut produces invalid...
authornbv <nbv@opencascade.com>
Wed, 16 Mar 2016 14:49:16 +0000 (17:49 +0300)
committerabv <abv@opencascade.com>
Fri, 18 Mar 2016 04:09:27 +0000 (07:09 +0300)
Calling IntPatch_WLineTool::ComputePurgedWLine() algorithm is forbidden if Walking-line is obtained from analytic line.

Creation of test case for this issue.

src/IntPatch/IntPatch_Intersection.cxx
src/IntPatch/IntPatch_WLine.cxx
src/IntPatch/IntPatch_WLine.hxx
tests/bugs/modalg_6/bug27267 [new file with mode: 0644]

index d5e6296..26e7312 100644 (file)
@@ -1204,6 +1204,9 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  theS1,
     if(aWL.IsNull())
       continue;
 
+    if(!aWL->IsPurgingAllowed())
+      continue;
+
     Handle(IntPatch_WLine) aRW = IntPatch_WLineTool::ComputePurgedWLine(aWL, theS1, theS2, theD1, theD2);
 
     if(aRW.IsNull())
@@ -1414,7 +1417,8 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& the
           }
 
           IntPatch_ALineToWLine AToW(Quad1,Quad2,0.01,0.05,aNbPointsInALine);
-          Handle(IntPatch_Line) wlin=AToW.MakeWLine((*((Handle(IntPatch_ALine) *)(&line))));
+          Handle(IntPatch_WLine) wlin=AToW.MakeWLine((*((Handle(IntPatch_ALine) *)(&line))));
+          wlin->EnablePurging(Standard_False);
           slin.Append(wlin);
         }
         else
index 67046f6..e8da3d7 100644 (file)
@@ -41,7 +41,8 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
                                 const IntSurf_TypeTrans Trans1,
                                 const IntSurf_TypeTrans Trans2) :
   IntPatch_PointLine(Tang,Trans1,Trans2),fipt(Standard_False),lapt(Standard_False),
-  hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
+  hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
+  myIsPurgerAllowed(Standard_True)
 {
   typ = IntPatch_Walking;
   curv = Line;
@@ -57,7 +58,8 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
                                 const IntSurf_Situation Situ1,
                                 const IntSurf_Situation Situ2) :
   IntPatch_PointLine(Tang,Situ1,Situ2),fipt(Standard_False),lapt(Standard_False),
-  hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
+  hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
+  myIsPurgerAllowed(Standard_True)
 {
   typ = IntPatch_Walking;
   curv = Line;
@@ -71,7 +73,8 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
 IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
                                 const Standard_Boolean Tang) :
   IntPatch_PointLine(Tang),fipt(Standard_False),lapt(Standard_False),
-  hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
+  hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
+  myIsPurgerAllowed(Standard_True)
 {
   typ = IntPatch_Walking;
   curv = Line;
index f8faf0c..ba64bff 100644 (file)
@@ -164,7 +164,17 @@ public:
   //! Otherwise,             prints list of 2d-points on the 2nd surface
   Standard_EXPORT void Dump(const Standard_Integer theMode) const;
 
+  //! Allows or forbides purging of existing WLine
+  void EnablePurging(const Standard_Boolean theIsEnabled)
+  {
+    myIsPurgerAllowed = theIsEnabled;
+  }
 
+  //! Returns TRUE if purging is allowed or forbiden for existing WLine
+  Standard_Boolean IsPurgingAllowed()
+  {
+    return myIsPurgerAllowed;
+  }
 
 
   DEFINE_STANDARD_RTTIEXT(IntPatch_WLine,IntPatch_PointLine)
@@ -194,6 +204,7 @@ private:
   Handle(Adaptor2d_HCurve2d) theArcOnS1;
   Standard_Boolean hasArcOnS2;
   Handle(Adaptor2d_HCurve2d) theArcOnS2;
+  Standard_Boolean myIsPurgerAllowed;
 
 
 };
diff --git a/tests/bugs/modalg_6/bug27267 b/tests/bugs/modalg_6/bug27267
new file mode 100644 (file)
index 0000000..20db1ea
--- /dev/null
@@ -0,0 +1,22 @@
+puts "================"
+puts "OCC27267"
+puts "================"
+puts ""
+#######################################################################
+# [Regression to 6.9.1] geom/boolean_operations_06/G3: Cut produces invalid shape
+#######################################################################
+
+restore [locate_data_file bug27267_cmpd.brep] a
+explode a
+
+bcut result a_1 a_2
+checkshape result
+checknbshapes result -solid 1 -shell 1 -face 7
+checkprops result -s 0.00128248
+
+smallview
+don a_2
+fit
+don result 
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file