Fixed regression in the C++ port of PerimeterGenerator causing gaps to be filled twice
This commit is contained in:
parent
e72a89ec23
commit
9eabbded2b
1 changed files with 9 additions and 7 deletions
|
@ -264,13 +264,13 @@ PerimeterGenerator::process()
|
||||||
// where $pwidth < thickness < 2*$pspacing, infill with width = 2*$pwidth
|
// where $pwidth < thickness < 2*$pspacing, infill with width = 2*$pwidth
|
||||||
// where 0.1*$pwidth < thickness < $pwidth, infill with width = 1*$pwidth
|
// where 0.1*$pwidth < thickness < $pwidth, infill with width = 1*$pwidth
|
||||||
std::vector<PerimeterGeneratorGapSize> gap_sizes;
|
std::vector<PerimeterGeneratorGapSize> gap_sizes;
|
||||||
gap_sizes.push_back(PerimeterGeneratorGapSize(pwidth, 2*pspacing, unscale(2*pwidth)));
|
gap_sizes.push_back(PerimeterGeneratorGapSize(pwidth, 2*pspacing, 2*pwidth));
|
||||||
gap_sizes.push_back(PerimeterGeneratorGapSize(0.1*pwidth, pwidth, unscale(1*pwidth)));
|
gap_sizes.push_back(PerimeterGeneratorGapSize(0.1*pwidth, pwidth, 1*pwidth));
|
||||||
|
|
||||||
for (std::vector<PerimeterGeneratorGapSize>::const_iterator gap_size = gap_sizes.begin();
|
for (std::vector<PerimeterGeneratorGapSize>::const_iterator gap_size = gap_sizes.begin();
|
||||||
gap_size != gap_sizes.end(); ++gap_size) {
|
gap_size != gap_sizes.end(); ++gap_size) {
|
||||||
ExtrusionEntityCollection gap_fill = this->_fill_gaps(gap_size->min,
|
ExtrusionEntityCollection gap_fill = this->_fill_gaps(gap_size->min,
|
||||||
gap_size->max, gap_size->width, gaps);
|
gap_size->max, unscale(gap_size->width), gaps);
|
||||||
this->gap_fill->append(gap_fill.entities);
|
this->gap_fill->append(gap_fill.entities);
|
||||||
|
|
||||||
// Make sure we don't infill narrow parts that are already gap-filled
|
// Make sure we don't infill narrow parts that are already gap-filled
|
||||||
|
@ -279,12 +279,14 @@ PerimeterGenerator::process()
|
||||||
// are not subtracted from fill surfaces (they might be too short gaps
|
// are not subtracted from fill surfaces (they might be too short gaps
|
||||||
// that medial axis skips but infill might join with other infill regions
|
// that medial axis skips but infill might join with other infill regions
|
||||||
// and use zigzag).
|
// and use zigzag).
|
||||||
double dist = scale_(gap_size->width/2);
|
coord_t dist = gap_size->width/2;
|
||||||
Polygons filled;
|
Polygons filled;
|
||||||
for (ExtrusionEntitiesPtr::const_iterator it = gap_fill.entities.begin();
|
for (ExtrusionEntitiesPtr::const_iterator it = gap_fill.entities.begin();
|
||||||
it != gap_fill.entities.end(); ++it)
|
it != gap_fill.entities.end(); ++it) {
|
||||||
offset((*it)->as_polyline(), &filled, dist);
|
Polygons f;
|
||||||
|
offset((*it)->as_polyline(), &f, dist);
|
||||||
|
filled.insert(filled.end(), f.begin(), f.end());
|
||||||
|
}
|
||||||
last = diff(last, filled);
|
last = diff(last, filled);
|
||||||
gaps = diff(gaps, filled); // prevent more gap fill here
|
gaps = diff(gaps, filled); // prevent more gap fill here
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue