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.
This commit is contained in:
Alexey Botchkov 2012-04-29 17:18:38 +05:00
parent b6ad03cde9
commit d16ea779f8
4 changed files with 38 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -313,3 +313,14 @@ SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') ,
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 ));

View File

@ -576,7 +576,7 @@ int gcalc_set_double(Gcalc_internal_coord *c, double d, double ext)
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)));

View File

@ -1010,6 +1010,13 @@ static void calculate_perpendicular(
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 @@ int Item_func_buffer::Transporter::start_line()
{
if (buffer_op == Gcalc_function::op_difference)
{
m_fn->add_operation(Gcalc_function::op_false, 0);
skip_line= TRUE;
return 0;
}