summaryrefslogtreecommitdiff
path: root/sql/gcalc_slicescan.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2011-07-07 16:59:45 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2011-07-07 16:59:45 +0500
commit13f6e1119f831ecde5a8e82e8a68f2848b2b54a1 (patch)
tree8d84efe86eecaf6c9a0f6258f9fc0738dad6d583 /sql/gcalc_slicescan.cc
parentf3b850a7b52b5947eb694b5a1f73d0425de5bb0e (diff)
downloadmariadb-git-13f6e1119f831ecde5a8e82e8a68f2848b2b54a1.tar.gz
Fix for bug #804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection
There were actually two bugs. One was when the line that intersects itself the intersection point treated as it doesn't belong to the line. Second when edges partly coincide, wrong result produced when we try to find their intersection. per-file comments: mysql-test/r/gis-precise.result Fix for bug #804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection test result updated. mysql-test/t/gis-precise.test Fix for bug #804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection test case added. sql/gcalc_slicescan.cc Fix for bug #804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection skip the intersection if it just line that intersects itself. sql/gcalc_tools.cc Fix for bug #804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection if edges coincide, just pick the first coinciding poing as an intersection.
Diffstat (limited to 'sql/gcalc_slicescan.cc')
-rw-r--r--sql/gcalc_slicescan.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc
index 4a77f309f46..a0b3c354d7e 100644
--- a/sql/gcalc_slicescan.cc
+++ b/sql/gcalc_slicescan.cc
@@ -510,6 +510,8 @@ int Gcalc_scan_iterator::normal_scan()
}
+#define INTERSECTION_ZERO 0.000000000001
+
int Gcalc_scan_iterator::add_intersection(const point *a, const point *b,
int isc_kind, Gcalc_dyn_list::Item ***p_hook)
{
@@ -536,6 +538,9 @@ int Gcalc_scan_iterator::add_intersection(const point *a, const point *b,
{
double dk= a0->dx_dy - b0->dx_dy;
double dy= (b0->x - a0->x)/dk;
+
+ if (fabs(dk) < INTERSECTION_ZERO)
+ dy= 0.0;
isc->y= m_y0 + dy;
isc->x= a0->x + dy*a0->dx_dy;
return 0;