From ed05bc9f7e783a0f73d4f523a0f939e3b5dd76e2 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 24 Sep 2014 17:23:40 -0700 Subject: [PATCH] Fix overflow that was leaving some lines too far away --- tile.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tile.cc b/tile.cc index 8c92872..6716294 100644 --- a/tile.cc +++ b/tile.cc @@ -305,7 +305,7 @@ void douglas_peucker(struct draw *geom, int n, double e) { int first = recursion_stack.top(); recursion_stack.pop(); - int max_distance = -1; + double max_distance = -1; int farthest_element_index = second; // find index idx of element with max_distance @@ -316,7 +316,7 @@ void douglas_peucker(struct draw *geom, int n, double e) { geom[second].x, geom[second].y); double distance = fabs(temp_dist); - + if (distance > e && distance > max_distance) { farthest_element_index = i; max_distance = distance;