mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-17 04:05:53 +08:00
Update on "add perimeter on overhangs": use the new, time-intensive, "detect bridge" function
This commit is contained in:
parent
18f926cfc4
commit
4f6e19b3c2
@ -156,15 +156,41 @@ void PerimeterGenerator::process()
|
|||||||
if (this->config->extra_perimeters && i > loop_number && !last.empty()
|
if (this->config->extra_perimeters && i > loop_number && !last.empty()
|
||||||
&& this->lower_slices != NULL && !this->lower_slices->expolygons.empty()){
|
&& this->lower_slices != NULL && !this->lower_slices->expolygons.empty()){
|
||||||
//split the polygons with bottom/notbottom
|
//split the polygons with bottom/notbottom
|
||||||
ExPolygons support(this->lower_slices->expolygons);
|
ExPolygons unsupported = diff_ex(last, this->lower_slices->expolygons, true);
|
||||||
ExPolygons unsupported = diff_ex(last, support, true);
|
|
||||||
if (!unsupported.empty()) {
|
if (!unsupported.empty()) {
|
||||||
//only consider overhangs and let bridges alone
|
//only consider overhangs and let bridges alone
|
||||||
// it's more reliable than the BridgeDetector
|
if (true) {
|
||||||
ExPolygonCollection coll_last(support);
|
//only consider the part that can be bridged (really, by the bridge algorithm)
|
||||||
ExPolygon hull;
|
//first, separate into islands (ie, each ExPlolygon)
|
||||||
hull.contour = coll_last.convex_hull();
|
int numploy = 0;
|
||||||
unsupported = diff_ex(unsupported, ExPolygons() = { hull });
|
//only consider the bottom layer that intersect unsupported, to be sure it's only on our island.
|
||||||
|
ExPolygonCollection lower_island(diff_ex(last, unsupported, true));
|
||||||
|
BridgeDetector detector(unsupported,
|
||||||
|
lower_island,
|
||||||
|
perimeter_spacing);
|
||||||
|
if (detector.detect_angle(Geometry::deg2rad(this->config->bridge_angle.value))) {
|
||||||
|
ExPolygons bridgeable = union_ex(detector.coverage(-1, true));
|
||||||
|
if (!bridgeable.empty()) {
|
||||||
|
//simplify to avoid most of artefacts from printing lines.
|
||||||
|
ExPolygons bridgeable_simplified;
|
||||||
|
for (ExPolygon &poly : bridgeable) {
|
||||||
|
poly.simplify(perimeter_spacing / 2, &bridgeable_simplified);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bridgeable_simplified.empty())
|
||||||
|
bridgeable_simplified = offset_ex(bridgeable_simplified, perimeter_spacing/1.9);
|
||||||
|
if (!bridgeable_simplified.empty()) {
|
||||||
|
//offset by perimeter spacing because the simplify may have reduced it a bit.
|
||||||
|
unsupported = diff_ex(unsupported, bridgeable_simplified, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ExPolygonCollection coll_last(intersection_ex(last, offset_ex(this->lower_slices->expolygons, -perimeter_spacing / 2)));
|
||||||
|
ExPolygon hull;
|
||||||
|
hull.contour = coll_last.convex_hull();
|
||||||
|
unsupported = diff_ex(offset_ex(unsupported, perimeter_spacing), ExPolygons() = { hull });
|
||||||
|
}
|
||||||
if (!unsupported.empty()) {
|
if (!unsupported.empty()) {
|
||||||
//add fake perimeters here
|
//add fake perimeters here
|
||||||
may_add_more_perimeters = true;
|
may_add_more_perimeters = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user