Bugfix: pillars support material crashed when no overhangs were detected

visilibity
Alessandro Ranellucci 2014-04-07 15:24:17 +02:00
parent 1c020eda78
commit 93a7d87fc6
2 changed files with 6 additions and 1 deletions

View File

@ -647,6 +647,9 @@ sub generate_toolpaths {
sub generate_pillars_shape {
my ($self, $contact, $support_z, $shape) = @_;
# this prevents supplying an empty point set to BoundingBox constructor
return if !%$contact;
my $pillar_size = scale PILLAR_SIZE;
my $pillar_spacing = scale PILLAR_SPACING;
@ -658,7 +661,7 @@ sub generate_pillars_shape {
[$pillar_size, $pillar_size],
[0, $pillar_size],
);
my @pillars = ();
my $bb = Slic3r::Geometry::BoundingBox->new_from_points([ map @$_, map @$_, values %$contact ]);
for (my $x = $bb->x_min; $x <= $bb->x_max-$pillar_size; $x += $pillar_spacing) {

View File

@ -6,6 +6,7 @@ namespace Slic3r {
template <class PointClass>
BoundingBoxBase<PointClass>::BoundingBoxBase(const std::vector<PointClass> &points)
{
if (points.empty()) CONFESS("Empty point set supplied to BoundingBoxBase constructor");
typename std::vector<PointClass>::const_iterator it = points.begin();
this->min.x = this->max.x = it->x;
this->min.y = this->max.y = it->y;
@ -22,6 +23,7 @@ template <class PointClass>
BoundingBox3Base<PointClass>::BoundingBox3Base(const std::vector<PointClass> &points)
: BoundingBoxBase<PointClass>(points)
{
if (points.empty()) CONFESS("Empty point set supplied to BoundingBox3Base constructor");
typename std::vector<PointClass>::const_iterator it = points.begin();
this->min.z = this->max.z = it->z;
for (++it; it != points.end(); ++it) {