Cut: fixed an issue when the view rotates to the other side of the plane

This commit is contained in:
Lukas Matena 2023-05-03 16:14:26 +02:00
parent 7b576d3312
commit 2aa55ef950
2 changed files with 6 additions and 7 deletions

View File

@ -392,12 +392,11 @@ void MeshClipper::recalculate_triangles()
} }
isl.expoly = std::move(exp); isl.expoly = std::move(exp);
isl.expoly_bb = get_extents(exp); isl.expoly_bb = get_extents(isl.expoly);
isl.hash = 0;
for (const Point& pt : isl.expoly.contour) { Point centroid_scaled = isl.expoly.contour.centroid();
isl.hash ^= pt.x(); Vec3d centroid_world = m_result->trafo * Vec3d(unscale(centroid_scaled).x(), unscale(centroid_scaled).y(), 0.);
isl.hash ^= pt.y(); isl.hash = isl.expoly.contour.size() + size_t(std::abs(100.*centroid_world.x())) + size_t(std::abs(100.*centroid_world.y())) + size_t(std::abs(100.*centroid_world.z()));
}
} }
// Now sort the islands so they are in defined order. This is a hack needed by cut gizmo, which sometimes // Now sort the islands so they are in defined order. This is a hack needed by cut gizmo, which sometimes

View File

@ -141,7 +141,7 @@ private:
ExPolygon expoly; ExPolygon expoly;
BoundingBox expoly_bb; BoundingBox expoly_bb;
bool disabled = false; bool disabled = false;
coord_t hash; size_t hash;
}; };
struct ClipResult { struct ClipResult {
std::vector<CutIsland> cut_islands; std::vector<CutIsland> cut_islands;