Fixes for bridges

This commit is contained in:
Alessandro Ranellucci 2011-10-09 22:18:06 +02:00
parent 459577f9a2
commit 84abd41cf4
9 changed files with 131 additions and 31 deletions

View file

@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
plan tests => 15;
plan tests => 17;
BEGIN {
use FindBin;
@ -10,7 +10,9 @@ BEGIN {
}
use Slic3r;
use Slic3r::Geometry qw(PI);
use Slic3r::Geometry qw(PI polyline_remove_parallel_continuous_edges
polyline_remove_acute_vertices polygon_remove_acute_vertices
polygon_remove_parallel_continuous_edges);
#==========================================================
@ -114,3 +116,40 @@ is Slic3r::Geometry::can_connect_points(@$points, $polygons), 0, 'can_connect_po
}
#==========================================================
{
my $polygon = [
[2265447881, 7013509857], [2271869937, 7009802077], [2606221146, 6816764300], [1132221146, 4263721402],
[1098721150, 4205697705], [1228411320, 4130821051], [1557501031, 3940821051], [1737340080, 3836990933],
[1736886253, 3837252951], [1494771522, 3977037948], [2959638603, 6514262167], [3002271522, 6588104548],
[3083252364, 6541350240], [2854283608, 6673545411], [2525193897, 6863545411],
];
polygon_remove_parallel_continuous_edges($polygon);
polygon_remove_acute_vertices($polygon);
is scalar(@$polygon), 4, 'polygon_remove_acute_vertices';
use Slic3r::SVG;
#pop @$polygon;
Slic3r::SVG::output(undef, "vert.svg",
polylines => [$polygon],
);
}
#==========================================================
{
my $polygon = [
[226.5447881,701.3509857], [260.6221146,681.67643], [109.872115,420.5697705], [149.4771522,397.7037948],
[300.2271522,658.8104548], [308.3252364,654.135024],
];
polyline_remove_acute_vertices($polygon);
is scalar(@$polygon), 6, 'polyline_remove_acute_vertices';
use Slic3r::SVG;
local $Slic3r::resolution = 0.1;
pop @$polygon;
Slic3r::SVG::output(undef, "vert2.svg",
polylines => [$polygon],
);
}
#==========================================================

View file

@ -25,8 +25,8 @@ is_deeply lines(22, 20, 20), [ [ $points[2], $points[1] ] ], 'lower edge on laye
is_deeply lines(20, 20, 10), [ [ $points[0], $points[1] ] ], 'upper edge on layer';
is_deeply lines(20, 15, 10), [ ], 'upper vertex on layer';
is_deeply lines(28, 20, 30), [ ], 'lower vertex on layer';
is_deeply lines(24, 10, 16), [ [ [2, 6], [4, 4] ] ], 'two edges intersect';
is_deeply lines(24, 10, 20), [ [ [1, 9], [4, 4] ] ], 'one vertex on plane and one edge intersects';
is_deeply lines(24, 10, 16), [ [ [4, 4], [2, 6] ] ], 'two edges intersect';
is_deeply lines(24, 10, 20), [ [ [4, 4], [1, 9] ] ], 'one vertex on plane and one edge intersects';
my @lower = $stl->intersect_facet(vertices(22, 20, 20), $z, $dz);
my @upper = $stl->intersect_facet(vertices(20, 20, 10), $z, $dz);