From 9734a40647e3073e798cc3d61752769e85461384 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 30 Apr 2014 16:55:20 +0200 Subject: [PATCH] Fix Polygon::contains_point() overflowing on Windows. #1950 --- xs/src/Polygon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xs/src/Polygon.cpp b/xs/src/Polygon.cpp index 314febbf1..ca062958c 100644 --- a/xs/src/Polygon.cpp +++ b/xs/src/Polygon.cpp @@ -147,7 +147,7 @@ Polygon::contains_point(const Point &point) const Points::const_iterator j = this->points.end() - 1; for (; i != this->points.end(); j = i++) { if ( ((i->y > point.y) != (j->y > point.y)) - && (point.x < (j->x - i->x) * (point.y - i->y) / (j->y - i->y) + i->x) ) + && ((double)point.x < (double)(j->x - i->x) * (double)(point.y - i->y) / (double)(j->y - i->y) + (double)i->x) ) result = !result; } return result;