2016-12-08 18:02:16 +00:00
|
|
|
// Based on implementation by @platsch
|
|
|
|
|
|
|
|
#ifndef slic3r_SlicingAdaptive_hpp_
|
|
|
|
#define slic3r_SlicingAdaptive_hpp_
|
|
|
|
|
|
|
|
#include "Slicing.hpp"
|
|
|
|
#include "admesh/stl.h"
|
2019-11-13 12:53:02 +00:00
|
|
|
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
#include "TriangleMesh.hpp"
|
|
|
|
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
2016-12-08 18:02:16 +00:00
|
|
|
|
|
|
|
namespace Slic3r
|
|
|
|
{
|
|
|
|
|
2019-11-13 12:53:02 +00:00
|
|
|
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
class ModelVolume;
|
|
|
|
#else
|
2016-12-08 18:02:16 +00:00
|
|
|
class TriangleMesh;
|
2019-11-13 12:53:02 +00:00
|
|
|
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
2016-12-08 18:02:16 +00:00
|
|
|
|
|
|
|
class SlicingAdaptive
|
|
|
|
{
|
|
|
|
public:
|
2019-11-13 12:53:02 +00:00
|
|
|
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
void clear();
|
|
|
|
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
void set_slicing_parameters(SlicingParameters params) { m_slicing_params = params; }
|
|
|
|
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
void set_object(const ModelObject& object) { m_object = &object; }
|
|
|
|
#else
|
|
|
|
void add_mesh(const TriangleMesh* mesh) { m_meshes.push_back(mesh); }
|
|
|
|
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
void prepare();
|
2016-12-08 18:02:16 +00:00
|
|
|
float cusp_height(float z, float cusp_value, int ¤t_facet);
|
|
|
|
float horizontal_facet_distance(float z);
|
|
|
|
|
|
|
|
protected:
|
2016-12-12 16:53:38 +00:00
|
|
|
SlicingParameters m_slicing_params;
|
2016-12-08 18:02:16 +00:00
|
|
|
|
2019-11-13 12:53:02 +00:00
|
|
|
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
const ModelObject* m_object;
|
|
|
|
TriangleMesh m_mesh;
|
|
|
|
#else
|
|
|
|
std::vector<const TriangleMesh*> m_meshes;
|
|
|
|
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
|
|
// Collected faces of all meshes, sorted by raising Z of the bottom most face.
|
2016-12-08 18:02:16 +00:00
|
|
|
std::vector<const stl_facet*> m_faces;
|
2019-11-13 12:53:02 +00:00
|
|
|
// Z component of face normals, normalized.
|
2016-12-08 18:02:16 +00:00
|
|
|
std::vector<float> m_face_normal_z;
|
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace Slic3r
|
|
|
|
|
|
|
|
#endif /* slic3r_SlicingAdaptive_hpp_ */
|