New TriangleMesh::XS->stats method
This commit is contained in:
parent
98726fdef4
commit
b709acf10f
3 changed files with 25 additions and 2 deletions
|
@ -22,7 +22,6 @@ class TriangleMesh
|
||||||
void Repair();
|
void Repair();
|
||||||
void WriteOBJFile(char* output_file);
|
void WriteOBJFile(char* output_file);
|
||||||
AV* ToPerl();
|
AV* ToPerl();
|
||||||
private:
|
|
||||||
stl_file stl;
|
stl_file stl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Slic3r::XS;
|
use Slic3r::XS;
|
||||||
use Test::More tests => 3;
|
use Test::More tests => 4;
|
||||||
|
|
||||||
is Slic3r::TriangleMesh::XS::hello_world(), 'Hello world!',
|
is Slic3r::TriangleMesh::XS::hello_world(), 'Hello world!',
|
||||||
'hello world';
|
'hello world';
|
||||||
|
@ -21,6 +21,9 @@ my $cube = {
|
||||||
my ($vertices, $facets) = @{$m->ToPerl};
|
my ($vertices, $facets) = @{$m->ToPerl};
|
||||||
is_deeply $vertices, $cube->{vertices}, 'vertices arrayref roundtrip';
|
is_deeply $vertices, $cube->{vertices}, 'vertices arrayref roundtrip';
|
||||||
is_deeply $facets, $cube->{facets}, 'facets arrayref roundtrip';
|
is_deeply $facets, $cube->{facets}, 'facets arrayref roundtrip';
|
||||||
|
|
||||||
|
my $stats = $m->stats;
|
||||||
|
is $stats->{number_of_facets}, scalar(@{ $cube->{facets} }), 'stats.number_of_facets';
|
||||||
}
|
}
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
|
|
@ -13,6 +13,27 @@
|
||||||
void Repair();
|
void Repair();
|
||||||
void WriteOBJFile(char* output_file);
|
void WriteOBJFile(char* output_file);
|
||||||
AV* ToPerl();
|
AV* ToPerl();
|
||||||
|
%{
|
||||||
|
|
||||||
|
SV*
|
||||||
|
TriangleMesh::stats()
|
||||||
|
CODE:
|
||||||
|
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, "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) );
|
||||||
|
(void)hv_stores( hv, "facets_added", newSViv(THIS->stl.stats.facets_added) );
|
||||||
|
(void)hv_stores( hv, "facets_reversed", newSViv(THIS->stl.stats.facets_reversed) );
|
||||||
|
(void)hv_stores( hv, "backwards_edges", newSViv(THIS->stl.stats.backwards_edges) );
|
||||||
|
(void)hv_stores( hv, "normals_fixed", newSViv(THIS->stl.stats.normals_fixed) );
|
||||||
|
(void)hv_stores( hv, "facets_reversed", newSViv(THIS->stl.stats.facets_reversed) );
|
||||||
|
RETVAL = (SV*)newRV_noinc((SV*)hv);
|
||||||
|
OUTPUT:
|
||||||
|
RETVAL
|
||||||
|
|
||||||
|
%}
|
||||||
};
|
};
|
||||||
|
|
||||||
%package{Slic3r::TriangleMesh::XS};
|
%package{Slic3r::TriangleMesh::XS};
|
||||||
|
|
Loading…
Reference in a new issue