From ae276302f609e64e709faa96467bfa9d8c8d2883 Mon Sep 17 00:00:00 2001 From: emv Date: Wed, 18 Jul 2018 15:31:52 +0300 Subject: [PATCH] 0029968: Modeling Algorithms - BRepAlgoAPI_Cut produces an empty result with half-space IntTools_Context::IsInfiniteFace() - Make the conclusion about infinity of the face basing on its bounding box only. No need to check NaturalRestriction flag. --- src/IntTools/IntTools_Context.cxx | 26 +++++++------------------- tests/bugs/modalg_7/bug29968 | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 tests/bugs/modalg_7/bug29968 diff --git a/src/IntTools/IntTools_Context.cxx b/src/IntTools/IntTools_Context.cxx index 010425c16b..4d90a58b69 100644 --- a/src/IntTools/IntTools_Context.cxx +++ b/src/IntTools/IntTools_Context.cxx @@ -230,25 +230,13 @@ Bnd_Box& IntTools_Context::BndBox(const TopoDS_Shape& aS) Standard_Boolean IntTools_Context::IsInfiniteFace (const TopoDS_Face& aFace) { - Standard_Boolean bRet; - Standard_Integer i; - Standard_Real aX[6]; - // - bRet=Standard_False; - // - if (!BRep_Tool::NaturalRestriction(aFace)) { - return bRet; - } - // - Bnd_Box& aBox=BndBox(aFace); - // - aBox.Get(aX[0], aX[1], aX[2], aX[3], aX[4], aX[5]); - // - for (i=0; (i<6) && (!bRet); ++i) { - bRet=Precision::IsInfinite(aX[i]); - } - // - return bRet; + const Bnd_Box& aBox = BndBox(aFace); + return aBox.IsOpenXmax() || + aBox.IsOpenXmin() || + aBox.IsOpenYmax() || + aBox.IsOpenYmin() || + aBox.IsOpenZmax() || + aBox.IsOpenZmin(); } //======================================================================= //function : FClass2d diff --git a/tests/bugs/modalg_7/bug29968 b/tests/bugs/modalg_7/bug29968 new file mode 100644 index 0000000000..d81c39a2d0 --- /dev/null +++ b/tests/bugs/modalg_7/bug29968 @@ -0,0 +1,24 @@ +puts "========" +puts "0029968: Modeling Algorithms - BRepAlgoAPI_Cut produces an empty result with half-space" +puts "========" +puts "" + +restore [locate_data_file bug29968_h.brep] h +restore [locate_data_file bug29968_s.brep] s + +bop s h + +bopcommon rcom +checkshape rcom +checknbshapes rcom -wire 1 -face 1 +checkprops rcom -s 12348 + +bopcut rcut +checkshape rcut +checknbshapes rcut -wire 1 -face 1 +checkprops rcut -s 12348 + +bopsection rsec +checkshape rsec +checknbshapes rsec -vertex 2 -edge 1 +checkprops rsec -l 117.6