SLA autosupports including islands

This commit is contained in:
Lukas Matena 2018-12-21 12:35:20 +01:00
parent 2ba28325f0
commit 7617b10d6e
6 changed files with 209 additions and 116 deletions

View file

@ -3,16 +3,12 @@
#include <libslic3r/Point.hpp>
#include <libslic3r/TriangleMesh.hpp>
#include <libslic3r/SLA/SLASupportTree.hpp>
namespace Slic3r {
class ModelObject;
namespace SLAAutoSupports {
class SLAAutoSupports {
public:
struct Config {
@ -21,24 +17,30 @@ public:
float minimal_z;
};
SLAAutoSupports(ModelObject& mo, const SLAAutoSupports::Config& c);
void generate();
SLAAutoSupports(const TriangleMesh& mesh, const sla::EigenMesh3D& emesh, const std::vector<ExPolygons>& slices, const std::vector<float>& heights, const Config& config);
const std::vector<Vec3d>& output() { return m_output; }
private:
std::vector<Vec3d> m_output;
std::vector<Vec3d> m_normals;
TriangleMesh mesh;
static float angle_from_normal(const stl_normal& normal) { return acos((-normal.normalized())(2)); }
float get_required_density(float angle) const;
static float approximate_geodesic_distance(const Vec3f& p1, const Vec3f& p2, Vec3f& n1, Vec3f& n2);
float distance_limit(float angle) const;
static float approximate_geodesic_distance(const Vec3d& p1, const Vec3d& p2, Vec3d& n1, Vec3d& n2);
std::vector<std::pair<ExPolygon, coord_t>> find_islands(const std::vector<ExPolygons>& slices, const std::vector<float>& heights) const;
void sprinkle_mesh(const TriangleMesh& mesh);
std::vector<Vec3d> uniformly_cover(const std::pair<ExPolygon, coord_t>& island);
void project_upward_onto_mesh(std::vector<Vec3d>& points) const;
void output_expolygons(const ExPolygons& expolys, std::string filename) const;
ModelObject& m_model_object;
SLAAutoSupports::Config m_config;
const Eigen::MatrixXd& m_V;
const Eigen::MatrixXi& m_F;
};
std::vector<Vec3d> find_islands(const std::vector<ExPolygons>& slices, const std::vector<float>& heights);
} // namespace SLAAutoSupports
} // namespace Slic3r