mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 18:58:00 -06:00
Improved adaptive layer height metrics: Using the area of a triangle
delimited by the extrusion stepping and the sloping surface. This leads to a yet different metric from Cura or upstream Slic3r.
This commit is contained in:
parent
792ee1be62
commit
65772958b7
6 changed files with 218 additions and 221 deletions
|
@ -5,50 +5,36 @@
|
|||
|
||||
#include "Slicing.hpp"
|
||||
#include "admesh/stl.h"
|
||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
||||
#include "TriangleMesh.hpp"
|
||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
||||
class ModelVolume;
|
||||
#else
|
||||
class TriangleMesh;
|
||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
||||
|
||||
class SlicingAdaptive
|
||||
{
|
||||
public:
|
||||
#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();
|
||||
float cusp_height(float z, float cusp_value, int ¤t_facet);
|
||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
||||
void clear();
|
||||
void set_slicing_parameters(SlicingParameters params) { m_slicing_params = params; }
|
||||
void prepare(const ModelObject &object);
|
||||
// Return next layer height starting from the last print_z, using a quality measure
|
||||
// (quality in range from 0 to 1, 0 - highest quality at low layer heights, 1 - lowest print quality at high layer heights).
|
||||
// The layer height curve shall be centered roughly around the default profile's layer height for quality 0.5.
|
||||
float next_layer_height(const float print_z, float quality, size_t ¤t_facet);
|
||||
float horizontal_facet_distance(float z);
|
||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
||||
|
||||
struct FaceZ {
|
||||
std::pair<float, float> z_span;
|
||||
// Cosine of the normal vector towards the Z axis.
|
||||
float n_cos;
|
||||
// Sine of the normal vector towards the Z axis.
|
||||
float n_sin;
|
||||
};
|
||||
|
||||
protected:
|
||||
SlicingParameters m_slicing_params;
|
||||
SlicingParameters m_slicing_params;
|
||||
|
||||
#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.
|
||||
std::vector<const stl_facet*> m_faces;
|
||||
// Z component of face normals, normalized.
|
||||
std::vector<float> m_face_normal_z;
|
||||
std::vector<FaceZ> m_faces;
|
||||
};
|
||||
|
||||
}; // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue