From 5d010b1d05110c24421370ee5a23e90d1e18ec32 Mon Sep 17 00:00:00 2001 From: ifv Date: Fri, 15 Dec 2017 10:23:29 +0300 Subject: [PATCH] 0028499: Checkshape incorrectly reports BRepCheck_NotClosed when gap is covered by vertex tolerance Calculation of 2d tolerance is improved --- src/BRepCheck/BRepCheck_Wire.cxx | 25 ++++++++++++++++++------- tests/bugs/modalg_2/bug472_3 | 1 - tests/bugs/modalg_7/bug27711 | 5 ++--- tests/bugs/modalg_7/bug27910 | 1 - tests/bugs/modalg_7/bug28200 | 3 --- tests/bugs/modalg_7/bug28499 | 12 ++++++++++++ tests/de/iges_1/Q3 | 3 ++- tests/de/iges_1/R8 | 8 ++++---- tests/de/iges_2/C4 | 3 +-- tests/de/iges_2/G2 | 5 +++-- tests/de/iges_2/H9 | 14 +++++++------- tests/de/iges_3/A5 | 5 +++-- tests/heal/data/advanced/A5 | 2 +- tests/heal/data/advanced/Z6 | 2 +- tests/offset/with_intersect_80/L9 | 1 - tests/offset/with_intersect_80/N7 | 1 - 16 files changed, 54 insertions(+), 37 deletions(-) create mode 100644 tests/bugs/modalg_7/bug28499 diff --git a/src/BRepCheck/BRepCheck_Wire.cxx b/src/BRepCheck/BRepCheck_Wire.cxx index 2f1e7a6a3c..06706a749a 100644 --- a/src/BRepCheck/BRepCheck_Wire.cxx +++ b/src/BRepCheck/BRepCheck_Wire.cxx @@ -393,7 +393,7 @@ Standard_Boolean IsDistanceIn3DTolerance (const gp_Pnt& thePnt_f, } //======================================================================= -//function : IsDistanceIn3DTolerance +//function : IsDistanceIn2DTolerance //purpose : //======================================================================= static @@ -432,20 +432,32 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac cout << "VFirst = " << aFaceSurface.FirstVParameter(); cout << "; VLast = " << aFaceSurface.LastVParameter() << endl; } - +#endif dumax = aFaceSurface.UResolution(aTol3d); dvmax = aFaceSurface.VResolution(aTol3d); + gp_Pnt aP; + gp_Vec aDU, aDV; + Standard_Real um = (thePnt.X() + thePntRef.X()) / 2.; + Standard_Real vm = (thePnt.Y() + thePntRef.Y()) / 2.; + aFaceSurface.D1(um, vm, aP, aDU, aDV); + Standard_Real aMDU = aDU.Magnitude(); + if (aMDU > Precision::Confusion()) + { + dumax = Max((aTol3d / aMDU), dumax); + } + Standard_Real aMDV = aDV.Magnitude(); + if (aMDV > Precision::Confusion()) + { + dvmax = Max((aTol3d / aMDV), dvmax); + } +#ifdef OCCT_DEBUG if(PrintWarnings) { cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl; cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl; cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl; } - -#else - dumax = aFaceSurface.UResolution(aTol3d); - dvmax = aFaceSurface.VResolution(aTol3d); #endif Standard_Real aTol2d = 2*Max( dumax, dvmax); @@ -458,7 +470,6 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac } #endif - //Standard_Real Dist = thePntRef.Distance(thePnt); Standard_Real Dist = Max(dumin, dvmin); if (Dist < aTol2d) diff --git a/tests/bugs/modalg_2/bug472_3 b/tests/bugs/modalg_2/bug472_3 index 55fef09fac..f67cacf4be 100755 --- a/tests/bugs/modalg_2/bug472_3 +++ b/tests/bugs/modalg_2/bug472_3 @@ -1,4 +1,3 @@ -puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "TODO OCC25917 ALL: Error : is WRONG because number of " puts "========================" puts " OCC472 " diff --git a/tests/bugs/modalg_7/bug27711 b/tests/bugs/modalg_7/bug27711 index 6ec342352a..32616b7623 100644 --- a/tests/bugs/modalg_7/bug27711 +++ b/tests/bugs/modalg_7/bug27711 @@ -1,6 +1,4 @@ -puts "TODO OCC27711 ALL: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO OCC27711 ALL: ERROR: OCC27711 is reproduced." - +puts "TODO OCC27711 ALL: Error: tolerance" puts "========" puts "OCC27711" puts "========" @@ -48,6 +46,7 @@ set bug_info [string trim [checkshape result]] if {$bug_info != "This shape seems to be valid"} { puts "ERROR: OCC27711 is reproduced. Result of blend operation is WRONG." } +checkmaxtol result -min_tol 1.e-3 clear display result xwd $imagedir/${casename}_step_3.png diff --git a/tests/bugs/modalg_7/bug27910 b/tests/bugs/modalg_7/bug27910 index 3e5201fad6..eb343943d0 100644 --- a/tests/bugs/modalg_7/bug27910 +++ b/tests/bugs/modalg_7/bug27910 @@ -1,4 +1,3 @@ -puts "TODO OCC27910 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "========" puts "OCC27910" diff --git a/tests/bugs/modalg_7/bug28200 b/tests/bugs/modalg_7/bug28200 index 4d517fb3d4..6265adfeac 100644 --- a/tests/bugs/modalg_7/bug28200 +++ b/tests/bugs/modalg_7/bug28200 @@ -1,4 +1,3 @@ -puts "TODO OCC28200 ALL: Faulty shapes in variables faulty_1 to" puts "========" puts "OCC28200" @@ -37,5 +36,3 @@ smallview -Y+Z fit checkview -screenshot -2d -path ${imagedir}/${test_image}_2.png -donly faulty_1 faulty_2 faulty_3 faulty_4 faulty_5 faulty_6 faulty_7 faulty_8 -checkview -screenshot -2d -path ${imagedir}/${test_image}_3.png diff --git a/tests/bugs/modalg_7/bug28499 b/tests/bugs/modalg_7/bug28499 new file mode 100644 index 0000000000..109386eeb6 --- /dev/null +++ b/tests/bugs/modalg_7/bug28499 @@ -0,0 +1,12 @@ + +puts "========" +puts "OCC28499" +puts "========" +puts "" +######################################################################## +# Checkshape incorrectly reports BRepCheck_NotClosed when gap is covered by vertex tolerance +######################################################################## + +restore [locate_data_file bug28499.brep] f + +checkshape f diff --git a/tests/de/iges_1/Q3 b/tests/de/iges_1/Q3 index ded39856d5..a533bf0e65 100644 --- a/tests/de/iges_1/Q3 +++ b/tests/de/iges_1/Q3 @@ -4,6 +4,7 @@ puts "TODO CR23096 ALL: NBSHAPES : Faulty" puts "TODO CR23096 ALL: LABELS : Faulty" puts "TODO CR23096 ALL: COLORS : Faulty" + set filename 919-001-T02-04-CP-VL.igs set ref_data { @@ -12,7 +13,7 @@ TPSTAT : Faulties = 0 ( 0 ) Warnings = 101 ( 1430 ) Summary = 101 ( 1 CHECKSHAPE : Wires = 0 ( 0 ) Faces = 1 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 899 ( 899 ) Summary = 24030 ( 24038 ) STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 899 ( 899 ) FreeWire = 366 ( 366 ) FreeEdge = 3783 ( 3783 ) SharedEdge = 9384 ( 9388 ) -TOLERANCE : MaxTol = 0.3151652209 ( 0.3151652209 ) AvgTol = 0.0007056492227 ( 0.0007458035864 ) +TOLERANCE : MaxTol = 0.3151652209 ( 0.3151652209 ) AvgTol = 0.0007056492364 ( 0.0007458036003 ) LABELS : N0Labels = 1 ( 1 ) N1Labels = 3581 ( 9530 ) N2Labels = 0 ( 0 ) TotalLabels = 3582 ( 9531 ) NameLabels = 3582 ( 4454 ) ColorLabels = 3581 ( 9530 ) LayerLabels = 3581 ( 9530 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 1 ( 2 ) diff --git a/tests/de/iges_1/R8 b/tests/de/iges_1/R8 index a15075e22b..19cea00b4d 100755 --- a/tests/de/iges_1/R8 +++ b/tests/de/iges_1/R8 @@ -1,17 +1,17 @@ # !!!! This file is generated automatically, do not edit manually! See end script -puts "TODO CR23096 ALL: LABELS : Faulty" puts "TODO CR23096 ALL: STATSHAPE : Faulty" +puts "TODO CR23096 ALL: LABELS : Faulty" set LinuxDiff 5 set filename BUC60743.igs set ref_data { DATA : Faulties = 0 ( 2 ) Warnings = 0 ( 0 ) Summary = 0 ( 2 ) -TPSTAT : Faulties = 3 ( 59 ) Warnings = 2203 ( 4655 ) Summary = 2206 ( 4714 ) -CHECKSHAPE : Wires = 8 ( 18 ) Faces = 7 ( 13 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) +TPSTAT : Faulties = 3 ( 59 ) Warnings = 2206 ( 4736 ) Summary = 2209 ( 4795 ) +CHECKSHAPE : Wires = 10 ( 18 ) Faces = 8 ( 13 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 3350 ( 2837 ) Summary = 45945 ( 39211 ) STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 3350 ( 3349 ) FreeWire = 6 ( 6 ) FreeEdge = 67 ( 67 ) SharedEdge = 19616 ( 16778 ) -TOLERANCE : MaxTol = 4.854604894 ( 5.769095076 ) AvgTol = 0.01628658326 ( 0.01747356296 ) +TOLERANCE : MaxTol = 3.742696236 ( 5.769095076 ) AvgTol = 0.01622292522 ( 0.01748590756 ) LABELS : N0Labels = 11 ( 11 ) N1Labels = 2891 ( 6329 ) N2Labels = 0 ( 0 ) TotalLabels = 2902 ( 6340 ) NameLabels = 2900 ( 5879 ) ColorLabels = 2891 ( 6329 ) LayerLabels = 2411 ( 5260 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 4 ( 4 ) diff --git a/tests/de/iges_2/C4 b/tests/de/iges_2/C4 index 765b447881..736b80f726 100644 --- a/tests/de/iges_2/C4 +++ b/tests/de/iges_2/C4 @@ -1,5 +1,4 @@ # !!!! This file is generated automatically, do not edit manually! See end script -puts "TODO CR23096 ALL: CHECKSHAPE : Faulty" puts "TODO CR23096 ALL: NBSHAPES : Faulty" puts "TODO CR23096 ALL: TOLERANCE : Faulty" puts "TODO CR23096 ALL: LABELS : Faulty" @@ -10,7 +9,7 @@ set filename PRO14323.igs set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) TPSTAT : Faulties = 0 ( 0 ) Warnings = 32 ( 319 ) Summary = 32 ( 319 ) -CHECKSHAPE : Wires = 0 ( 0 ) Faces = 1 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) +CHECKSHAPE : Wires = 0 ( 1 ) Faces = 1 ( 1 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 153 ( 153 ) Summary = 3497 ( 3504 ) STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 153 ( 153 ) FreeWire = 21 ( 21 ) FreeEdge = 435 ( 435 ) SharedEdge = 1380 ( 1384 ) TOLERANCE : MaxTol = 0.9672552763 ( 0.776676229 ) AvgTol = 0.01571417252 ( 0.01646993877 ) diff --git a/tests/de/iges_2/G2 b/tests/de/iges_2/G2 index c8e11c54ad..32051d5958 100644 --- a/tests/de/iges_2/G2 +++ b/tests/de/iges_2/G2 @@ -4,15 +4,16 @@ puts "TODO CR23096 ALL: TOLERANCE : Faulty" puts "TODO CR23096 ALL: LABELS : Faulty" +set LinuxDiff 5 set filename PRO7978.igs set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 1 ) Summary = 0 ( 1 ) -TPSTAT : Faulties = 2 ( 0 ) Warnings = 174 ( 940 ) Summary = 176 ( 940 ) +TPSTAT : Faulties = 2 ( 0 ) Warnings = 170 ( 940 ) Summary = 172 ( 940 ) CHECKSHAPE : Wires = 8 ( 8 ) Faces = 5 ( 5 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 346 ( 346 ) Summary = 25259 ( 25254 ) STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 346 ( 346 ) FreeWire = 84 ( 84 ) FreeEdge = 1563 ( 1563 ) SharedEdge = 12104 ( 12103 ) -TOLERANCE : MaxTol = 0.4314224119 ( 0.2157335194 ) AvgTol = 0.001277618654 ( 0.00125488316 ) +TOLERANCE : MaxTol = 0.4314224119 ( 0.2157335194 ) AvgTol = 0.001277618654 ( 0.001254883151 ) LABELS : N0Labels = 560 ( 560 ) N1Labels = 94 ( 90 ) N2Labels = 0 ( 0 ) TotalLabels = 654 ( 650 ) NameLabels = 648 ( 650 ) ColorLabels = 554 ( 640 ) LayerLabels = 554 ( 640 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 3 ( 3 ) diff --git a/tests/de/iges_2/H9 b/tests/de/iges_2/H9 index 69b1f6d083..44386fe582 100755 --- a/tests/de/iges_2/H9 +++ b/tests/de/iges_2/H9 @@ -3,7 +3,7 @@ puts "TODO CR23096 ALL: NBSHAPES : Faulty" puts "TODO CR23096 ALL: TOLERANCE : Faulty" puts "TODO CR23096 ALL: LABELS : Faulty" puts "TODO CR23096 ALL: COLORS : Faulty" -puts "TODO CR25013 ALL: Error : 4 differences with reference data found" + set LinuxDiff 4 set LinuxFaulties {STATSHAPE} @@ -11,12 +11,12 @@ set filename coque-sup.igs set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) -TPSTAT : Faulties = 0 ( 3 ) Warnings = 274 ( 4465 ) Summary = 274 ( 4468 ) -CHECKSHAPE : Wires = 2 ( 2 ) Faces = 3 ( 3 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) -NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1628 ( 1628 ) Summary = 39231 ( 39275 ) -STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1628 ( 1628 ) FreeWire = 22 ( 26 ) FreeEdge = 135 ( 135 ) SharedEdge = 17934 ( 17947 ) -TOLERANCE : MaxTol = 4.337400808e+088 ( 8.082392835e+086 ) AvgTol = 2.040579288e+085 ( 5.099401401e+083 ) -LABELS : N0Labels = 6 ( 6 ) N1Labels = 1643 ( 9621 ) N2Labels = 0 ( 0 ) TotalLabels = 1649 ( 9627 ) NameLabels = 1649 ( 2891 ) ColorLabels = 1645 ( 9626 ) LayerLabels = 489 ( 3997 ) +TPSTAT : Faulties = 0 ( 2 ) Warnings = 1956 ( 4570 ) Summary = 1956 ( 4572 ) +CHECKSHAPE : Wires = 1 ( 2 ) Faces = 3 ( 3 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) +NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1628 ( 1628 ) Summary = 39228 ( 39278 ) +STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1628 ( 1628 ) FreeWire = 22 ( 26 ) FreeEdge = 135 ( 135 ) SharedEdge = 17933 ( 17950 ) +TOLERANCE : MaxTol = 9.510579727e+086 ( 8.081584677e+086 ) AvgTol = 8.579374427e+082 ( 6.555234696e+083 ) +LABELS : N0Labels = 6 ( 6 ) N1Labels = 1643 ( 9836 ) N2Labels = 0 ( 0 ) TotalLabels = 1649 ( 9842 ) NameLabels = 1649 ( 2893 ) ColorLabels = 1645 ( 9841 ) LayerLabels = 489 ( 4144 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 4 ( 5 ) COLORS : Colors = BLUE1 CYAN1 GOLD3 GREEN ( BLUE1 CYAN1 GOLD3 GREEN YELLOW ) diff --git a/tests/de/iges_3/A5 b/tests/de/iges_3/A5 index 8a69057190..200162c05f 100644 --- a/tests/de/iges_3/A5 +++ b/tests/de/iges_3/A5 @@ -3,17 +3,18 @@ puts "TODO CR23096 ALL: STATSHAPE : Faulty" puts "TODO CR23096 ALL: TOLERANCE : Faulty" puts "TODO CR23096 ALL: LABELS : Faulty" + set LinuxDiff 5 set LinuxFaulties {CHECKSHAPE} set filename USA60022.igs set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 1 ) Summary = 0 ( 1 ) -TPSTAT : Faulties = 0 ( 0 ) Warnings = 157 ( 2003 ) Summary = 157 ( 2003 ) +TPSTAT : Faulties = 0 ( 0 ) Warnings = 152 ( 2003 ) Summary = 152 ( 2003 ) CHECKSHAPE : Wires = 7 ( 14 ) Faces = 9 ( 15 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 666 ( 634 ) Summary = 25078 ( 24995 ) STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 666 ( 634 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 11901 ( 11872 ) -TOLERANCE : MaxTol = 6.4081268 ( 1.331845935 ) AvgTol = 0.002669852591 ( 0.00229913384 ) +TOLERANCE : MaxTol = 6.4081268 ( 1.331845935 ) AvgTol = 0.002669846957 ( 0.002299131368 ) LABELS : N0Labels = 1 ( 1 ) N1Labels = 634 ( 634 ) N2Labels = 0 ( 0 ) TotalLabels = 635 ( 635 ) NameLabels = 635 ( 635 ) ColorLabels = 634 ( 635 ) LayerLabels = 634 ( 635 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 2 ( 2 ) diff --git a/tests/heal/data/advanced/A5 b/tests/heal/data/advanced/A5 index 647b25aec6..03fab818af 100644 --- a/tests/heal/data/advanced/A5 +++ b/tests/heal/data/advanced/A5 @@ -1,5 +1,5 @@ if {[string compare $command "SplitAngle"] == 0 } { - puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_48 " + puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_4 " } restore [locate_data_file TEBIS.brep] a diff --git a/tests/heal/data/advanced/Z6 b/tests/heal/data/advanced/Z6 index a9896572d2..bd32a6ab58 100644 --- a/tests/heal/data/advanced/Z6 +++ b/tests/heal/data/advanced/Z6 @@ -2,7 +2,7 @@ if {[string compare $command "ShapeConvertRev"] == 0 } { puts "TODO OCC23127 ALL: Error : The area of the resulting shape is " } if {[string compare $command "SplitAngle"] == 0 } { - puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_41 " + puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_40 " } restore [locate_data_file pb.brep] a diff --git a/tests/offset/with_intersect_80/L9 b/tests/offset/with_intersect_80/L9 index ecb18c5f1d..11472fd863 100644 --- a/tests/offset/with_intersect_80/L9 +++ b/tests/offset/with_intersect_80/L9 @@ -1,4 +1,3 @@ -puts "TODO OCC26577 All: Faulty shapes in variables faulty_1 to faulty" restore [locate_data_file bug26663_test_offset_L9.brep] s OFFSETSHAPE ${off_param} {} ${calcul} ${type} checknbshapes result -ref [lrange [nbshapes s] 8 19] diff --git a/tests/offset/with_intersect_80/N7 b/tests/offset/with_intersect_80/N7 index 814410337b..9494f7d3b7 100644 --- a/tests/offset/with_intersect_80/N7 +++ b/tests/offset/with_intersect_80/N7 @@ -1,6 +1,5 @@ puts "TODO OCC26577 All: Error : is WRONG because number of EDGE entities in shape" puts "TODO OCC26577 All: Error : is WRONG because number of SHELL entities in shape" -puts "TODO OCC26577 All: Faulty shapes in variables faulty_1 to faulty" restore [locate_data_file bug26663_test_offset_N7.brep] s OFFSETSHAPE ${off_param} {} ${calcul} ${type} checknbshapes result -ref [lrange [nbshapes s] 8 19]