ENH: improve bridge direction detection

Thanks to Prusa.
Jira: STUDIO-2453

Change-Id: Iadcc59df44d5abc552f5d558a500fd9bcd66d43f
(cherry picked from commit c19156fd037df4231f3e0cb1e9a899c9b7525372)
This commit is contained in:
Arthur 2023-03-10 20:44:07 +08:00 committed by Lane.Wei
parent dbe1f3f5b1
commit 246ff2653d
6 changed files with 238 additions and 2 deletions

View file

@ -305,6 +305,15 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
// would get merged into a single one while they need different directions
// also, supply the original expolygon instead of the grown one, because in case
// of very thin (but still working) anchors, the grown expolygon would go beyond them
double custom_angle = Geometry::deg2rad(this->region().config().bridge_angle.value);
if (custom_angle > 0.0) {
bridges[idx_last].bridge_angle = custom_angle;
} else {
auto [bridging_dir, unsupported_dist] = detect_bridging_direction(to_polygons(initial), to_polygons(lower_layer->lslices));
bridges[idx_last].bridge_angle = PI + std::atan2(bridging_dir.y(), bridging_dir.x());
}
/*
BridgeDetector bd(initial, lower_layer->lslices, this->bridging_flow(frInfill, object_config.thick_bridges).scaled_width());
#ifdef SLIC3R_DEBUG
printf("Processing bridge at layer %zu:\n", this->layer()->id());
@ -321,6 +330,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
// using a bridging flow, therefore it makes sense to respect the custom bridging direction.
bridges[idx_last].bridge_angle = custom_angle;
}
*/
// without safety offset, artifacts are generated (GH #2494)
surfaces_append(bottom, union_safety_offset_ex(grown), bridges[idx_last]);
}