2013-06-22 17:16:45 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Slic3r::XS;
|
2022-05-04 15:05:56 +02:00
|
|
|
use Test::More tests => 4;
|
2013-06-22 17:16:45 +02:00
|
|
|
|
2013-07-03 11:38:01 +02:00
|
|
|
my $cube = {
|
|
|
|
vertices => [ [20,20,0], [20,0,0], [0,0,0], [0,20,0], [20,20,20], [0,20,20], [0,0,20], [20,0,20] ],
|
|
|
|
facets => [ [0,1,2], [0,2,3], [4,5,6], [4,6,7], [0,4,7], [0,7,1], [1,7,6], [1,6,2], [2,6,5], [2,5,3], [4,0,3], [4,3,5] ],
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
2013-09-10 00:40:46 +02:00
|
|
|
my $m = Slic3r::TriangleMesh->new;
|
2013-07-03 11:38:01 +02:00
|
|
|
$m->ReadFromPerl($cube->{vertices}, $cube->{facets});
|
2013-08-04 21:23:27 +02:00
|
|
|
my ($vertices, $facets) = ($m->vertices, $m->facets);
|
|
|
|
|
2013-07-03 11:38:01 +02:00
|
|
|
is_deeply $vertices, $cube->{vertices}, 'vertices arrayref roundtrip';
|
|
|
|
is_deeply $facets, $cube->{facets}, 'facets arrayref roundtrip';
|
2013-07-13 18:51:49 +02:00
|
|
|
|
2013-09-10 00:40:46 +02:00
|
|
|
{
|
|
|
|
my $m2 = $m->clone;
|
|
|
|
is_deeply $m2->vertices, $cube->{vertices}, 'cloned vertices arrayref roundtrip';
|
|
|
|
is_deeply $m2->facets, $cube->{facets}, 'cloned facets arrayref roundtrip';
|
|
|
|
$m2->scale(3); # check that it does not affect $m
|
|
|
|
}
|
2014-01-16 11:25:26 +01:00
|
|
|
}
|
|
|
|
|
2013-06-22 17:16:45 +02:00
|
|
|
__END__
|