#ifndef SLAAUTOSUPPORTS_HPP_ #define SLAAUTOSUPPORTS_HPP_ #include #include #include // #define SLA_AUTOSUPPORTS_DEBUG namespace Slic3r { class SLAAutoSupports { public: struct Config { float density_at_horizontal; float density_at_45; float minimal_z; /////////////// float support_force = 30; // a force one point can support (arbitrary force unit) float tear_pressure = 1; // pressure that the display exerts (the force unit per mm2) }; SLAAutoSupports(const TriangleMesh& mesh, const sla::EigenMesh3D& emesh, const std::vector& slices, const std::vector& heights, const Config& config, std::function throw_on_cancel); const std::vector& output() { return m_output; } private: std::vector m_output; #ifdef SLA_AUTOSUPPORTS_DEBUG void output_expolygons(const ExPolygons& expolys, std::string filename) const; void output_structures() const; #endif // SLA_AUTOSUPPORTS_DEBUG SLAAutoSupports::Config m_config; struct Structure { Structure(const ExPolygon& poly, float h) : height(h), unique_id(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch())) { polygon = &poly; } const ExPolygon* polygon = nullptr; std::vector structures_below; float height = 0; float supports_force = 0.f; std::chrono::milliseconds unique_id; }; std::vector m_structures_old; std::vector m_structures_new; float m_supports_force_total = 0.f; void process(const std::vector& slices, const std::vector& heights); void add_point(const Point& point, Structure& structure, bool island = false); void uniformly_cover(const ExPolygon& island, Structure& structure, bool is_new_island = false, bool just_one = false); void project_onto_mesh(std::vector& points) const; std::function m_throw_on_cancel; const sla::EigenMesh3D& m_emesh; }; } // namespace Slic3r #endif // SLAAUTOSUPPORTS_HPP_