New coverage detection for bridges. Includes implementation of ExPolygon::get_trapezoids()

This commit is contained in:
Alessandro Ranellucci 2014-04-24 13:43:24 +02:00
parent d458a7c4d2
commit 6201aacf88
21 changed files with 358 additions and 27 deletions

View file

@ -47,7 +47,7 @@ ExPolygon::translate(double x, double y)
}
void
ExPolygon::rotate(double angle, Point* center)
ExPolygon::rotate(double angle, const Point &center)
{
contour.rotate(angle, center);
for (Polygons::iterator it = holes.begin(); it != holes.end(); ++it) {
@ -158,6 +158,24 @@ ExPolygon::medial_axis(double max_width, double min_width, Polylines* polylines)
intersection(*polylines, *this, *polylines);
}
void
ExPolygon::get_trapezoids(Polygons* polygons) const
{
ExPolygons expp;
expp.push_back(*this);
boost::polygon::get_trapezoids(*polygons, expp);
}
void
ExPolygon::get_trapezoids(Polygons* polygons, double angle) const
{
ExPolygon clone = *this;
clone.rotate(PI/2 - angle, Point(0,0));
clone.get_trapezoids(polygons);
for (Polygons::iterator polygon = polygons->begin(); polygon != polygons->end(); ++polygon)
polygon->rotate(-(PI/2 - angle), Point(0,0));
}
#ifdef SLIC3RXS
SV*
ExPolygon::to_AV() {