Ported point_along_segment(), Polyline::length(), Polyline::clip_end() to XS

This commit is contained in:
Alessandro Ranellucci 2013-10-27 22:57:25 +01:00
parent 26a18a2a52
commit 29b83517cb
12 changed files with 64 additions and 57 deletions
lib/Slic3r

View file

@ -264,8 +264,7 @@ sub extrude_loop {
# the rotation of the second segment so we might cross the object boundary
my $first_segment = Slic3r::Line->new(@{$extrusion_path->polyline}[0,1]);
my $distance = min(scale $extrusion_path->flow_spacing, $first_segment->length);
my $point = Slic3r::Geometry::point_along_segment(@$first_segment, $distance);
$point = Slic3r::Point->new(@$point);
my $point = $first_segment->point_at($distance);
$point->rotate($angle, $extrusion_path->first_point);
# generate the travel move
@ -474,8 +473,8 @@ sub retract {
my $wipe_path;
if ($self->extruder->wipe && $self->wipe_path) {
my @points = @{$self->wipe_path};
$wipe_path = Slic3r::Polyline->new($self->last_pos, @{$self->wipe_path}[1..$#{$self->wipe_path}])
->clip_start($self->extruder->scaled_wipe_distance);
$wipe_path = Slic3r::Polyline->new($self->last_pos, @{$self->wipe_path}[1..$#{$self->wipe_path}]);
$wipe_path->clip_end($wipe_path->length - $self->extruder->scaled_wipe_distance);
}
# prepare moves