mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Reworked the bridge detector to allow searching a single bridging
direction over multiple regions. This allows a single bridge to be drawn over holes, which are too close to each other to allow for separate bridges. Fixes Bridging-Angle not optimal https://github.com/prusa3d/Slic3r/issues/12 Re-allowed adaptive infill line width for solid infills. The adaptive infill line width works in some circumstances, see Issue #15, but the original implementation often changed the line width too aggressively. The current implementation limits the line width change to 20%. Fixes Gaps between infill and perimeter leads to errors in laydown on following layer https://github.com/prusa3d/Slic3r/issues/15
This commit is contained in:
parent
5a81731577
commit
22ca927f12
7 changed files with 433 additions and 443 deletions
|
@ -8,20 +8,29 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
// The bridge detector optimizes a direction of bridges over a region or a set of regions.
|
||||
// A bridge direction is considered optimal, if the length of the lines strang over the region is maximal.
|
||||
// This is optimal if the bridge is supported in a single direction only, but
|
||||
// it may not likely be optimal, if the bridge region is supported from all sides. Then an optimal
|
||||
// solution would find a direction with shortest bridges.
|
||||
// The bridge orientation is measured CCW from the X axis.
|
||||
class BridgeDetector {
|
||||
public:
|
||||
// The non-grown hole.
|
||||
ExPolygon expolygon;
|
||||
// The non-grown holes.
|
||||
const ExPolygons &expolygons;
|
||||
// In case the caller gaves us the input polygons by a value, make a copy.
|
||||
ExPolygons expolygons_owned;
|
||||
// Lower slices, all regions.
|
||||
ExPolygonCollection lower_slices;
|
||||
const ExPolygonCollection &lower_slices;
|
||||
// Scaled extrusion width of the infill.
|
||||
double extrusion_width;
|
||||
coord_t spacing;
|
||||
// Angle resolution for the brute force search of the best bridging angle.
|
||||
double resolution;
|
||||
double resolution;
|
||||
// The final optimal angle.
|
||||
double angle;
|
||||
double angle;
|
||||
|
||||
BridgeDetector(const ExPolygon &_expolygon, const ExPolygonCollection &_lower_slices, coord_t _extrusion_width);
|
||||
BridgeDetector(ExPolygon _expolygon, const ExPolygonCollection &_lower_slices, coord_t _extrusion_width);
|
||||
BridgeDetector(const ExPolygons &_expolygons, const ExPolygonCollection &_lower_slices, coord_t _extrusion_width);
|
||||
bool detect_angle();
|
||||
void coverage(double angle, Polygons* coverage) const;
|
||||
Polygons coverage(double angle = -1) const;
|
||||
|
@ -29,10 +38,27 @@ public:
|
|||
Polylines unsupported_edges(double angle = -1) const;
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
|
||||
struct BridgeDirection {
|
||||
BridgeDirection(double a = -1.) : angle(a), coverage(0.), max_length(0.) {}
|
||||
// the best direction is the one causing most lines to be bridged (thus most coverage)
|
||||
bool operator<(const BridgeDirection &other) const {
|
||||
// Initial sort by coverage only - comparator must obey strict weak ordering
|
||||
return this->coverage > other.coverage;
|
||||
};
|
||||
double angle;
|
||||
double coverage;
|
||||
double max_length;
|
||||
};
|
||||
|
||||
// Get possible briging direction candidates.
|
||||
std::vector<double> bridge_direction_candidates() const;
|
||||
|
||||
// Open lines representing the supporting edges.
|
||||
Polylines _edges;
|
||||
// Closed polygons representing the supporting areas.
|
||||
ExPolygons _anchors;
|
||||
ExPolygons _anchor_regions;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue