Add two more repair actions and add volume to stats
This commit is contained in:
parent
b709acf10f
commit
00683195c8
@ -88,6 +88,12 @@ TriangleMesh::Repair() {
|
||||
|
||||
// normal_values
|
||||
stl_fix_normal_values(&stl);
|
||||
|
||||
// always calculate the volume and reverse all normals if volume is negative
|
||||
stl_calculate_volume(&stl);
|
||||
|
||||
// neighbors
|
||||
stl_verify_neighbors(&stl);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4,7 +4,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Slic3r::XS;
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 5;
|
||||
|
||||
is Slic3r::TriangleMesh::XS::hello_world(), 'Hello world!',
|
||||
'hello world';
|
||||
@ -24,6 +24,7 @@ my $cube = {
|
||||
|
||||
my $stats = $m->stats;
|
||||
is $stats->{number_of_facets}, scalar(@{ $cube->{facets} }), 'stats.number_of_facets';
|
||||
ok abs($stats->{volume} - 20*20*20) < 1E-3, 'stats.volume';
|
||||
}
|
||||
|
||||
__END__
|
||||
|
@ -21,6 +21,7 @@ TriangleMesh::stats()
|
||||
HV* hv = newHV();
|
||||
(void)hv_stores( hv, "number_of_facets", newSViv(THIS->stl.stats.number_of_facets) );
|
||||
(void)hv_stores( hv, "number_of_parts", newSViv(THIS->stl.stats.number_of_parts) );
|
||||
(void)hv_stores( hv, "volume", newSVnv(THIS->stl.stats.volume) );
|
||||
(void)hv_stores( hv, "degenerate_facets", newSViv(THIS->stl.stats.degenerate_facets) );
|
||||
(void)hv_stores( hv, "edges_fixed", newSViv(THIS->stl.stats.edges_fixed) );
|
||||
(void)hv_stores( hv, "facets_removed", newSViv(THIS->stl.stats.facets_removed) );
|
||||
|
Loading…
Reference in New Issue
Block a user