mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-13 03:01:48 +08:00
Added a possibility into thick_polyline_to_extrusion_paths() to separately set tolerance for merging two following lines based on a difference between lines width.
This commit is contained in:
parent
9dbb9d472c
commit
4015a83acb
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
static ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_polyline, ExtrusionRole role, const Flow &flow, const float tolerance)
|
static ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_polyline, ExtrusionRole role, const Flow &flow, const float tolerance, const float merge_tolerance)
|
||||||
{
|
{
|
||||||
ExtrusionPaths paths;
|
ExtrusionPaths paths;
|
||||||
ExtrusionPath path(role);
|
ExtrusionPath path(role);
|
||||||
@ -71,7 +71,7 @@ static ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thi
|
|||||||
path.height = new_flow.height();
|
path.height = new_flow.height();
|
||||||
} else {
|
} else {
|
||||||
thickness_delta = fabs(scale_(flow.width()) - w);
|
thickness_delta = fabs(scale_(flow.width()) - w);
|
||||||
if (thickness_delta <= tolerance) {
|
if (thickness_delta <= merge_tolerance) {
|
||||||
// the width difference between this line and the current flow width is
|
// the width difference between this line and the current flow width is
|
||||||
// within the accepted tolerance
|
// within the accepted tolerance
|
||||||
path.polyline.append(line.b);
|
path.polyline.append(line.b);
|
||||||
@ -95,7 +95,7 @@ static void variable_width(const ThickPolylines& polylines, ExtrusionRole role,
|
|||||||
// of segments, and any pruning shall be performed before we apply this tolerance.
|
// of segments, and any pruning shall be performed before we apply this tolerance.
|
||||||
const float tolerance = float(scale_(0.05));
|
const float tolerance = float(scale_(0.05));
|
||||||
for (const ThickPolyline &p : polylines) {
|
for (const ThickPolyline &p : polylines) {
|
||||||
ExtrusionPaths paths = thick_polyline_to_extrusion_paths(p, role, flow, tolerance);
|
ExtrusionPaths paths = thick_polyline_to_extrusion_paths(p, role, flow, tolerance, tolerance);
|
||||||
// Append paths to collection.
|
// Append paths to collection.
|
||||||
if (! paths.empty()) {
|
if (! paths.empty()) {
|
||||||
if (paths.front().first_point() == paths.back().last_point())
|
if (paths.front().first_point() == paths.back().last_point())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user