Fix Polygon::contains_point() overflowing on Windows. #1950

This commit is contained in:
Alessandro Ranellucci 2014-04-30 16:55:20 +02:00
parent 93c1ae92c9
commit 9734a40647

View File

@ -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;