Fix Polygon::contains_point() overflowing on Windows. #1950
This commit is contained in:
parent
93c1ae92c9
commit
9734a40647
@ -147,7 +147,7 @@ Polygon::contains_point(const Point &point) const
|
|||||||
Points::const_iterator j = this->points.end() - 1;
|
Points::const_iterator j = this->points.end() - 1;
|
||||||
for (; i != this->points.end(); j = i++) {
|
for (; i != this->points.end(); j = i++) {
|
||||||
if ( ((i->y > point.y) != (j->y > point.y))
|
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;
|
result = !result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user