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

holyfoot at askmonty.org holyfoot at askmonty.org
Sun Apr 29 17:09:56 EEST 2012


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

------------------------------------------------------------
revno: 3510
revision-id: holyfoot at askmonty.org-20120429130811-cjri8xl4qumckon4
parent: sergii at pisem.net-20120426172137-snmbb4we0ktlawx5
committer: Alexey Botchkov <holyfoot at askmonty.org>
branch nick: gis-bugs
timestamp: Sun 2012-04-29 18:08:11 +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-10-05 09:45:39 +0000
+++ b/mysql-test/r/gis-precise.result	2012-04-29 13:08:11 +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((4 7,4 7,4 7))
+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.0729364962701671 -5.99911324686345,-0.220008153134309 -5.99192185936639,-0.366549791087113 -5.97752267004871,-0.512208378487218 -5.9559503678187,-0.656633011039392 -5.92725692224194,-0.799475757153712 -5.89151145834207,-0.940392496143245 -5.84880009007257,-1.07904374724091 -5.79922571286066,-1.21509548743841 -5.74290775572326,-1.34821995617687 -5.67998189355198,-1.47809644495078 -5.61059972026044,-1.60441206992284 -5.53492838358126,-1.72686252568857 -5.45315018239253,-1.84515281837461 -5.36546212754384,-1.95899797630489 -5.27207546723989,-2.0681237365223 -5.17321517812504,-2.17226720551217 -5.06911942329493,-2.27117749253584 -4.96003897854064,-2.36461631404833 -4.84623662820791,-5.27504381448432 -1.11862975309891,-5.31923088115563 -1.06059509140196,-5.40407228371483 -0.940246744015369,-5.48290627757363 -0.815880391173581,-5.55554294473577 -0.687795642313801,-5.62180729710785 -0.556301064814931,-5.68153969806092 -0.421713440631731,-5.73459624700915 -0.284357003139341,-5.78084912607892 -0.144562656026683,-5.82018690803327 -0.00266717612049117,-5.8525148247099 0.140987597939565,-5.87775499532594 0.286055589220102,-5.8958466140996 0.432187316223671,-5.90674609673661 0.579030734820292,-5.91042718542862 0.726232086352601,-5.90688101211055 0.873436749871442,-5.89611611982452 1.02029009644879,-5.87815844213895 1.16643834350991,-5.85305124067228 1.31152940712656,-5.82085500087199 1.455213750218,-3.82085500087199 9.455213750218,-3.81089050942899 9.49397123588218,-3.76979305783883 9.63536709077082,-3.72180714417003 9.77457607178953,-3.66704837069171 9.91126281230977,-3.60564865608547 10.0450980220013,-3.53775591764177 10.1757592801213,-3.46353371491424 10.3029318122545,-3.38316085569034 10.426309248632,-3.29683096522777 10.5455943622029,-3.20475201979426 10.6604997846804,-3.10714584563452 10.7707486988374,-3.00424758457139 10.876075505383,-2.8963051275286 10.9762264628145,-2.78357851733981 11.0709602987035,-2.66633932228265 11.1600487909416,-2.54486998184695 11.2432773175476,-2.41946312631327 11.3204453737111,-2.29042087178095 11.3913670548256,-2.15805409234391 11.4558715043494,-2.02268167116779 11.5138033254136,-1.88462973227241 11.565022955187,-1.7442308548705 11.6094070010951,-1.60182327215521 11.646848538084,-1.45775005646673 11.6772573662113,-1.31235829280098 11.7005602279467,-1.16599824265144 11.7167009846551,-1.01902250019855 11.72564075184,-0.871785142879433 11.727357992819,-0.724640878384343 11.7218485706083,-0.57794419013476 11.7091257578886,-0.432048483301792 11.68922020503,-0.287305233422154 11.6621798662529,-0.144063139662816 11.628069884102,-0.002667284774171 11.5869724325118,0.13654169624454 11.538986518843,0.273228436764778 11.4842277453647,0.407063646456282 11.4228280307585,0.537724904576328 11.3549352923148,0.66489743670953 11.2807130895872,0.78827487308698 11.2003402303633,0.907559986657858 11.1140103399008,1.02246540913543 11.0219313944673,9.59699349824711 3.79817363634473,9.68110149747442 3.72459388708164,9.78763871268892 3.62294935903788,9.88906013856269 3.51619973289977,9.98512144199734 3.40460217786682,10.0755912028989 3.2884255422239,10.1602514716892 3.16794970566216,10.2388982943653 3.04346490502429,10.3113422038428 2.91527103509863,10.3774086763983 2.78367692614628,10.4369385521129 2.64899959990198,10.4897884183015 2.511563505841,10.5358309550076 2.37169973955192,10.5749552417273 2.22974524509834,10.607067024627 2.08604200329115,10.6320889436092 1.94093620782678,10.6499607186792 1.79477743127626,10.6606392951656 1.64791778293431,10.6640989474422 1.50071106055717,10.6603313409038 1.35351189803282,10.6493455520444 1.20667491103692,10.6311680465917 1.06055384273254,10.6058426157484 0.915500711571916,10.5734302706958 0.77186496325317,10.534009095612 0.629992628875007,10.4876740595607 0.490225491317493,10.4345367877022 0.35290026185716,10.3747252923787 0.218347769000047,10.3083836647213 0.0868921614868527,10.2356717275219 -0.0411498726097721,10.1567646502059 -0.165469868814531,10.0718525268341 -0.28576832936742,9.98113991814919 -0.401755444740068,9.88484535877086 -0.513151791812269,9.7832008307271 -0.619689007026761,9.67645120458899 -0.721110432900533,9.56485364955604 -0.817171736335187,9.44867701391312 -0.907641497236773,9.32820117735137 -0.992301766027063,3.32820117735137 -4.99230176602706,3.20506280974101 -5.07014300290229,3.07690684619952 -5.14265394908043,2.94534730863644 -5.20878923756612,2.81070113550102 -5.26838954265664,2.67329270121795 -5.32131128199666,2.53345303474098 -5.36742696248069,0.869352446065291 -5.87127607946716,0.800800745687435 -5.89114478463228,0.657974395392574 -5.92695570431255,0.513562927147462 -5.95571533133009,0.367914240828052 -5.97735438122436,0.221379216877005 -5.99182072362883,0.0743108710019724 -5.99907950785752,-0.0729364962701671 -5.99911324686345))

=== 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 13:08:11 +0000
@@ -313,3 +313,15 @@
 
 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	2011-12-16 06:21:46 +0000
+++ b/sql/gcalc_slicescan.cc	2012-04-29 13:08:11 +0000
@@ -574,7 +574,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	2011-12-11 17:28:05 +0000
+++ b/sql/item_geofunc.cc	2012-04-29 13:08:11 +0000
@@ -1009,6 +1009,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);
 }
 
@@ -1108,6 +1115,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