Recursive pruning. Some more unit tests

This commit is contained in:
Alessandro Ranellucci 2014-03-09 17:46:02 +01:00
parent 33da6adc3c
commit 2a73ab988f
7 changed files with 86 additions and 98 deletions

View file

@ -135,19 +135,15 @@ ExPolygon::simplify(double tolerance, ExPolygons &expolygons) const
}
void
ExPolygon::medial_axis(double width, Polylines* polylines) const
ExPolygon::medial_axis(double max_width, double min_width, Polylines* polylines) const
{
// init helper object
Slic3r::Geometry::MedialAxis ma(width);
Slic3r::Geometry::MedialAxis ma(max_width, min_width);
// populate list of segments for the Voronoi diagram
ExPolygons expp;
this->simplify(scale_(0.01), expp);
for (ExPolygons::const_iterator expolygon = expp.begin(); expolygon != expp.end(); ++expolygon) {
expolygon->contour.lines(&ma.lines);
for (Polygons::const_iterator hole = expolygon->holes.begin(); hole != expolygon->holes.end(); ++hole)
hole->lines(&ma.lines);
}
this->contour.lines(&ma.lines);
for (Polygons::const_iterator hole = this->holes.begin(); hole != this->holes.end(); ++hole)
hole->lines(&ma.lines);
// compute the Voronoi diagram
ma.build(polylines);