summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/gcalc_slicescan.cc5
-rw-r--r--sql/gcalc_tools.cc3
2 files changed, 7 insertions, 1 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;
diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc
index 11d452cd8cf..a360a4c100a 100644
--- a/sql/gcalc_tools.cc
+++ b/sql/gcalc_tools.cc
@@ -701,7 +701,8 @@ handle_lines_intersection(active_thread *t0, active_thread *t1,
double x, double y)
{
m_fn->invert_state(p0->shape);
- m_fn->invert_state(p1->shape);
+ if (p0->shape != p1->shape)
+ m_fn->invert_state(p1->shape);
int intersection_state= m_fn->count();
if ((t0->result_range | t1->result_range) == intersection_state)
return 0;