]> OCCT Git - occt.git/commitdiff
0033541: Modeling Algorithms - Simple sphere cut from cylinder fails
authorakaftase <168822067+akaftase@users.noreply.github.com>
Sun, 7 Jul 2024 18:54:59 +0000 (19:54 +0100)
committerPasukhin Dmitry <44947322+dpasukhi@users.noreply.github.com>
Mon, 8 Jul 2024 15:28:00 +0000 (17:28 +0200)
Changed condition for combination of WLines into one.
WLine would be excluded from consideration for merging, if one of its middle points between vertices is out of domain (does not lie on both surfaces).

src/IntPatch/IntPatch_WLineTool.cxx
tests/bugs/modalg_8/bug33541 [new file with mode: 0644]

index 6530d7d4b355d49347d63537da31562483d5b153..766aca20e9f6779499ff336cb2d1319657bb7499 100644 (file)
@@ -1728,7 +1728,6 @@ static Standard_Boolean IsNeedSkipWL(const Handle(IntPatch_WLine)& theWL,
 {
   Standard_Real aFirstp, aLastp;
   Standard_Integer aNbVtx = theWL->NbVertex();
-  Standard_Boolean isNeedSkip = Standard_True;
 
   for (Standard_Integer i = 1; i < aNbVtx; i++) {
     aFirstp = theWL->Vertex (i).ParameterOnLine();
@@ -1739,14 +1738,13 @@ static Standard_Boolean IsNeedSkipWL(const Handle(IntPatch_WLine)& theWL,
     const IntSurf_PntOn2S& aPmid = theWL->Point (pmid);
     aPmid.Parameters (aU1, aV1, aU2, aV2);
 
-    if (!IsOutOfDomain (theBoxS1, theBoxS2, aPmid, theArrPeriods))
+    if (IsOutOfDomain (theBoxS1, theBoxS2, aPmid, theArrPeriods))
     {
-      isNeedSkip = Standard_False;
-      break;
+      return Standard_True;
     }
   }
 
-  return isNeedSkip;
+  return Standard_False;
 }
 
 //=======================================================================
diff --git a/tests/bugs/modalg_8/bug33541 b/tests/bugs/modalg_8/bug33541
new file mode 100644 (file)
index 0000000..4af9e79
--- /dev/null
@@ -0,0 +1,12 @@
+puts "================================"
+puts "0033541: Modeling Algorithms - Simple sphere cut from cylinder fails"
+puts "================================"
+puts ""
+
+pcylinder c 1 1 
+psphere s 1 
+ttranslate s 1 1 1
+bcut result c s 
+
+checknbshapes result -vertex 3 -edge 5 -wire 4 -face 4
+checkview -display result -2d -path ${imagedir}/${test_image}.png