From: emv Date: Fri, 22 Jul 2016 08:53:07 +0000 (+0300) Subject: 0027704: Numeric inaccuracy due to huge extension of the offset faces X-Git-Tag: V7_1_0_beta~235 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=66cce03ae5e3f7a73951d8e2dbb15cd77ffb2250 0027704: Numeric inaccuracy due to huge extension of the offset faces The max extension value of the faces in offset operation has been decreased to 1.e+7 value to avoid the lack of precision in the calculations. Update of test cases according to the new behavior --- diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx index 638b476ae6..356ae06a02 100644 --- a/src/BRepOffset/BRepOffset_Tool.cxx +++ b/src/BRepOffset/BRepOffset_Tool.cxx @@ -3211,7 +3211,16 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace Standard_Boolean isVV1degen = Standard_False, isVV2degen = Standard_False; Standard_Real US1,VS1,US2,VS2; Standard_Real UF1,VF1,UF2,VF2; - Standard_Real infini = 1.e8; + // The maximal value to enlarge surfaces is decreased to 1.e+7. + // It is justified by the floating point format. As we can have only 15 + // valuable decimal numbers, then during intersection of surfaces with + // bounds of 1.e+8 the possible inaccuracy might appear already in seventh + // decimal place which will be more than Precision::Confusion value - + // 1.e-7, default tolerance value for the section curves. + // By decreasing the max enlarge value to 1.e+7 the inaccuracy will be + // shifted to eighth decimal place, i.e. the inaccuracy will be + // decreased to values less than 1.e-7. + Standard_Real infini = 1.e7;//1.e8; Standard_Boolean SurfaceChange = Standard_False; if (S->IsUPeriodic() || S->IsVPeriodic()) { diff --git a/tests/bugs/modalg_6/bug27704 b/tests/bugs/modalg_6/bug27704 new file mode 100644 index 0000000000..ebcd6564f8 --- /dev/null +++ b/tests/bugs/modalg_6/bug27704 @@ -0,0 +1,22 @@ +puts "========" +puts "OCC27704" +puts "========" +puts "" +################################################# +# Numeric inaccuracy due to huge extension of the offset faces +################################################# + +# Input shell contains two planar faces with linear edges. +# The result of offset operation is also expected to contain +# only simple geometries (planes, lines, 2d lines). +# Due to inaccuracy SameParameter can convert 2d lines +# into 2d BSpline curves. + +restore [locate_data_file bug27704.brep] s +offsetparameter 1e-7 p i +offsetload s 1 +offsetperform result +if {[regexp {BSpline} [dump result]]} { + puts "Error: BSpline is created" +} + diff --git a/tests/offset/faces_type_i/C8 b/tests/offset/faces_type_i/C8 index 6a79bca7b3..ed4c24eb51 100644 --- a/tests/offset/faces_type_i/C8 +++ b/tests/offset/faces_type_i/C8 @@ -1,5 +1,4 @@ puts "TODO OCC25406 ALL: Error : The volume of result shape is" -puts "TODO OCC25406 Windows: Faulty shapes in variables faulty_1 to" puts "TODO OCC25406 Linux: Error: bsection of the result and s is not equal to zero" ellipse w1 0 0 0 15 10 diff --git a/tests/offset/shape_type_i/A5 b/tests/offset/shape_type_i/A5 index 8787c49370..b7213c3d3d 100644 --- a/tests/offset/shape_type_i/A5 +++ b/tests/offset/shape_type_i/A5 @@ -3,4 +3,4 @@ trotate s 0 0 0 0 0 1 90 OFFSETSHAPE 1 {} $calcul $type -checkprops result -v 3.57243e+022 +checkprops result -v 3.57246e+019 diff --git a/tests/offset/shape_type_i/A9 b/tests/offset/shape_type_i/A9 index 2167666ae4..ea8ccdb126 100644 --- a/tests/offset/shape_type_i/A9 +++ b/tests/offset/shape_type_i/A9 @@ -3,4 +3,4 @@ trotate s 0 0 0 0 0 1 90 OFFSETSHAPE 1 {} $calcul $type -checkprops result -v 2.96865e+016 +checkprops result -v 2.96865e+014 diff --git a/tests/offset/shape_type_i/B4 b/tests/offset/shape_type_i/B4 index 925ea33f85..86be03c086 100644 --- a/tests/offset/shape_type_i/B4 +++ b/tests/offset/shape_type_i/B4 @@ -3,4 +3,4 @@ trotate s 0 0 0 0 0 1 90 OFFSETSHAPE 1 {} $calcul $type -checkprops result -v 1.77778e+16 +checkprops result -v 1.77778e+014 diff --git a/tests/offset/shape_type_i/B6 b/tests/offset/shape_type_i/B6 index 6f4eb763c9..fc6d2731d1 100644 --- a/tests/offset/shape_type_i/B6 +++ b/tests/offset/shape_type_i/B6 @@ -4,5 +4,5 @@ psphere s 15 270 OFFSETSHAPE 1 {} $calcul $type -checkprops result -v 1.77778e+16 +checkprops result -v 1.77778e+014 diff --git a/tests/offset/shape_type_i/C8 b/tests/offset/shape_type_i/C8 index 1a95d846ac..b2aad80a3d 100644 --- a/tests/offset/shape_type_i/C8 +++ b/tests/offset/shape_type_i/C8 @@ -1,5 +1,4 @@ puts "TODO OCC23068 ALL: Error : The volume of result shape is" -puts "TODO OCC23068 Windows: Faulty shapes in variables faulty_1 to" puts "TODO OCC23068 Linux: Error: bsection of the result and s is not equal to zero" ellipse w1 0 0 0 15 10