New fill types (hilbertcurve, archimedeanchords, octagramspiral) and ability to use different patterns for solid layers. #20

This commit is contained in:
Alessandro Ranellucci 2011-11-13 18:14:02 +01:00
parent 041e9877a3
commit 038caddcda
22 changed files with 391 additions and 93 deletions

View file

@ -7,7 +7,8 @@ use warnings;
# as a Slic3r::Polyline::Closed you're right. I plan to
# ditch the latter and port everything to this class.
use Slic3r::Geometry qw(polygon_lines polygon_remove_parallel_continuous_edges);
use Slic3r::Geometry qw(polygon_lines polygon_remove_parallel_continuous_edges
polygon_segment_having_point point_in_polygon move_points rotate_points);
# the constructor accepts an array(ref) of points
sub new {
@ -19,8 +20,8 @@ sub new {
$self = [ @_ ];
}
@$self = map Slic3r::Point->cast($_), @$self;
bless $self, $class;
bless $_, 'Slic3r::Point' for @$self;
$self;
}
@ -40,4 +41,28 @@ sub cleanup {
polygon_remove_parallel_continuous_edges($self);
}
sub point_on_segment {
my $self = shift;
my ($point) = @_;
return polygon_segment_having_point($self, $point);
}
sub encloses_point {
my $self = shift;
my ($point) = @_;
return point_in_polygon($point, $self);
}
sub translate {
my $self = shift;
my ($x, $y) = @_;
@$self = move_points([$x, $y], @$self);
}
sub rotate {
my $self = shift;
my ($angle, $center) = @_;
@$self = rotate_points($angle, $center, @$self);
}
1;