]> OCCT Git - occt-copy.git/commitdiff
0028585: Wrong value of area computation
authorifv <ifv@opencascade.com>
Thu, 1 Oct 2015 10:48:27 +0000 (13:48 +0300)
committernbv <nbv@opencascade.com>
Mon, 3 Apr 2017 08:42:13 +0000 (11:42 +0300)
Another processing of NaturalRestriction flag for face in algorithm of BRepGProp* classes.

src/BRepGProp/BRepGProp_Face.lxx
tests/bugs/modalg_2/bug22818_1
tests/bugs/modalg_2/bug22818_2
tests/bugs/modalg_6/bug26607 [new file with mode: 0644]
tests/bugs/modalg_6/bug28585 [new file with mode: 0644]

index e403e45d4dc5ab412fb6dde25c6da0e483a87574..99e212d0167c2ce49d9f4795c09964b5fe42e89e 100644 (file)
 // commercial license or contractual agreement.
 
 #include <BRep_Tool.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <Geom2d_Line.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <Precision.hxx>
+#include <TopoDS_Edge.hxx>
 
 //=======================================================================
 //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);
 }
 
 //=======================================================================
index 47bfffd9ae4f8d2002f768df9ae907ddac1d3021..03048d583f76c7cedc4b7e4886809bf9c6e44a1e 100755 (executable)
@@ -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
index 6e89e4d4bec281b53978e6cafdc07613164c514f..676b5bdab2e9dc4413b6acdd014300785ffd1b60 100755 (executable)
@@ -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 (file)
index 0000000..c3f8228
--- /dev/null
@@ -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 (file)
index 0000000..15acd65
--- /dev/null
@@ -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