New ExPolygon::triangulate() method

This commit is contained in:
Alessandro Ranellucci 2014-04-24 17:06:16 +02:00
parent bb0ce3cccd
commit 37c7b958d4
5 changed files with 26 additions and 3 deletions

View file

@ -176,6 +176,18 @@ ExPolygon::get_trapezoids(Polygons* polygons, double angle) const
polygon->rotate(-(PI/2 - angle), Point(0,0));
}
void
ExPolygon::triangulate(Polygons* polygons) const
{
// first make trapezoids
Polygons trapezoids;
this->get_trapezoids(&trapezoids);
// then triangulate each trapezoid
for (Polygons::iterator polygon = trapezoids.begin(); polygon != trapezoids.end(); ++polygon)
polygon->triangulate_convex(polygons);
}
#ifdef SLIC3RXS
SV*
ExPolygon::to_AV() {