From 3629864d0b86afde530fca8550f696aee15b0de5 Mon Sep 17 00:00:00 2001 From: aml Date: Thu, 12 Mar 2015 12:18:49 +0300 Subject: [PATCH] 0025886: Wrong result obtained by projection algorithm Usage of current iteration approximation added if necessary. Test-case for issue #25886 --- src/Approx/Approx_ComputeCLine.gxx | 10 +++++++++ tests/bugs/modalg_5/bug25886 | 35 ++++++++++++++++++++++++++++++ tests/de/step_2/O3 | 2 +- tests/de/step_4/D2 | 2 +- 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/modalg_5/bug25886 diff --git a/src/Approx/Approx_ComputeCLine.gxx b/src/Approx/Approx_ComputeCLine.gxx index 6faac3b7ce..e41e3464d8 100644 --- a/src/Approx/Approx_ComputeCLine.gxx +++ b/src/Approx/Approx_ComputeCLine.gxx @@ -162,6 +162,16 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line) if (!Ok && Abs(myfirstU-mylastU) <= TolU) { Ok = Standard_True; // stop interval cutting, approx the rest part + + if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d)) + { + KeptMultiCurve = TheMultiCurve; + KeptUfirst = myfirstU; + KeptUlast = mylastU; + KeptT3d = thetol3d; + KeptT2d = thetol2d; + } + mylastU = KeptUlast; tolreached = Standard_False; // helas diff --git a/tests/bugs/modalg_5/bug25886 b/tests/bugs/modalg_5/bug25886 new file mode 100644 index 0000000000..806e82d5b4 --- /dev/null +++ b/tests/bugs/modalg_5/bug25886 @@ -0,0 +1,35 @@ +puts "========" +puts "OCC25886" +puts "========" +puts "" +################################################# +# Wrong result obtained by projection algorithm +################################################# + +set ok_len_c3x "3.28347" +set ok_len_c5x "3.28346" + +smallview -2D- + +restore [locate_data_file OCC25886_cx.brep] cx + +explode cx +copy cx_1 f +mksurface s f +mkcurve c3 cx_3 +mkcurve c5 cx_5 +project c3x c3 s +project c5x c5 s + +2dfit + +set len_c3x [string range [lindex [length c3x] 4] 0 6] +set len_c5x [string range [lindex [length c5x] 4] 0 6] +if {$len_c3x != $ok_len_c3x} { + puts "ERROR: OCC25866 is reproduced. Length of projection is $len_c3x, but expected length is $ok_len_c3x" +} +if {$len_c5x != $ok_len_c5x} { + puts "ERROR: OCC25866 is reproduced. Length of projection is $len_c5x, but expected length is $ok_len_c5x" +} + +set only_screen_axo 1 diff --git a/tests/de/step_2/O3 b/tests/de/step_2/O3 index 09b3c529eb..6f5d4dd2fc 100644 --- a/tests/de/step_2/O3 +++ b/tests/de/step_2/O3 @@ -10,7 +10,7 @@ TPSTAT : Faulties = 0 ( 0 ) Warnings = 28 ( 20 ) Summary = 28 ( 20 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) Summary = 685 ( 687 ) STATSHAPE : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 286 ( 288 ) -TOLERANCE : MaxTol = 0.5384357498 ( 0.5384357497 ) AvgTol = 0.009441130625 ( 0.009436309132 ) +TOLERANCE : MaxTol = 0.5386330267 ( 1.019942733 ) AvgTol = 0.009444234359 ( 0.01316262156 ) LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 0 ( 0 ) diff --git a/tests/de/step_4/D2 b/tests/de/step_4/D2 index 8ecde034ba..1f271de9de 100644 --- a/tests/de/step_4/D2 +++ b/tests/de/step_4/D2 @@ -7,7 +7,7 @@ TPSTAT : Faulties = 0 ( 0 ) Warnings = 10 ( 14 ) Summary = 10 ( 14 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 108 ( 108 ) Summary = 673 ( 673 ) STATSHAPE : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 108 ( 108 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 282 ( 282 ) -TOLERANCE : MaxTol = 0.5384357498 ( 0.5384357497 ) AvgTol = 0.01216240032 ( 0.0121742825 ) +TOLERANCE : MaxTol = 0.5386330267 ( 1.019942733 ) AvgTol = 0.01216555298 ( 0.01597193199 ) LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 0 ( 0 ) -- 2.20.1