From 4ea98237772ae44a6a0756779807a8ce55a9b020 Mon Sep 17 00:00:00 2001 From: ifv Date: Thu, 1 Oct 2015 13:48:27 +0300 Subject: [PATCH] 0028585: Wrong value of area computation Another processing of NaturalRestriction flag for face in algorithm of BRepGProp* classes. --- src/BRepGProp/BRepGProp_Face.lxx | 22 +++++++++++++++++++++- tests/bugs/modalg_2/bug22818_1 | 4 +--- tests/bugs/modalg_2/bug22818_2 | 4 +--- tests/bugs/modalg_6/bug26607 | 21 +++++++++++++++++++++ tests/bugs/modalg_6/bug28585 | 21 +++++++++++++++++++++ 5 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 tests/bugs/modalg_6/bug26607 create mode 100644 tests/bugs/modalg_6/bug28585 diff --git a/src/BRepGProp/BRepGProp_Face.lxx b/src/BRepGProp/BRepGProp_Face.lxx index e403e45d4d..99e212d016 100644 --- a/src/BRepGProp/BRepGProp_Face.lxx +++ b/src/BRepGProp/BRepGProp_Face.lxx @@ -14,6 +14,12 @@ // commercial license or contractual agreement. #include +#include +#include +#include +#include +#include +#include //======================================================================= //function : BRepGProp_Face @@ -46,7 +52,21 @@ inline BRepGProp_Face::BRepGProp_Face(const TopoDS_Face &F, inline Standard_Boolean BRepGProp_Face::NaturalRestriction() const { - return BRep_Tool::NaturalRestriction(mySurface.Face()); + const TopoDS_Face& aF = mySurface.Face(); + TopoDS_Iterator anItW(aF); + + TopLoc_Location aL; + Handle(Geom_Surface) aS = BRep_Tool::Surface(aF, aL); + Standard_Real aUm = 0.0, aUM = 0.0, aVm = 0.0, aVM = 0.0; + aS->Bounds(aUm, aUM, aVm, aVM); + + if ((Precision::IsInfinite(aUm) || Precision::IsInfinite(aUM) || + Precision::IsInfinite(aVm) || Precision::IsInfinite(aVM)) && anItW.More()) + { + return Standard_False; + } + + return BRep_Tool::NaturalRestriction(aF); } //======================================================================= diff --git a/tests/bugs/modalg_2/bug22818_1 b/tests/bugs/modalg_2/bug22818_1 index 47bfffd9ae..03048d583f 100755 --- a/tests/bugs/modalg_2/bug22818_1 +++ b/tests/bugs/modalg_2/bug22818_1 @@ -1,5 +1,3 @@ -puts "TODO OCC23832 ALL: Error : area by triangles differs from the actual area by" - puts "================" puts "OCC22818" puts "================" @@ -24,7 +22,7 @@ don f1 revol result f1 0 10 0 0 0 1 180 checkshape result -set square 823.385 +set square 673.385 set nb_v_good 3 set nb_e_good 8 diff --git a/tests/bugs/modalg_2/bug22818_2 b/tests/bugs/modalg_2/bug22818_2 index 6e89e4d4be..676b5bdab2 100755 --- a/tests/bugs/modalg_2/bug22818_2 +++ b/tests/bugs/modalg_2/bug22818_2 @@ -1,5 +1,3 @@ -puts "TODO OCC23832 ALL: Error : area by triangles differs from the actual area by" - puts "================" puts "OCC22818" puts "================" @@ -25,7 +23,7 @@ don f1 revol result f1 0 10 0 0 0 1 180 checkshape result -set square 186.072 +set square 161.072 set nb_v_good 3 set nb_e_good 8 diff --git a/tests/bugs/modalg_6/bug26607 b/tests/bugs/modalg_6/bug26607 new file mode 100644 index 0000000000..c3f8228c1e --- /dev/null +++ b/tests/bugs/modalg_6/bug26607 @@ -0,0 +1,21 @@ +puts "==========" +puts "OCC26607" +puts "==========" +puts "" +########################################### +# Wrong value of area. +########################################### + +box b1 10 10 10 +box b2 20 0 0 10 10 10 +explode b1 f +explode b2 f +explode b1_5 +explode b2_5 + +mksurface s b1_5 +mkface fs s +add b1_5_1 fs +add b2_5_1 fs + +checkarea fs -200 1e-06 0.01 diff --git a/tests/bugs/modalg_6/bug28585 b/tests/bugs/modalg_6/bug28585 new file mode 100644 index 0000000000..15acd651d9 --- /dev/null +++ b/tests/bugs/modalg_6/bug28585 @@ -0,0 +1,21 @@ +puts "========" +puts "OCC28585" +puts "========" +puts "" +################################################# +# Wrong value of area computation +################################################# + +# The face in Steps To Reproduce is based on infinite planar surface. +# If we convert this surface to trimmed planar surface then +# the area of obtained face will be significantly different from source one. + +restore [locate_data_file bug28585_planarface.brep] result + +smallview +donly result +fit + +xwd ${imagedir}/${test_image}.png + +set square 253.417 \ No newline at end of file -- 2.39.5