more perimeters on overhangs: don't allow on top of holes

#46 #112
This commit is contained in:
supermerill 2019-11-01 22:52:29 +01:00
parent a43b2b123d
commit 5c46a60f33
2 changed files with 27 additions and 1 deletions

View File

@ -80,6 +80,28 @@ inline size_t number_polygons(const ExPolygons &expolys)
return n_polygons; return n_polygons;
} }
inline ExPolygon to_expolygon(const Polygon &other)
{
ExPolygon ex;
ex.contour = other;
return ex;
}
inline ExPolygon to_expolygon(Polygon &&other)
{
ExPolygon ex;
ex.contour = std::move(other);
return ex;
}
inline ExPolygons to_expolygon(const Polygons &other)
{
ExPolygons exs;
for (const Polygon &po : other) exs.emplace_back(to_expolygon(po));
return exs;
}
inline Lines to_lines(const ExPolygon &src) inline Lines to_lines(const ExPolygon &src)
{ {
size_t n_lines = src.contour.points.size(); size_t n_lines = src.contour.points.size();

View File

@ -293,7 +293,11 @@ void PerimeterGenerator::process()
ExPolygons overhangs_unsupported; ExPolygons overhangs_unsupported;
if (this->config->extra_perimeters && !last.empty() if (this->config->extra_perimeters && !last.empty()
&& this->lower_slices != NULL && !this->lower_slices->expolygons.empty()) { && this->lower_slices != NULL && !this->lower_slices->expolygons.empty()) {
overhangs_unsupported = diff_ex(last, this->lower_slices->expolygons); //remove holes from lower layer, we only ant that for overhangs, not bridges!
ExPolygons lower_without_holes;
for (const ExPolygon &exp : this->lower_slices->expolygons)
lower_without_holes.emplace_back(to_expolygon(exp.contour));
overhangs_unsupported = diff_ex(last, lower_without_holes);
if (!overhangs_unsupported.empty()) { if (!overhangs_unsupported.empty()) {
//only consider overhangs and let bridges alone //only consider overhangs and let bridges alone
//only consider the part that can be bridged (really, by the bridge algorithm) //only consider the part that can be bridged (really, by the bridge algorithm)