[Commits] Rev 3389: bug #977021 ST_BUFFER fails with the negative D. in file:///home/hf/wmar/gis-work/

holyfoot at askmonty.org holyfoot at askmonty.org
Sun Apr 29 16:25:24 EEST 2012


At file:///home/hf/wmar/gis-work/

------------------------------------------------------------
revno: 3389
revision-id: holyfoot at askmonty.org-20120429121838-jfr85ve3tpbb6eda
parent: sergii at pisem.net-20120421005728-b75h9qm83czzi89k
committer: Alexey Botchkov <holyfoot at askmonty.org>
branch nick: gis-work
timestamp: Sun 2012-04-29 17:18:38 +0500
message:
  bug #977021 ST_BUFFER fails with the negative D.
    Points and lines should disappear if we got negative D.
    To make it work properly inside the GEOMETRYCOLLECTION,
    we add the empty operation there.
  
  bug #986977 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int).
    The double->inernal coord conversion produced -0 (minus zero) on some data.
    That minus-zero produces invalid comparison results when compared agains plus-zero.
    So we fixed the gcalc_set_double() to avoid it.
  
  per-file comments:
    mysql-test/r/gis-precise.result
          result updated.
    mysql-test/t/gis-precise.test
          tests for #977021 and #986977 added.
    sql/gcalc_slicescan.cc
          bug #986977. The gcalc_set_double fixed to not produce minus-zero.
    sql/item_geofunc.cc
          bug #977021. Add the NOOP for the disappearing features.
-------------- next part --------------
=== modified file 'mysql-test/r/gis-precise.result'
--- a/mysql-test/r/gis-precise.result	2011-11-27 16:46:20 +0000
+++ b/mysql-test/r/gis-precise.result	2012-04-29 12:18:38 +0000
@@ -434,3 +434,21 @@
 SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
 ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,
 1
+select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3));
+ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3))
+POLYGON((3.999999999999999 6.999999999999998,4 7,3.999999999999999 6.999999999999998))
+SELECT ASTEXT(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,
+  -2.910427500435995 0.727606875108998,
+  -0.910427500435995 8.727606875108998,
+  7.664100588675687 1.503849116986468,
+  1.664100588675687 -2.496150883013531,
+  0.0 -3.0
+))' ), 3 ));
+ASTEXT(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,
+  -2.910427500435995 0.727606875108998,
+  -0.910427500435995 8.727606875108998,
+  7.664100588675687 1.503849116986468,
+  1.664100588675687 -2.496150883013531,
+  0.0 -3.0
+))' ), 3 ))
+POLYGON((-0.07293649627016707 -5.999113246863451,-0.22000815313430944 -5.991921859366389,-0.36654979108711294 -5.9775226700487085,-0.5122083784872182 -5.955950367818698,-0.6566330110393919 -5.927256922241938,-0.7994757571537123 -5.891511458342072,-0.9403924961432446 -5.848800090072569,-1.0790437472409127 -5.799225712860663,-1.2150954874384077 -5.742907755723261,-1.3482199561768686 -5.679981893551977,-1.4780964449507783 -5.610599720260437,-1.604412069922844 -5.534928383581259,-1.7268625256885657 -5.453150182392531,-1.8451528183746095 -5.365462127543841,-1.95899797630489 -5.272075467239885,-2.068123736522295 -5.173215178125043,-2.172267205512173 -5.069119423294928,-2.2711774925358363 -4.96003897854064,-2.364616314048327 -4.846236628207907,-5.275043814484322 -1.1186297530989093,-5.319230881155628 -1.060595091401963,-5.4040722837148305 -0.9402467440153693,-5.482906277573628 -0.8158803911735814,-5.555542944735771 -0.6877956423138013,-5.621807297107846 -0.5563010648149315,-5.681539698060918 -0.421713440631731,-5.734596247009149 -0.28435700313934065,-5.78084912607892 -0.14456265602668295,-5.820186908033274 -0.002667176120491166,-5.852514824709904 0.14098759793956495,-5.877754995325945 0.28605558922010244,-5.895846614099603 0.43218731622367124,-5.906746096736613 0.5790307348202924,-5.910427185428624 0.7262320863526014,-5.906881012110549 0.873436749871442,-5.896116119824521 1.0202900964487915,-5.878158442138949 1.166438343509911,-5.853051240672284 1.3115294071265557,-5.82085500087199 1.455213750217997,-3.8208550008719904 9.455213750217997,-3.810890509428993 9.493971235882178,-3.7697930578388252 9.635367090770822,-3.7218071441700307 9.774576071789534,-3.667048370691708 9.91126281230977,-3.6056486560854664 10.045098022001275,-3.537755917641774 10.175759280121321,-3.4635337149142433 10.302931812254522,-3.38316085569034 10.426309248631974,-3.296830965227768 10.54559436220285,-3.204752019794256 10.660499784680422,-3.1071458456345153 10.770748698837412,-3.00424758457139 10.876075505382953,-2.8963051275286036 10.976226462814537,-2.783578517339813 11.070960298703525,-2.666339322282651 11.160048790941556,-2.544869981846949 11.243277317547594,-2.419463126313273 11.320445373711095,-2.2904208717809498 11.391367054825631,-2.158054092343913 11.455871504349394,-2.0226816711677866 11.513803325413559,-1.8846297322724088 11.565022955186954,-1.7442308548704988 11.609407001095144,-1.6018232721552075 11.646848538083955,-1.4577500564667278 11.67725736621129,-1.312358292800976 11.700560227946688,-1.1659982426514375 11.71670098465514,-1.0190225001985485 11.725640751839975,-0.8717851428794332 11.72735799281901,-0.7246408783843428 11.721848570608318,-0.5779441901347602 11.709125757888568,-0.4320484833017919 11.689220205029992,-0.28730523342215375 11.662179866252945,-0.1440631396628158 11.628069884101997,-0.002667284774170997 11.586972432511828,0.13654169624454027 11.538986518843034,0.2732284367647777 11.484227745364711,0.40706364645628224 11.42282803075847,0.5377249045763282 11.354935292314778,0.6648974367095297 11.280713089587247,0.7882748730869795 11.200340230363343,0.9075599866578576 11.114010339900771,1.022465409135429 11.02193139446726,9.59699349824711 3.798173636344729,9.681101497474424 3.7245938870816415,9.787638712688917 3.622949359037885,9.889060138562687 3.516199732899768,9.985121441997343 3.4046021778668174,10.075591202898927 3.2884255422239015,10.160251471689218 3.167949705662155,10.238898294365335 3.043464905024292,10.3113422038428 2.9152710350986295,10.37740867639835 2.783676926146276,10.436938552112853 2.6489995999019795,10.489788418301517 2.5115635058410044,10.535830955007588 2.371699739551923,10.574955241727293 2.2297452450983433,10.607067024627042 2.0860420032911513,10.632088943609169 1.940936207826777,10.649960718679184 1.7947774312762605,10.660639295165561 1.6479177829343097,10.664098947442213 1.5007110605571654,10.660331340903774 1.3535118980328205,10.649345552044398 1.2066749110369206,10.63116804659169 1.0605538427325394,10.605842615748447 0.9155007115719156,10.573430270695816 0.7718649632531696,10.534009095612015 0.6299926288750068,10.487674059560707 0.49022549131749327,10.43453678770221 0.3529002618571597,10.37472529237871 0.2183477690000466,10.308383664721301 0.08689216148685275,10.235671727521858 -0.0411498726097721,10.156764650205906 -0.16546986881453063,10.07185252683414 -0.2857683293674196,9.98113991814919 -0.40175544474006797,9.88484535877086 -0.5131517918122694,9.783200830727104 -0.6196890070267613,9.676451204588986 -0.7211104329005329,9.564853649556037 -0.8171717363351869,9.448677013913121 -0.9076414972367728,9.328201177351374 -0.9923017660270632,3.328201177351374 -4.992301766027062,3.205062809741012 -5.070143002902289,3.076906846199522 -5.1426539490804295,2.9453473086364443 -5.208789237566124,2.8107011355010223 -5.268389542656644,2.673292701217952 -5.321311281996655,2.533453034740978 -5.367426962480689,0.8693524460652908 -5.871276079467158,0.8008007456874348 -5.891144784632282,0.6579743953925739 -5.92695570431255,0.5135629271474615 -5.9557153313300875,0.3679142408280516 -5.977354381224364,0.22137921687700501 -5.991820723628828,0.07431087100197242 -5.999079507857523,-0.07293649627016707 -5.999113246863451))

=== modified file 'mysql-test/t/gis-precise.test'
--- a/mysql-test/t/gis-precise.test	2011-11-24 12:26:13 +0000
+++ b/mysql-test/t/gis-precise.test	2012-04-29 12:18:38 +0000
@@ -313,3 +313,14 @@
 
 SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
 
+#bug 977201 ST_BUFFER fails with the negative D
+select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3));
+
+#bug 986977 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
+SELECT ASTEXT(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,
+  -2.910427500435995 0.727606875108998,
+  -0.910427500435995 8.727606875108998,
+  7.664100588675687 1.503849116986468,
+  1.664100588675687 -2.496150883013531,
+  0.0 -3.0
+))' ), 3 ));

=== modified file 'sql/gcalc_slicescan.cc'
--- a/sql/gcalc_slicescan.cc	2012-01-13 14:50:02 +0000
+++ b/sql/gcalc_slicescan.cc	2012-04-29 12:18:38 +0000
@@ -576,7 +576,7 @@
     c[1]= 0;
     c[0]++;
   }
-  if (sign)
+  if (sign && (c[0] | c[1]))
     c[0]|= GCALC_COORD_MINUS;
 #ifdef GCALC_CHECK_WITH_FLOAT
   GCALC_DBUG_ASSERT(de_check(d, gcalc_get_double(c, 2)));

=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc	2012-01-13 14:50:02 +0000
+++ b/sql/item_geofunc.cc	2012-04-29 12:18:38 +0000
@@ -1010,6 +1010,13 @@
 
 int Item_func_buffer::Transporter::single_point(double x, double y)
 {
+  if (buffer_op == Gcalc_function::op_difference)
+  {
+    m_fn->add_operation(Gcalc_function::op_false, 0);
+    return 0;
+  }
+  
+  m_nshapes= 0;
   return add_point_buffer(x, y);
 }
 
@@ -1109,6 +1116,7 @@
 {
   if (buffer_op == Gcalc_function::op_difference)
   {
+    m_fn->add_operation(Gcalc_function::op_false, 0);
     skip_line= TRUE;
     return 0;
   }



More information about the commits mailing list