Fix overflow in Point::ccw() affecting convex hull generation. Includes regression test

This commit is contained in:
Alessandro Ranellucci 2014-01-17 14:49:51 +01:00
parent 0d7f0705f0
commit 90194ee581
4 changed files with 11 additions and 3 deletions

View file

@ -125,7 +125,7 @@ Point::distance_to(const Line &line) const
double
Point::ccw(const Point &p1, const Point &p2) const
{
return (p2.x - p1.x)*(this->y - p1.y) - (p2.y - p1.y)*(this->x - p1.x);
return (double)(p2.x - p1.x)*(double)(this->y - p1.y) - (double)(p2.y - p1.y)*(double)(this->x - p1.x);
}
double