0031199: BRepMesh fails on thin faces
authoroan <oan@opencascade.com>
Wed, 4 Dec 2019 09:26:10 +0000 (12:26 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 19 Dec 2019 13:30:06 +0000 (16:30 +0300)
Use real tolerance of a face to define threshold for tolerance of discrete model instead of empirical values based on discrete model itself

26 files changed:
src/BRepMesh/BRepMesh_DefaultRangeSplitter.cxx
tests/bugs/iges/buc60823
tests/bugs/iges/bug306
tests/bugs/mesh/bug23513
tests/bugs/mesh/bug25827
tests/bugs/mesh/bug29962
tests/bugs/mesh/bug31199_1 [new file with mode: 0644]
tests/bugs/mesh/bug31199_2 [new file with mode: 0644]
tests/bugs/mesh/bug31199_3 [new file with mode: 0644]
tests/bugs/mesh/bug31199_4 [new file with mode: 0644]
tests/bugs/moddata_1/bug15519
tests/bugs/moddata_1/bug22759
tests/bugs/moddata_2/bug258_1
tests/bugs/moddata_2/bug428
tests/hlr/poly_hlr/C17
tests/hlr/poly_hlr/C4
tests/hlr/poly_hlr/bug27979_1
tests/hlr/poly_hlr/bug27979_2
tests/hlr/poly_hlr/bug27979_4
tests/hlr/poly_hlr/bug27979_6
tests/mesh/data/advanced/B2
tests/mesh/data/advanced/B3
tests/mesh/data/advanced/B7
tests/mesh/data/standard/H5
tests/mesh/data/standard/M8
tests/mesh/data/standard/P8

index a72cdfe..ae50414 100644 (file)
@@ -18,6 +18,7 @@
 #include <GCPnts_AbscissaPoint.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAbs_IsoType.hxx>
+#include <BRep_Tool.hxx>
 
 //=======================================================================
 // Function: Reset
@@ -125,9 +126,14 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
   const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
   const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
 
+  const Standard_Real      aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
+  const Adaptor3d_Surface& aSurface   = GetSurface()->Surface();
+  const Standard_Real      aResU      = aSurface.UResolution (aTolerance);
+  const Standard_Real      aResV      = aSurface.VResolution (aTolerance);
+
   const Standard_Real aDeflectionUV = 1.e-05;
-  myTolerance.first  = Max(Min(aDeflectionUV, 0.1 * aDiffU), 1e-7 * aDiffU);
-  myTolerance.second = Max(Min(aDeflectionUV, 0.1 * aDiffV), 1e-7 * aDiffV);
+  myTolerance.first  = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
+  myTolerance.second = Max(Min(aDeflectionUV, aResV), 1e-7 * aDiffV);
 }
 
 //=======================================================================
index 4724b1c..b20f3bc 100755 (executable)
@@ -14,6 +14,6 @@ vdisplay result
 vsetdispmode result 1
 vfit
 
-checktrinfo result -tri 2708 -nod 2608
+checktrinfo result -tri 2711 -nod 2611
 
 checkview -display result -2d -path ${imagedir}/${test_image}.png
index 0e84434..1e0a1ac 100755 (executable)
@@ -20,7 +20,7 @@ vsetdispmode result 1
 vdisplay result
 vfit
 
-checktrinfo result -tri 5812 -nod 5809
+checktrinfo result -tri 5814 -nod 5811
 
 checkmaxtol result -ref 0.92213088179312575
 checknbshapes result -shell 1
index 5c46f1e..ab612f1 100644 (file)
@@ -12,7 +12,7 @@ vfit
  
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
 
-checktrinfo result -tri 323648 -nod 161865 -defl 0.00096399964870812682
+checktrinfo result -tri 323820 -nod 161951 -defl 0.00096399964870812682
 
 set log [tricheck result]
 if { [llength $log] != 0 } {
index 365214f..33d44dd 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO CR25827 ALL: Faulty shapes in variables faulty_"
+#puts "TODO CR25827 ALL: Faulty shapes in variables faulty_"
 
 puts "========="
 puts "CR25827"
index e9c9c4b..19f65eb 100644 (file)
@@ -27,7 +27,7 @@ if { [llength $log2] != 0 } {
   puts "Mesh is OK"
 }
 
-checktrinfo result -tri 78186 -nod 39096 -defl 0.035123046705520911
+checktrinfo result -tri 78200 -nod 39103 -defl 0.035123046705520911
 
 don result
 isos result 0
diff --git a/tests/bugs/mesh/bug31199_1 b/tests/bugs/mesh/bug31199_1
new file mode 100644 (file)
index 0000000..89eca7e
--- /dev/null
@@ -0,0 +1,19 @@
+puts "======="
+puts "0031199: BRepMesh fails on thin faces"
+puts "======="
+puts ""
+
+restore [locate_data_file bug31199_ok.brep] result
+
+incmesh result 0.1
+
+checktrinfo result -tri 90 -nod 90
+
+donly result
+triangles result
+isos result 0
+
+top
+fit
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
diff --git a/tests/bugs/mesh/bug31199_2 b/tests/bugs/mesh/bug31199_2
new file mode 100644 (file)
index 0000000..a67baa8
--- /dev/null
@@ -0,0 +1,19 @@
+puts "======="
+puts "0031199: BRepMesh fails on thin faces"
+puts "======="
+puts ""
+
+restore [locate_data_file bug31199_failure1.brep] result
+
+incmesh result 0.1
+
+checktrinfo result -tri 90 -nod 92
+
+donly result
+triangles result
+isos result 0
+
+top
+fit
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
diff --git a/tests/bugs/mesh/bug31199_3 b/tests/bugs/mesh/bug31199_3
new file mode 100644 (file)
index 0000000..39e4647
--- /dev/null
@@ -0,0 +1,19 @@
+puts "======="
+puts "0031199: BRepMesh fails on thin faces"
+puts "======="
+puts ""
+
+restore [locate_data_file bug31199_failure2.brep] result
+
+incmesh result 0.1
+
+checktrinfo result -tri 78 -nod 80
+
+donly result
+triangles result
+isos result 0
+
+top
+fit
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
diff --git a/tests/bugs/mesh/bug31199_4 b/tests/bugs/mesh/bug31199_4
new file mode 100644 (file)
index 0000000..57d75d2
--- /dev/null
@@ -0,0 +1,19 @@
+puts "======="
+puts "0031199: BRepMesh fails on thin faces"
+puts "======="
+puts ""
+
+restore [locate_data_file bug31199_failure3.brep] result
+
+incmesh result 0.1
+
+checktrinfo result -tri 78 -nod 80
+
+donly result
+triangles result
+isos result 0
+
+top
+fit
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
index d202b6b..4ea7a14 100755 (executable)
@@ -14,5 +14,5 @@ tclean result
 set Deflection 1.
 catch {incmesh result ${Deflection} }
 
-checktrinfo result -tri 52685 -nod 46258 -defl 1.0 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
+checktrinfo result -tri 52956 -nod 46525 -defl 1.0 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
 checkview -display result -2d -path ${imagedir}/${test_image}.png
index 1c0ea61..f03ac3e 100755 (executable)
@@ -19,7 +19,7 @@ tclean result
 set Deflection 0.001
 incmesh result ${Deflection}
 
-checktrinfo result -tri 346096 -nod 176022 -defl 0.0092442421472206764 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
+checktrinfo result -tri 375392 -nod 190670 -defl 0.0092442421472206764 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
 
 vinit
 vdisplay result
index 95434f3..9290b22 100755 (executable)
@@ -15,5 +15,5 @@ vsetdispmode result 1
 vfit
 triangles result
 
-checktrinfo result -tri 78 -nod 80
+checktrinfo result -tri 78 -nod 82
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
index c2bb6f5..7140f02 100755 (executable)
@@ -19,5 +19,5 @@ isos result 0
 triangles result
 fit
 
-checktrinfo result -tri 10886 -nod 7830
+checktrinfo result -tri 10924 -nod 7869
 checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png
index 92f75c1..028db8b 100644 (file)
@@ -1,5 +1,5 @@
 set viewname "vright"
-set length 2234.46
+set length 2234.38
 
 testreadstep [locate_data_file bug27341_CCT_PMK_32_L_o_CAD.stp] a
 COMPUTE_HLR $viewname $algotype
index 47ab7b1..38b7efc 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 2707.46, expected 2765.47"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 2707.33, expected 2765.47"
 
 set viewname "vright"
 set length 2765.47
index e97e89a..f7c3d0c 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 3.5348, expected 3."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 3.53405, expected 3."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
index 578d43e..67f500a 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 12.4882, expected 12."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 12.4883, expected 12."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
index 97f5331..f626c1e 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 11.4456, expected 11."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 11.4458, expected 11."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
index 3181bf3..ec2ad03 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 11.2106, expected 11."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 11.2065, expected 11."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
index 492172e..6b8716e 100755 (executable)
@@ -1,7 +1,7 @@
 set TheFileName OCC22145.stp
 set bug_freenodes "OCC22687"
-set bug_cross "OCC22687"
-set nbcross(ALL) 8
+#set bug_cross "OCC22687"
+#set nbcross(ALL) 8
 if { [string compare $command "shading"] == 0 } {
   set nbfreenodes(ALL) 4
 } else {
index 492172e..6b8716e 100755 (executable)
@@ -1,7 +1,7 @@
 set TheFileName OCC22145.stp
 set bug_freenodes "OCC22687"
-set bug_cross "OCC22687"
-set nbcross(ALL) 8
+#set bug_cross "OCC22687"
+#set nbcross(ALL) 8
 if { [string compare $command "shading"] == 0 } {
   set nbfreenodes(ALL) 4
 } else {
index 6d821b3..74652ac 100755 (executable)
@@ -1,8 +1,8 @@
 set TheFileName OCC22302.brep
 set bug_freenodes "OCC22687"
 set bug_area "OCC22687"
-set bug_cross "OCC22687"
-set nbcross(ALL) 8
+#set bug_cross "OCC22687"
+#set nbcross(ALL) 8
 if { [string compare $command "shading"] == 0 } {
   set nbfreenodes(ALL) 4
 } else {
index 9cf10d0..c823258 100755 (executable)
@@ -1,3 +1,3 @@
 set TheFileName shading_068.brep
-set bug_cross "OCC22687"
-set nbcross(ALL) 2
+#set bug_cross "OCC22687"
+#set nbcross(ALL) 2
index f6dd487..76e189f 100755 (executable)
@@ -5,5 +5,5 @@ if { [string compare $command "shading"] == 0 } {
 } else {
   set rel_tol 6.376860334255998
 }
-set bug_freenodes "M8"
-set nbfreenodes(All) 1
+#set bug_freenodes "M8"
+#set nbfreenodes(All) 1
index 8d33688..7fe9706 100755 (executable)
@@ -1 +1,3 @@
 set TheFileName shading_143.brep
+set bug_freenodes "P8"
+set nbfreenodes(ALL) 2