From 44e47026f8c5376912248c6845aa9cffcc20aa76 Mon Sep 17 00:00:00 2001 From: "LAPTOP-R2AR8CRT\\filip" Date: Tue, 2 Feb 2021 16:45:02 +0100 Subject: [PATCH] [partialy] Support for islands --- src/libslic3r/SLA/SupportPointGenerator.cpp | 26 ++++++++++++++++++++- src/libslic3r/SLA/SupportPointGenerator.hpp | 8 ++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/SLA/SupportPointGenerator.cpp b/src/libslic3r/SLA/SupportPointGenerator.cpp index 37e6af882b..37733e00d1 100644 --- a/src/libslic3r/SLA/SupportPointGenerator.cpp +++ b/src/libslic3r/SLA/SupportPointGenerator.cpp @@ -312,6 +312,30 @@ void SupportPointGenerator::process(const std::vector& slices, const } } +std::vector SupportPointGenerator::uniform_cover_island( + SupportPointGenerator::Structure &structure) +{ + // X is maximal distance between 2 support points on island + float x = 10; + float one_support_area = M_PI * x; + const ExPolygon &island = *structure.polygon; + float area = structure.area; + const Point & bb_size = structure.bbox.size(); + + // only one support point? + if (area < one_support_area && + bb_size[0] < x && + bb_size[1] < x ) { + structure.centroid + } + + // longest distance in area + float size = getSize() + // calculate island moments + + // unit support force 11.1f / density_relative(1.) +} + void SupportPointGenerator::add_support_points(SupportPointGenerator::Structure &s, SupportPointGenerator::PointGrid3D &grid3d) { // Select each type of surface (overrhang, dangling, slope), derive the support @@ -324,6 +348,7 @@ void SupportPointGenerator::add_support_points(SupportPointGenerator::Structure // completely new island - needs support no doubt // deficit is full, there is nothing below that would hold this island uniformly_cover({ *s.polygon }, s, s.area * tp, grid3d, IslandCoverageFlags(icfIsNew | icfWithBoundary) ); + grid3d.insert(uniform_cover_island(s), s); return; } @@ -559,7 +584,6 @@ static inline std::vector poisson_disk_from_samples(const std::vector &pos, Structure *island) + { + for (const auto &p : pos) insert(p, island); + } + bool collides_with(const Vec2f &pos, float print_z, float radius) { Vec3f pos3d(pos.x(), pos.y(), print_z); Vec3i cell = cell_id(pos3d); @@ -204,8 +209,9 @@ private: public: enum IslandCoverageFlags : uint8_t { icfNone = 0x0, icfIsNew = 0x1, icfWithBoundary = 0x2 }; +public: // for testing + std::vector uniform_cover_island(SupportPointGenerator::Structure &structure); private: - void uniformly_cover(const ExPolygons& islands, Structure& structure, float deficit, PointGrid3D &grid3d, IslandCoverageFlags flags = icfNone); void add_support_points(Structure& structure, PointGrid3D &grid3d);