From 80d4753574abed00d72ee49181c8194ec45896b9 Mon Sep 17 00:00:00 2001 From: abulyche Date: Thu, 1 Sep 2022 15:41:59 +0300 Subject: [PATCH] 0032876: Modeling algorithms - BRepClass_FaceClassifier issue 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 | 16 +++++++++++--- tests/bugs/modalg_6/bug32876 | 29 +++++++++++++++++++++++++ tests/lowalgos/classifier/bug377 | 2 -- 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 tests/bugs/modalg_6/bug32876 diff --git a/src/BRepClass/BRepClass_Intersector.cxx b/src/BRepClass/BRepClass_Intersector.cxx index dae1ef8b12..b0665864e1 100644 --- a/src/BRepClass/BRepClass_Intersector.cxx +++ b/src/BRepClass/BRepClass_Intersector.cxx @@ -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 index 0000000000..4cb84cd04a --- /dev/null +++ b/tests/bugs/modalg_6/bug32876 @@ -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" +} diff --git a/tests/lowalgos/classifier/bug377 b/tests/lowalgos/classifier/bug377 index 9f76dbe60e..3ab05756f3 100644 --- a/tests/lowalgos/classifier/bug377 +++ b/tests/lowalgos/classifier/bug377 @@ -1,5 +1,3 @@ -puts "TODO OCC11111 ALL: Error : OCC377" - pload QAcommands puts "========"