Ported make_clockwise() and make_counter_clockwise()

This commit is contained in:
Alessandro Ranellucci 2013-07-16 21:09:29 +02:00
parent fe061b19ad
commit f7ada2b5db
5 changed files with 29 additions and 19 deletions

View file

@ -52,4 +52,24 @@ Polygon::is_counter_clockwise()
return orientation;
}
bool
Polygon::make_counter_clockwise()
{
if (!this->is_counter_clockwise()) {
this->reverse();
return true;
}
return false;
}
bool
Polygon::make_clockwise()
{
if (this->is_counter_clockwise()) {
this->reverse();
return true;
}
return false;
}
}

View file

@ -16,6 +16,8 @@ class Polygon : public MultiPoint {
Polyline* split_at_index(int index);
Polyline* split_at_first_point();
bool is_counter_clockwise();
bool make_counter_clockwise();
bool make_clockwise();
};
typedef std::vector<Polygon> Polygons;