Fix cut() test

This commit is contained in:
Alessandro Ranellucci 2014-04-25 13:27:45 +02:00
parent 4f5d9ca795
commit 334bc4c581
2 changed files with 10 additions and 4 deletions

View File

@ -236,6 +236,8 @@ stl_rotate(float *x, float *y, float angle)
extern void extern void
stl_get_size(stl_file *stl) stl_get_size(stl_file *stl)
{ {
if (stl->stats.number_of_facets == 0) return;
int i; int i;
int j; int j;

View File

@ -107,7 +107,7 @@ my $cube = {
my $upper = Slic3r::TriangleMesh->new; my $upper = Slic3r::TriangleMesh->new;
my $lower = Slic3r::TriangleMesh->new; my $lower = Slic3r::TriangleMesh->new;
$m->cut(0, $upper, $lower); $m->cut(0, $upper, $lower);
#$upper->repair; $lower->repair; $upper->repair; $lower->repair;
is $upper->facets_count, 12, 'upper mesh has all facets except those belonging to the slicing plane'; is $upper->facets_count, 12, 'upper mesh has all facets except those belonging to the slicing plane';
is $lower->facets_count, 0, 'lower mesh has no facets'; is $lower->facets_count, 0, 'lower mesh has no facets';
} }
@ -115,9 +115,13 @@ my $cube = {
my $upper = Slic3r::TriangleMesh->new; my $upper = Slic3r::TriangleMesh->new;
my $lower = Slic3r::TriangleMesh->new; my $lower = Slic3r::TriangleMesh->new;
$m->cut(10, $upper, $lower); $m->cut(10, $upper, $lower);
#$upper->repair; $lower->repair; $upper->repair; $lower->repair;
is $upper->facets_count, 16, 'upper mesh has the right number of facets'; # we expect:
is $lower->facets_count, 16, 'lower mesh has the right number of facets'; # 2 facets on external horizontal surfaces
# 3 facets on each side = 12 facets
# 6 facets on the triangulated side (8 vertices)
is $upper->facets_count, 2+12+6, 'upper mesh has the expected number of facets';
is $lower->facets_count, 2+12+6, 'lower mesh has the expected number of facets';
} }
} }