Bugfix: fix crash in some circumstances caused by Avoid crossing perimeters. #2271

This commit is contained in:
Alessandro Ranellucci 2014-09-23 20:19:47 +02:00
parent 24d67c42c6
commit 6573ae002a
3 changed files with 9 additions and 3 deletions

View file

@ -107,10 +107,13 @@ Point::nearest_point_index(const PointPtrs &points) const
return this->nearest_point_index(p);
}
void
bool
Point::nearest_point(const Points &points, Point* point) const
{
*point = points.at(this->nearest_point_index(points));
int idx = this->nearest_point_index(points);
if (idx == -1) return false;
*point = points.at(idx);
return true;
}
double