Removed useless Polygon constructor and some cleanup

This commit is contained in:
Alessandro Ranellucci 2012-05-23 11:51:20 +02:00
parent 5a78111efa
commit efdf266df1
2 changed files with 5 additions and 26 deletions

View File

@ -9,26 +9,6 @@ use Slic3r::Geometry qw(polygon_lines polygon_remove_parallel_continuous_edges
scale polygon_remove_acute_vertices polygon_segment_having_point point_in_polygon); scale polygon_remove_acute_vertices polygon_segment_having_point point_in_polygon);
use Slic3r::Geometry::Clipper qw(JT_MITER); use Slic3r::Geometry::Clipper qw(JT_MITER);
# the constructor accepts an array(ref) of points
sub new {
my $class = shift;
my $self;
if (@_ == 1) {
$self = [ @{$_[0]} ];
} else {
$self = [ @_ ];
}
bless $self, $class;
bless $_, 'Slic3r::Point' for @$self;
$self;
}
sub clone {
my $self = shift;
return (ref $self)->new(map $_->clone, @$self);
}
sub lines { sub lines {
my $self = shift; my $self = shift;
my @lines = polygon_lines($self); my @lines = polygon_lines($self);
@ -51,12 +31,6 @@ sub make_clockwise {
$self->reverse if $self->is_counter_clockwise; $self->reverse if $self->is_counter_clockwise;
} }
sub cleanup {
my $self = shift;
$self->merge_continuous_lines;
return @$self >= 3;
}
sub merge_continuous_lines { sub merge_continuous_lines {
my $self = shift; my $self = shift;

View File

@ -22,6 +22,11 @@ sub new {
$self; $self;
} }
sub clone {
my $self = shift;
return (ref $self)->new(map $_->clone, @$self);
}
sub serialize { sub serialize {
my $self = shift; my $self = shift;
my $s = \ pack 'l*', map @$_, @$self; my $s = \ pack 'l*', map @$_, @$self;