Workaround Clipper changing point coordinates while performing simplify_polygons(), thus causing a crash in Slic3r. #2306
This commit is contained in:
parent
a78be203aa
commit
9c93e52c8f
@ -148,12 +148,19 @@ sub extrude_loop {
|
||||
if ($self->config->seam_position eq 'nearest') {
|
||||
@candidates = @$polygon if !@candidates;
|
||||
$point = $last_pos->nearest_point(\@candidates);
|
||||
$loop->split_at_vertex($point);
|
||||
if (!$loop->split_at_vertex($point)) {
|
||||
# On 32-bit Linux, Clipper will change some point coordinates by 1 unit
|
||||
# while performing simplify_polygons(), thus split_at_vertex() won't
|
||||
# find them anymore.
|
||||
$loop->split_at($point);
|
||||
}
|
||||
} elsif (@candidates) {
|
||||
my @non_overhang = grep !$loop->has_overhang_point($_), @candidates;
|
||||
@candidates = @non_overhang if @non_overhang;
|
||||
$point = $last_pos->nearest_point(\@candidates);
|
||||
$loop->split_at_vertex($point);
|
||||
if (!$loop->split_at_vertex($point)) {
|
||||
$loop->split_at($point);
|
||||
}
|
||||
} else {
|
||||
$point = $last_pos->projection_onto_polygon($polygon);
|
||||
$loop->split_at($point);
|
||||
|
@ -224,7 +224,7 @@ ExtrusionLoop::length() const
|
||||
return len;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
ExtrusionLoop::split_at_vertex(const Point &point)
|
||||
{
|
||||
for (ExtrusionPaths::iterator path = this->paths.begin(); path != this->paths.end(); ++path) {
|
||||
@ -261,10 +261,10 @@ ExtrusionLoop::split_at_vertex(const Point &point)
|
||||
// we can now override the old path list with the new one and stop looping
|
||||
this->paths = new_paths;
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
CONFESS("Point not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -92,7 +92,7 @@ class ExtrusionLoop : public ExtrusionEntity
|
||||
Point last_point() const;
|
||||
void polygon(Polygon* polygon) const;
|
||||
double length() const;
|
||||
void split_at_vertex(const Point &point);
|
||||
bool split_at_vertex(const Point &point);
|
||||
void split_at(const Point &point);
|
||||
void clip_end(double distance, ExtrusionPaths* paths) const;
|
||||
bool has_overhang_point(const Point &point) const;
|
||||
|
@ -20,7 +20,7 @@
|
||||
void append(ExtrusionPath* path)
|
||||
%code{% THIS->paths.push_back(*path); %};
|
||||
double length();
|
||||
void split_at_vertex(Point* point)
|
||||
bool split_at_vertex(Point* point)
|
||||
%code{% THIS->split_at_vertex(*point); %};
|
||||
void split_at(Point* point)
|
||||
%code{% THIS->split_at(*point); %};
|
||||
|
Loading…
Reference in New Issue
Block a user