0032876: Modeling algorithms - BRepClass_FaceClassifier issue
authorabulyche <abulyche@opencascade.com>
Thu, 1 Sep 2022 12:41:59 +0000 (15:41 +0300)
committersmoskvin <smoskvin@opencascade.com>
Tue, 6 Sep 2022 16:48:57 +0000 (19:48 +0300)
Modification of checking points for the state "ON" in BRepClass_Intersector.cxx;
Added the test for this ticket;
test case lowalgos/classifier/bug377: BAD -> OK

src/BRepClass/BRepClass_Intersector.cxx
tests/bugs/modalg_6/bug32876 [new file with mode: 0644]
tests/lowalgos/classifier/bug377

index dae1ef8..b066586 100644 (file)
@@ -197,10 +197,12 @@ Standard_Boolean CheckOn(IntRes2d_IntersectionPoint& thePntInter,
     if (aMinDist <= theTolZ) {
       IntRes2d_Transition aTrOnLin(IntRes2d_Head);
       IntRes2d_Position aPosOnCurve = IntRes2d_Middle;
-      if (Abs(aPar - theDeb) <= Precision::Confusion()) {
+      if ((Abs(aPar - theDeb) <= Precision::Confusion())
+        || (aPar < theDeb)) {
         aPosOnCurve = IntRes2d_Head;
       }
-      else if (Abs(aPar - theFin) <= Precision::Confusion()) {
+      else if ((Abs(aPar - theFin) <= Precision::Confusion()) 
+        || (aPar > theFin)) {
         aPosOnCurve = IntRes2d_End;
       }
       //
@@ -381,8 +383,16 @@ void  BRepClass_Intersector::Perform(const gp_Lin2d& L,
   {
     Standard_Boolean aStatusOn = Standard_False;
     IntRes2d_IntersectionPoint aPntInter;
+    Standard_Real aDebTol = deb;
+    Standard_Real aFinTol = fin;
+    if (aTolZ > Precision::Confusion())
+    {
+      aDebTol = deb - aTolZ;
+      aFinTol = fin + aTolZ;
+    }
+    Geom2dAdaptor_Curve aCurAdaptor(aC2D, aDebTol, aFinTol);
 
-    aStatusOn = CheckOn(aPntInter, F, L, C, aTolZ, fin, deb);
+    aStatusOn = CheckOn(aPntInter, F, L, aCurAdaptor, aTolZ, fin, deb);
     if (aStatusOn)
     {
       Append(aPntInter);
diff --git a/tests/bugs/modalg_6/bug32876 b/tests/bugs/modalg_6/bug32876
new file mode 100644 (file)
index 0000000..4cb84cd
--- /dev/null
@@ -0,0 +1,29 @@
+puts "============================"
+puts "0032876: Modeling algorithms - BRepClass_FaceClassifier issue"
+puts "============================"
+puts ""
+
+plane p
+trim p p 0 4 0 2
+mkface face p
+
+point p1 4.02 -0.02
+point p2 4.06 -0.02
+point p3 3.8 -0.08
+point p4 4.09 0
+
+if ![regexp "ON" [b2dclassify face p1 0.1]] {
+  puts "Error: point p1 is classified as OUT"
+}
+
+if ![regexp "ON" [b2dclassify face p2 0.1]] {
+  puts "Error: point p2 is classified as OUT"
+}
+
+if ![regexp "ON" [b2dclassify face p3 0.1]] {
+  puts "Error: point p2 is classified as OUT"
+}
+
+if ![regexp "ON" [b2dclassify face p4 0.1]] {
+  puts "Error: point p2 is classified as OUT"
+}
index 9f76dbe..3ab0575 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO OCC11111 ALL: Error : OCC377"
-
 pload QAcommands
 
 puts "========"