Fixed regression causing random failures in bridge direction detection. #2636
This commit is contained in:
parent
bb3feedc31
commit
1ab8efba7f
3 changed files with 15 additions and 8 deletions
|
@ -37,14 +37,10 @@ BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonColle
|
||||||
Polygons grown;
|
Polygons grown;
|
||||||
offset((Polygons)this->expolygon, &grown, this->extrusion_width);
|
offset((Polygons)this->expolygon, &grown, this->extrusion_width);
|
||||||
|
|
||||||
// detect what edges lie on lower slices
|
// detect what edges lie on lower slices by turning bridge contour and holes
|
||||||
for (ExPolygons::const_iterator lower = this->lower_slices.expolygons.begin();
|
// into polylines and then clipping them with each lower slice's contour
|
||||||
lower != this->lower_slices.expolygons.end();
|
intersection(grown, this->lower_slices.contours(), &this->_edges);
|
||||||
++lower) {
|
|
||||||
/* turn bridge contour and holes into polylines and then clip them
|
|
||||||
with each lower slice's contour */
|
|
||||||
intersection(grown, lower->contour, &this->_edges);
|
|
||||||
}
|
|
||||||
#ifdef SLIC3R_DEBUG
|
#ifdef SLIC3R_DEBUG
|
||||||
printf(" bridge has %zu support(s)\n", this->_edges.size());
|
printf(" bridge has %zu support(s)\n", this->_edges.size());
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -112,6 +112,16 @@ ExPolygonCollection::lines() const
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Polygons
|
||||||
|
ExPolygonCollection::contours() const
|
||||||
|
{
|
||||||
|
Polygons contours;
|
||||||
|
for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it) {
|
||||||
|
contours.push_back(it->contour);
|
||||||
|
}
|
||||||
|
return contours;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
#ifdef SLIC3RXS
|
||||||
REGISTER_CLASS(ExPolygonCollection, "ExPolygon::Collection");
|
REGISTER_CLASS(ExPolygonCollection, "ExPolygon::Collection");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,7 @@ class ExPolygonCollection
|
||||||
void simplify(double tolerance);
|
void simplify(double tolerance);
|
||||||
Polygon convex_hull() const;
|
Polygon convex_hull() const;
|
||||||
Lines lines() const;
|
Lines lines() const;
|
||||||
|
Polygons contours() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue