Implement nearest point index and split at index to avoid search for point.

This commit is contained in:
Mark Hindess 2012-07-02 20:26:56 +01:00
parent 35fda7de23
commit 35ecd65e77
4 changed files with 31 additions and 16 deletions

View file

@ -57,10 +57,11 @@ sub fill_surface {
$loop->polygon->make_counter_clockwise;
# find the point of the loop that is closest to the current extruder position
$cur_pos = $loop->nearest_point_to($cur_pos);
my $index = $loop->nearest_point_index_to($cur_pos);
$cur_pos = $loop->polygon->[0];
# split the loop at the starting point and make a path
my $path = $loop->split_at($cur_pos);
my $path = $loop->split_at_index($index);
$path->deserialize;
# clip the path to avoid the extruder to get exactly on the first point of the loop