diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2015-01-06 22:52:36 +0300 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2015-01-06 22:52:36 +0300 |
commit | 8f4cbefd0dd71cd6ae8dc149bd2e349905cd1ee8 (patch) | |
tree | bc62ca8f84cf8cdc4824bc9cf72547cf70cba602 /xs/t | |
parent | 5e100abe2545ba5f61edce541c91b63aa3e14347 (diff) |
Lots of improvements to MotionPlanner/avoid_crossing_perimeters. Smoother paths and several edge cases now handled better
Diffstat (limited to 'xs/t')
-rw-r--r-- | xs/t/09_polyline.t | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/xs/t/09_polyline.t b/xs/t/09_polyline.t index 824f049e9..fa5a3c48b 100644 --- a/xs/t/09_polyline.t +++ b/xs/t/09_polyline.t @@ -4,7 +4,7 @@ use strict; use warnings; use Slic3r::XS; -use Test::More tests => 18; +use Test::More tests => 21; my $points = [ [100, 100], @@ -88,4 +88,40 @@ is_deeply $polyline->pp, [ @$points, @$points ], 'append_polyline'; is scalar(@$p2), 4, 'split_at'; } +{ + my $polyline = Slic3r::Polyline->new( + map [$_,10], (0,10,20,30,40,50,60) + ); + { + my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new( + [25,0], [55,0], [55,30], [25,30], + )); + my $p = $polyline->clone; + $p->simplify_by_visibility($expolygon); + is_deeply $p->pp, [ + map [$_,10], (0,10,20,30,50,60) + ], 'simplify_by_visibility()'; + } + { + my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new( + [-15,0], [75,0], [75,30], [-15,30], + )); + my $p = $polyline->clone; + $p->simplify_by_visibility($expolygon); + is_deeply $p->pp, [ + map [$_,10], (0,60) + ], 'simplify_by_visibility()'; + } + { + my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new( + [-15,0], [25,0], [25,30], [-15,30], + )); + my $p = $polyline->clone; + $p->simplify_by_visibility($expolygon); + is_deeply $p->pp, [ + map [$_,10], (0,20,30,40,50,60) + ], 'simplify_by_visibility()'; + } +} + __END__ |