From 8f15a0d540f6c272a9f0b65e0549d5ad758a8153 Mon Sep 17 00:00:00 2001 From: pkv Date: Fri, 5 Oct 2012 14:20:32 +0400 Subject: [PATCH] 0023137: Class BRepAlgoAPI_Cut does not made correct result on attached shapes. class ShellFaceClassifier; - method: void BOP_ShellFaceClassifier::ResetElement(const TopoDS_Shape& theElement) The order of choice a testing point for the element has been changed. The following order is: -point inside an edge -point as an vertex-point -point inside UV-range of a surface Adding test cases Expected sduare is corrected --- src/BOP/BOP_ShellFaceClassifier.cxx | 36 ++++++++++++++++++++++++----- tests/boolean/boptuc_complex/B5 | 2 +- tests/bugs/modalg/CR23137_1 | 21 +++++++++++++++++ tests/bugs/modalg/CR23137_2 | 21 +++++++++++++++++ 4 files changed, 73 insertions(+), 7 deletions(-) mode change 100644 => 100755 tests/boolean/boptuc_complex/B5 create mode 100755 tests/bugs/modalg/CR23137_1 create mode 100755 tests/bugs/modalg/CR23137_2 diff --git a/src/BOP/BOP_ShellFaceClassifier.cxx b/src/BOP/BOP_ShellFaceClassifier.cxx index 9a84a70e03..a9130c3178 100755 --- a/src/BOP/BOP_ShellFaceClassifier.cxx +++ b/src/BOP/BOP_ShellFaceClassifier.cxx @@ -24,6 +24,8 @@ #include #include #include +#include +#include // ================================================================== // function: BOP_ShellFaceClassifier::BOP_ShellFaceClassifier @@ -89,14 +91,36 @@ BOP_ShellFaceClassifier::BOP_ShellFaceClassifier // function: ResetElement // purpose: // =============================================================================================== - void BOP_ShellFaceClassifier::ResetElement(const TopoDS_Shape& theElement) +void BOP_ShellFaceClassifier::ResetElement(const TopoDS_Shape& theElement) { - const TopAbs_ShapeEnum aShapeType= theElement.ShapeType(); - + Standard_Boolean bFound; + TopAbs_ShapeEnum aShapeType; + TopExp_Explorer anExp; + // + myFirstCompare=Standard_True; + aShapeType=theElement.ShapeType(); + // + bFound=Standard_False; + anExp.Init(theElement, TopAbs_EDGE); + for(; anExp.More(); anExp.Next()) { + const TopoDS_Edge& aE=*((TopoDS_Edge*)&anExp.Current()); + if (!BRep_Tool::Degenerated(aE)) { + Standard_Real aT, aT1, aT2; + Handle(Geom_Curve) aC; + // + aC=BRep_Tool::Curve(aE, aT1, aT2); + aT=IntTools_Tools::IntermediatePoint(aT1, aT2); + aC->D0(aT, myPoint); + bFound=Standard_True; + break; + } + } + if (bFound) { + return; + } + // // initialize myPoint with first vertex of face - myFirstCompare = Standard_True; - TopExp_Explorer anExp(theElement, TopAbs_VERTEX); - + anExp.Init(theElement, TopAbs_VERTEX); if(anExp.More()) { const TopoDS_Vertex& aVertex = TopoDS::Vertex(anExp.Current()); myPoint = BRep_Tool::Pnt(aVertex); diff --git a/tests/boolean/boptuc_complex/B5 b/tests/boolean/boptuc_complex/B5 old mode 100644 new mode 100755 index 5cca2fcabf..0a95864e03 --- a/tests/boolean/boptuc_complex/B5 +++ b/tests/boolean/boptuc_complex/B5 @@ -4,4 +4,4 @@ restore [locate_data_file b60] b bop a b boptuc result -set square 12500 +set square 15000 diff --git a/tests/bugs/modalg/CR23137_1 b/tests/bugs/modalg/CR23137_1 new file mode 100755 index 0000000000..b7384a9ce6 --- /dev/null +++ b/tests/bugs/modalg/CR23137_1 @@ -0,0 +1,21 @@ +puts "============" +puts "CR23137" +puts "============" +puts "" +########################################################################################################## +# Class BRepAlgoAPI_Cut does not made correct result on attached shapes. +########################################################################################################## + +restore [locate_data_file CR23137-bspl_cut.brep] b +explode b +copy b_1 b1 +copy b_2 b2 +#to provide positive volume of b2 +invert b2 + +bop b1 b2 +bopcut result + +set square 44460.7 + +set 3dviewer 1 diff --git a/tests/bugs/modalg/CR23137_2 b/tests/bugs/modalg/CR23137_2 new file mode 100755 index 0000000000..9f5934fca6 --- /dev/null +++ b/tests/bugs/modalg/CR23137_2 @@ -0,0 +1,21 @@ +puts "============" +puts "CR23137" +puts "============" +puts "" +########################################################################################################## +# Class BRepAlgoAPI_Cut does not made correct result on attached shapes. +########################################################################################################## + +restore [locate_data_file CR23137-rev_cut.brep] b +explode b +copy b_1 b1 +copy b_2 b2 +#to provide positive volume of b1 +invert b1 + +bop b1 b2 +bopcut result + +set square 3452.78 + +set 3dviewer 1