0025886: Wrong result obtained by projection algorithm
authoraml <aml@opencascade.com>
Thu, 12 Mar 2015 09:18:49 +0000 (12:18 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 12 Mar 2015 09:19:31 +0000 (12:19 +0300)
Usage of current iteration approximation added if necessary.

Test-case for issue #25886

src/Approx/Approx_ComputeCLine.gxx
tests/bugs/modalg_5/bug25886 [new file with mode: 0644]
tests/de/step_2/O3
tests/de/step_4/D2

index 6faac3b7cec0449fe68a8ed6ac75651b200f4218..e41e3464d88a16fb2d20d51cb07672daf44119af 100644 (file)
@@ -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 (file)
index 0000000..806e82d
--- /dev/null
@@ -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
index 09b3c529ebbdbbd33b1e463b4f26103ce9a92d53..6f5d4dd2fcd0315345a4f40986d0966bb3198f36 100644 (file)
@@ -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 )
index 8ecde034ba410ba148843aa10cd8c7fdf3d4e68a..1f271de9de2fc1858bb2db87a5bf089396230d62 100644 (file)
@@ -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 )