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/Polygon.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/Polygon.pm')
-rw-r--r-- | lib/Slic3r/Polygon.pm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Slic3r/Polygon.pm b/lib/Slic3r/Polygon.pm index 376cc7ad7..734a8c9be 100644 --- a/lib/Slic3r/Polygon.pm +++ b/lib/Slic3r/Polygon.pm @@ -7,7 +7,7 @@ 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_remove_parallel_continuous_edges); +use Slic3r::Geometry qw(polygon_lines polygon_remove_parallel_continuous_edges); # the constructor accepts an array(ref) of points sub new { @@ -18,10 +18,23 @@ sub new { } else { $self = [ @_ ]; } + + @$self = map Slic3r::Point->cast($_), @$self; bless $self, $class; $self; } +# legacy method, to be removed when we ditch Slic3r::Polyline::Closed +sub closed_polyline { + my $self = shift; + return Slic3r::Polyline::Closed->cast($self); +} + +sub lines { + my $self = shift; + return map Slic3r::Line->new($_), polygon_lines($self); +} + sub cleanup { my $self = shift; polygon_remove_parallel_continuous_edges($self); |