~ubuntu-branches/ubuntu/utopic/slic3r/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/Slic3r/GCode.pm

  • Committer: Package Import Robot
  • Author(s): Alessandro Ranellucci
  • Date: 2014-08-06 11:18:02 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140806111802-8v6iez93cj6skz5l
Tags: 1.1.7+dfsg-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
    if ($self->config->spiral_vase) {
159
159
        $loop->split_at($last_pos);
160
160
    } elsif ($self->config->seam_position eq 'nearest' || $self->config->seam_position eq 'aligned') {
 
161
        # simplify polygon in order to skip false positives in concave/convex detection
161
162
        my $polygon = $loop->polygon;
162
 
        my @candidates = @{$polygon->concave_points(PI*4/3)};
163
 
        @candidates = @{$polygon->convex_points(PI*2/3)} if !@candidates;
164
 
        @candidates = @{$polygon} if !@candidates;
165
 
        
166
 
        my @non_overhang = grep !$loop->has_overhang_point($_), @candidates;
167
 
        @candidates = @non_overhang if @non_overhang;
168
 
        
 
163
        my @simplified = @{$polygon->simplify(scale $self->extruder->nozzle_diameter/2)};
 
164
        
 
165
        # concave vertices have priority
 
166
        my @candidates = map @{$_->concave_points(PI*4/3)}, @simplified;
 
167
        
 
168
        # if no concave points were found, look for convex vertices
 
169
        @candidates = map @{$_->convex_points(PI*2/3)}, @simplified if !@candidates;
 
170
        
 
171
        # retrieve the last start position for this object
 
172
        if (defined $self->layer && defined $self->_seam_position->{$self->layer->object}) {
 
173
            $last_pos = $self->_seam_position->{$self->layer->object};
 
174
        }
 
175
        
 
176
        my $point;
169
177
        if ($self->config->seam_position eq 'nearest') {
170
 
            $loop->split_at_vertex($last_pos->nearest_point(\@candidates));
171
 
        } elsif ($self->config->seam_position eq 'aligned') {
172
 
            if (defined $self->layer && defined $self->_seam_position->{$self->layer->object}) {
173
 
                $last_pos = $self->_seam_position->{$self->layer->object};
174
 
            }
175
 
            my $point = $self->_seam_position->{$self->layer->object} = $last_pos->nearest_point(\@candidates);
176
 
            $loop->split_at_vertex($point);
 
178
            @candidates = @$polygon if !@candidates;
 
179
            $point = $last_pos->nearest_point(\@candidates);
 
180
            $loop->split_at_vertex($point);
 
181
        } elsif (@candidates) {
 
182
            my @non_overhang = grep !$loop->has_overhang_point($_), @candidates;
 
183
            @candidates = @non_overhang if @non_overhang;
 
184
            $point = $last_pos->nearest_point(\@candidates);
 
185
            $loop->split_at_vertex($point);
 
186
        } else {
 
187
            $point = $last_pos->projection_onto_polygon($polygon);
 
188
            $loop->split_at($point);
177
189
        }
 
190
        $self->_seam_position->{$self->layer->object} = $point;
178
191
    } elsif ($self->config->seam_position eq 'random') {
179
192
        if ($loop->role == EXTRL_ROLE_CONTOUR_INTERNAL_PERIMETER) {
180
193
            my $polygon = $loop->polygon;
334
347
    # *and* in an island in the upper layer (so that the ooze will not be visible)
335
348
    if ($travel->length < scale $self->extruder->retract_before_travel
336
349
        || ($self->config->only_retract_when_crossing_perimeters
 
350
            && $self->config->fill_density > 0
337
351
            && (first { $_->contains_line($travel) } @{$self->_upper_layer_islands})
338
352
            && (first { $_->contains_line($travel) } @{$self->_layer_islands}))
339
353
        || (defined $role && $role == EXTR_ROLE_SUPPORTMATERIAL && (first { $_->contains_line($travel) } @{$self->layer->support_islands}))