From 452473c3701b9843611968f711cd9b1f22c4767f Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Thu, 12 Sep 2024 12:37:08 +0200 Subject: [PATCH] correction key to grid around zero --- src/libslic3r/SLA/SupportPointGenerator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/SLA/SupportPointGenerator.cpp b/src/libslic3r/SLA/SupportPointGenerator.cpp index 4f70ebedb1..12b819dd9a 100644 --- a/src/libslic3r/SLA/SupportPointGenerator.cpp +++ b/src/libslic3r/SLA/SupportPointGenerator.cpp @@ -39,7 +39,12 @@ public: : m_cell_size(cell_size), m_cell_size_half(cell_size / 2) {} Key cell_id(const Point &point) const { - return Key(point.x() / m_cell_size, point.y() / m_cell_size); + Key::coord_type x = point.x() / m_cell_size; + Key::coord_type y = point.y() / m_cell_size; + // correction around zero => -1 / 5 = 0 + if (point.x() < 0) --x; + if (point.y() < 0) --y; + return Key{x, y}; } void add(LayerSupportPoint &&point) {