2014-01-06 17:29:10 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Slic3r::XS;
|
2014-09-21 08:51:36 +00:00
|
|
|
use Test::More tests => 5;
|
2014-01-06 17:29:10 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
my @points = (
|
|
|
|
Slic3r::Point->new(100, 200),
|
|
|
|
Slic3r::Point->new(500, -600),
|
|
|
|
);
|
|
|
|
my $bb = Slic3r::Geometry::BoundingBox->new_from_points(\@points);
|
2014-01-07 11:48:09 +00:00
|
|
|
isa_ok $bb, 'Slic3r::Geometry::BoundingBox', 'new_from_points';
|
2014-01-06 17:29:10 +00:00
|
|
|
is_deeply $bb->min_point->pp, [100,-600], 'min_point';
|
|
|
|
is_deeply $bb->max_point->pp, [500,200], 'max_point';
|
|
|
|
}
|
|
|
|
|
2014-09-21 08:51:36 +00:00
|
|
|
{
|
|
|
|
my $bb = Slic3r::Geometry::BoundingBox->new;
|
|
|
|
$bb->merge_point(Slic3r::Point->new(10, 10));
|
|
|
|
is_deeply $bb->min_point->pp, [10,10], 'min_point equals to the only defined point';
|
|
|
|
is_deeply $bb->max_point->pp, [10,10], 'max_point equals to the only defined point';
|
|
|
|
}
|
|
|
|
|
2014-01-06 17:29:10 +00:00
|
|
|
__END__
|