diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-11-11 13:21:48 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-11-11 13:21:48 +0400 |
commit | fec816b065aa869facbcacb6e64c4ef6bf23c01f (patch) | |
tree | 6e81ee0fb2cfc4f5c45d8f41f9a0680b1cce774d /lib/Slic3r/Point.pm | |
parent | 91e250a2fdc3c95bd2318709a089448cc85320ea (diff) |
Collect undetected lines (caused by dirty or non-manifold models), warn the user, post debug info. Includes some further ExPolygon refactoring.
Diffstat (limited to 'lib/Slic3r/Point.pm')
-rw-r--r-- | lib/Slic3r/Point.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Slic3r/Point.pm b/lib/Slic3r/Point.pm index e8570ef8a..a9bc3ea99 100644 --- a/lib/Slic3r/Point.pm +++ b/lib/Slic3r/Point.pm @@ -4,22 +4,31 @@ use warnings; sub new { my $class = shift; - my $self;use XXX; ZZZ if !defined $_[0]; + my $self; if (@_ == 2) { $self = [@_]; - } elsif (ref $_[0] eq 'ARRAY') { + } elsif ((ref $_[0]) =~ 'ARRAY' || (ref $_[0]) =~ /Slic3r::Point/) { $self = [@{$_[0]}]; } elsif ($_[0]->isa(__PACKAGE__)) { return $_[0]; } else { use XXX; - ZZZ "test"; + ZZZ \@_; die "Invalid arguments for ${class}->new"; } bless $self, $class; return $self; } +sub cast { + my $class = shift; + if (ref $_[0] eq 'Slic3r::Point') { + return $_[0]; + } else { + return $class->new(@_); + } +} + sub id { my $self = shift; return join ',', @$self; |