Fixed crash in MeshClipper::recalculate_triangles()

This commit is contained in:
enricoturri1966 2022-10-20 15:46:07 +02:00
parent f57744ad12
commit 43cc8f8cbf

View File

@ -182,7 +182,7 @@ void MeshClipper::recalculate_triangles()
// it so it lies on our line. This will be the figure to subtract // it so it lies on our line. This will be the figure to subtract
// from the cut. The coordinates must not overflow after the transform, // from the cut. The coordinates must not overflow after the transform,
// make the rectangle a bit smaller. // make the rectangle a bit smaller.
const coord_t size = (std::numeric_limits<coord_t>::max() - scale_(std::max(std::abs(e*a), std::abs(e*b)))) / 4; const coord_t size = (std::numeric_limits<coord_t>::max()/2 - scale_(std::max(std::abs(e * a), std::abs(e * b)))) / 4;
Polygons ep {Polygon({Point(-size, 0), Point(size, 0), Point(size, 2*size), Point(-size, 2*size)})}; Polygons ep {Polygon({Point(-size, 0), Point(size, 0), Point(size, 2*size), Point(-size, 2*size)})};
ep.front().rotate(angle); ep.front().rotate(angle);
ep.front().translate(scale_(-e * a), scale_(-e * b)); ep.front().translate(scale_(-e * a), scale_(-e * b));