Ported Polygon->split_at()

This commit is contained in:
Alessandro Ranellucci 2013-08-26 22:39:35 +02:00
parent f8ac3aa68f
commit 1f734807b9
7 changed files with 19 additions and 20 deletions

View file

@ -23,6 +23,18 @@ Polygon::lines()
return lines;
}
Polyline*
Polygon::split_at(const Point* point)
{
// find index of point
for (Points::const_iterator it = this->points.begin(); it != this->points.end(); ++it) {
if ((*it).coincides_with(point)) {
return this->split_at_index(it - this->points.begin());
}
}
throw "Point not found";
}
Polyline*
Polygon::split_at_index(int index)
{