Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEyal Soha <eyalsoha@google.com>2017-01-12 11:59:33 +0300
committerEyal Soha <eyalsoha@google.com>2017-01-12 12:30:14 +0300
commitb851e04c17085dccad5971cc50ea5715f770a65c (patch)
treed99ba570ac81445998f08782f0988590c33832d3 /xs/src/libslic3r/Fill
parent0db4be56a541adb1873c6cd12c6c957726363642 (diff)
parent41fbec90630509bcc60435cfc5935a451ce7d3e6 (diff)
Change char to int
char might be signed or unsigned but int is definitely signed. This fixes prusa3d/Slic3r#93 .
Diffstat (limited to 'xs/src/libslic3r/Fill')
-rw-r--r--xs/src/libslic3r/Fill/Fill.cpp29
-rw-r--r--xs/src/libslic3r/Fill/Fill3DHoneycomb.cpp2
-rw-r--r--xs/src/libslic3r/Fill/FillBase.cpp3
-rw-r--r--xs/src/libslic3r/Fill/FillConcentric.cpp2
-rw-r--r--xs/src/libslic3r/Fill/FillHoneycomb.cpp4
-rw-r--r--xs/src/libslic3r/Fill/FillPlanePath.cpp2
-rw-r--r--xs/src/libslic3r/Fill/FillRectilinear.cpp2
-rw-r--r--xs/src/libslic3r/Fill/FillRectilinear2.cpp8
8 files changed, 25 insertions, 27 deletions
diff --git a/xs/src/libslic3r/Fill/Fill.cpp b/xs/src/libslic3r/Fill/Fill.cpp
index d840d44c0..b4c14bb6c 100644
--- a/xs/src/libslic3r/Fill/Fill.cpp
+++ b/xs/src/libslic3r/Fill/Fill.cpp
@@ -246,22 +246,21 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
flow = Flow::new_from_spacing(f->spacing, flow.nozzle_diameter, h, is_bridge || f->use_bridge_flow());
}
- // save into layer
- {
- ExtrusionRole role = is_bridge ? erBridgeInfill :
- (surface.is_solid() ? ((surface.surface_type == stTop) ? erTopSolidInfill : erSolidInfill) : erInternalInfill);
- ExtrusionEntityCollection &collection = *(new ExtrusionEntityCollection());
- out.entities.push_back(&collection);
- // Only concentric fills are not sorted.
- collection.no_sort = f->no_sort();
- for (Polylines::iterator it = polylines.begin(); it != polylines.end(); ++ it) {
- ExtrusionPath *path = new ExtrusionPath(role, flow.mm3_per_mm(), flow.width, flow.height);
- collection.entities.push_back(path);
- path->polyline.points.swap(it->points);
- }
- }
+ // Save into layer.
+ auto *eec = new ExtrusionEntityCollection();
+ out.entities.push_back(eec);
+ // Only concentric fills are not sorted.
+ eec->no_sort = f->no_sort();
+ extrusion_entities_append_paths(
+ eec->entities, STDMOVE(polylines),
+ is_bridge ?
+ erBridgeInfill :
+ (surface.is_solid() ?
+ ((surface.surface_type == stTop) ? erTopSolidInfill : erSolidInfill) :
+ erInternalInfill),
+ flow.mm3_per_mm(), flow.width, flow.height);
}
-
+
// add thin fill regions
// thin_fills are of C++ Slic3r::ExtrusionEntityCollection, perl type Slic3r::ExtrusionPath::Collection
// Unpacks the collection, creates multiple collections per path.
diff --git a/xs/src/libslic3r/Fill/Fill3DHoneycomb.cpp b/xs/src/libslic3r/Fill/Fill3DHoneycomb.cpp
index c37328c69..c763952d6 100644
--- a/xs/src/libslic3r/Fill/Fill3DHoneycomb.cpp
+++ b/xs/src/libslic3r/Fill/Fill3DHoneycomb.cpp
@@ -168,7 +168,7 @@ void Fill3DHoneycomb::_fill_surface_single(
it->translate(bb.min.x, bb.min.y);
// clip pattern to boundaries
- intersection(polylines, (Polygons)expolygon, &polylines);
+ polylines = intersection_pl(polylines, (Polygons)expolygon);
// connect lines
if (! params.dont_connect && ! polylines.empty()) { // prevent calling leftmost_point() on empty collections
diff --git a/xs/src/libslic3r/Fill/FillBase.cpp b/xs/src/libslic3r/Fill/FillBase.cpp
index d19615aa9..7258e11fe 100644
--- a/xs/src/libslic3r/Fill/FillBase.cpp
+++ b/xs/src/libslic3r/Fill/FillBase.cpp
@@ -45,8 +45,7 @@ Fill* Fill::new_from_type(const std::string &type)
Polylines Fill::fill_surface(const Surface *surface, const FillParams &params)
{
// Perform offset.
- Slic3r::ExPolygons expp;
- offset(surface->expolygon, &expp, -0.5*scale_(this->spacing));
+ Slic3r::ExPolygons expp = offset_ex(surface->expolygon, float(-0.5*scale_(this->spacing)));
// Create the infills for each of the regions.
Polylines polylines_out;
for (size_t i = 0; i < expp.size(); ++ i)
diff --git a/xs/src/libslic3r/Fill/FillConcentric.cpp b/xs/src/libslic3r/Fill/FillConcentric.cpp
index 27914866d..156e3478a 100644
--- a/xs/src/libslic3r/Fill/FillConcentric.cpp
+++ b/xs/src/libslic3r/Fill/FillConcentric.cpp
@@ -33,7 +33,7 @@ void FillConcentric::_fill_surface_single(
// generate paths from the outermost to the innermost, to avoid
// adhesion problems of the first central tiny loops
- union_pt_chained(loops, &loops, false);
+ loops = union_pt_chained(loops, false);
// split paths using a nearest neighbor search
size_t iPathFirst = polylines_out.size();
diff --git a/xs/src/libslic3r/Fill/FillHoneycomb.cpp b/xs/src/libslic3r/Fill/FillHoneycomb.cpp
index b264d80cc..22dea85da 100644
--- a/xs/src/libslic3r/Fill/FillHoneycomb.cpp
+++ b/xs/src/libslic3r/Fill/FillHoneycomb.cpp
@@ -93,7 +93,7 @@ void FillHoneycomb::_fill_surface_single(
Polylines p;
for (Polygons::iterator it = polygons.begin(); it != polygons.end(); ++ it)
p.push_back((Polyline)(*it));
- intersection(p, (Polygons)expolygon, &paths);
+ paths = intersection_pl(p, to_polygons(expolygon));
}
// connect paths
@@ -122,7 +122,7 @@ void FillHoneycomb::_fill_surface_single(
}
// clip paths again to prevent connection segments from crossing the expolygon boundaries
- intersection(paths, to_polygons(offset_ex(expolygon, SCALED_EPSILON)), &paths);
+ paths = intersection_pl(paths, to_polygons(offset_ex(expolygon, SCALED_EPSILON)));
// Move the polylines to the output, avoid a deep copy.
size_t j = polylines_out.size();
polylines_out.resize(j + paths.size(), Polyline());
diff --git a/xs/src/libslic3r/Fill/FillPlanePath.cpp b/xs/src/libslic3r/Fill/FillPlanePath.cpp
index 34e155a06..f71ef95a1 100644
--- a/xs/src/libslic3r/Fill/FillPlanePath.cpp
+++ b/xs/src/libslic3r/Fill/FillPlanePath.cpp
@@ -44,7 +44,7 @@ void FillPlanePath::_fill_surface_single(
coord_t(floor(it->x * distance_between_lines + 0.5)),
coord_t(floor(it->y * distance_between_lines + 0.5))));
// intersection(polylines_src, offset((Polygons)expolygon, scale_(0.02)), &polylines);
- intersection(polylines, (Polygons)expolygon, &polylines);
+ polylines = intersection_pl(polylines, to_polygons(expolygon));
/*
if (1) {
diff --git a/xs/src/libslic3r/Fill/FillRectilinear.cpp b/xs/src/libslic3r/Fill/FillRectilinear.cpp
index 5559a5437..991adc0b3 100644
--- a/xs/src/libslic3r/Fill/FillRectilinear.cpp
+++ b/xs/src/libslic3r/Fill/FillRectilinear.cpp
@@ -63,7 +63,7 @@ void FillRectilinear::_fill_surface_single(
pts.push_back(it->a);
pts.push_back(it->b);
}
- Polylines polylines = intersection(polylines_src, offset((Polygons)expolygon, scale_(0.02)), false);
+ Polylines polylines = intersection_pl(polylines_src, offset(to_polygons(expolygon), scale_(0.02)), false);
// FIXME Vojtech: This is only performed for horizontal lines, not for the vertical lines!
const float INFILL_OVERLAP_OVER_SPACING = 0.3f;
diff --git a/xs/src/libslic3r/Fill/FillRectilinear2.cpp b/xs/src/libslic3r/Fill/FillRectilinear2.cpp
index 03d92ce82..2edd6f72d 100644
--- a/xs/src/libslic3r/Fill/FillRectilinear2.cpp
+++ b/xs/src/libslic3r/Fill/FillRectilinear2.cpp
@@ -372,11 +372,9 @@ public:
bool sticks_removed = remove_sticks(polygons_src);
// if (sticks_removed) printf("Sticks removed!\n");
polygons_outer = offset(polygons_src, aoffset1,
- CLIPPER_OFFSET_SCALE,
ClipperLib::jtMiter,
mitterLimit);
polygons_inner = offset(polygons_outer, aoffset2 - aoffset1,
- CLIPPER_OFFSET_SCALE,
ClipperLib::jtMiter,
mitterLimit);
// Filter out contours with zero area or small area, contours with 2 points only.
@@ -884,7 +882,7 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
Point refpt = rotate_vector.second.rotated(- rotate_vector.first);
// _align_to_grid will not work correctly with positive pattern_shift.
coord_t pattern_shift_scaled = coord_t(scale_(pattern_shift)) % line_spacing;
- refpt.x -= (pattern_shift_scaled > 0) ? pattern_shift_scaled : (line_spacing + pattern_shift_scaled);
+ refpt.x -= (pattern_shift_scaled >= 0) ? pattern_shift_scaled : (line_spacing + pattern_shift_scaled);
bounding_box.merge(_align_to_grid(
bounding_box.min,
Point(line_spacing, line_spacing),
@@ -894,7 +892,9 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
// Intersect a set of euqally spaced vertical lines wiht expolygon.
// n_vlines = ceil(bbox_width / line_spacing)
size_t n_vlines = (bounding_box.max.x - bounding_box.min.x + line_spacing - 1) / line_spacing;
- coord_t x0 = bounding_box.min.x + (line_spacing + SCALED_EPSILON) / 2;
+ coord_t x0 = bounding_box.min.x;
+ if (full_infill)
+ x0 += (line_spacing + SCALED_EPSILON) / 2;
#ifdef SLIC3R_DEBUG
static int iRun = 0;