From 1bebe6097b34194ce72cea659c3f72c516de2101 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 2 Dec 2015 19:39:16 +0100 Subject: [PATCH] Make test happy --- xs/src/libslic3r/Geometry.cpp | 4 ++-- xs/t/14_geometry.t | 3 +-- xs/xsp/Geometry.xsp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/xs/src/libslic3r/Geometry.cpp b/xs/src/libslic3r/Geometry.cpp index f85078b92..8298bc198 100644 --- a/xs/src/libslic3r/Geometry.cpp +++ b/xs/src/libslic3r/Geometry.cpp @@ -175,7 +175,7 @@ arrange(size_t total_parts, Pointf part, coordf_t dist, const BoundingBoxf* bb) part.y += dist; Pointf area; - if (bb != NULL) { + if (bb != NULL && bb->defined) { area = bb->size(); } else { // bogus area size, large enough not to trigger the error below @@ -278,7 +278,7 @@ arrange(size_t total_parts, Pointf part, coordf_t dist, const BoundingBoxf* bb) positions.push_back(Pointf(cx * part.x, cy * part.y)); } - if (bb != NULL) { + if (bb != NULL && bb->defined) { for (Pointfs::iterator p = positions.begin(); p != positions.end(); ++p) { p->x += bb->min.x; p->y += bb->min.y; diff --git a/xs/t/14_geometry.t b/xs/t/14_geometry.t index 70b623029..1debe8e2c 100644 --- a/xs/t/14_geometry.t +++ b/xs/t/14_geometry.t @@ -33,8 +33,7 @@ use constant PI => 4 * atan2(1, 1); } { - my $positions = Slic3r::Geometry::arrange(4, Slic3r::Pointf->new(20, 20), - 5, Slic3r::Geometry::BoundingBoxf->new); + my $positions = Slic3r::Geometry::arrange(4, Slic3r::Pointf->new(20, 20), 5); is scalar(@$positions), 4, 'arrange() returns expected number of positions'; } diff --git a/xs/xsp/Geometry.xsp b/xs/xsp/Geometry.xsp index 1eebbfc8a..c5ed0fa5f 100644 --- a/xs/xsp/Geometry.xsp +++ b/xs/xsp/Geometry.xsp @@ -8,7 +8,7 @@ %package{Slic3r::Geometry}; -Pointfs arrange(size_t total_parts, Pointf* part, coordf_t dist, BoundingBoxf* bb) +Pointfs arrange(size_t total_parts, Pointf* part, coordf_t dist, BoundingBoxf* bb = NULL) %code{% RETVAL = Slic3r::Geometry::arrange(total_parts, *part, dist, bb); %}; %{