mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-30 21:42:02 -06:00
Fix of [2.3.0-alpha4] Crash - several models cause crash when slicing #5208
Fixed some issues in internal anchors of the Adaptive Cubic infill. The ugly and dangerous implicit casting operators in Line, MultiPoint, Polyline and Polygon were made explicit.
This commit is contained in:
parent
10c41290fd
commit
62bdc192d8
25 changed files with 237 additions and 110 deletions
|
@ -350,23 +350,10 @@ void ExPolygon::get_trapezoids2(Polygons* polygons) const
|
|||
// find trapezoids by looping from first to next-to-last coordinate
|
||||
for (std::vector<coord_t>::const_iterator x = xx.begin(); x != xx.end()-1; ++x) {
|
||||
coord_t next_x = *(x + 1);
|
||||
if (*x == next_x) continue;
|
||||
|
||||
// build rectangle
|
||||
Polygon poly;
|
||||
poly.points.resize(4);
|
||||
poly[0](0) = *x;
|
||||
poly[0](1) = bb.min(1);
|
||||
poly[1](0) = next_x;
|
||||
poly[1](1) = bb.min(1);
|
||||
poly[2](0) = next_x;
|
||||
poly[2](1) = bb.max(1);
|
||||
poly[3](0) = *x;
|
||||
poly[3](1) = bb.max(1);
|
||||
|
||||
// intersect with this expolygon
|
||||
// append results to return value
|
||||
polygons_append(*polygons, intersection(poly, to_polygons(*this)));
|
||||
if (*x != next_x)
|
||||
// intersect with rectangle
|
||||
// append results to return value
|
||||
polygons_append(*polygons, intersection({ { { *x, bb.min.y() }, { next_x, bb.min.y() }, { next_x, bb.max.y() }, { *x, bb.max.y() } } }, to_polygons(*this)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue