Files
OrcaSlicer-bambulab/src/libslic3r/Fill/FillAdaptive.hpp
T

78 lines
2.7 KiB
C++
Raw Normal View History

// Adaptive cubic infill was inspired by the work of @mboerwinkle
// as implemented for Cura.
// https://github.com/Ultimaker/CuraEngine/issues/381
// https://github.com/Ultimaker/CuraEngine/pull/401
//
// Our implementation is more accurate (discretizes a bit less cubes than Cura's)
// by splitting only such cubes which contain a triangle.
// Our line extraction is time optimal instead of O(n^2) when connecting extracted lines,
// and we also implemented adaptivity for supporting internal overhangs only.
2020-08-26 16:51:34 +02:00
#ifndef slic3r_FillAdaptive_hpp_
#define slic3r_FillAdaptive_hpp_
2020-08-26 18:15:59 +02:00
#include "../AABBTreeIndirect.hpp"
2020-08-26 16:51:34 +02:00
#include "FillBase.hpp"
struct indexed_triangle_set;
2020-08-26 16:51:34 +02:00
namespace Slic3r {
2020-09-09 15:55:06 +02:00
class PrintObject;
2020-08-26 16:51:34 +02:00
namespace FillAdaptive_Internal
{
struct Octree;
// To keep the definition of Octree opaque, we have to define a custom deleter.
struct OctreeDeleter {
void operator()(Octree *p);
2020-08-26 16:51:34 +02:00
};
using OctreePtr = std::unique_ptr<Octree, OctreeDeleter>;
2020-08-26 16:51:34 +02:00
// Calculate line spacing for
// 1) adaptive cubic infill
// 2) adaptive internal support cubic infill
// Returns zero for a particular infill type if no such infill is to be generated.
std::pair<double, double> adaptive_fill_line_spacing(const PrintObject &print_object);
2020-08-26 16:51:34 +02:00
// Rotation of the octree to stand on one of its corners.
Eigen::Quaterniond adaptive_fill_octree_transform_to_world();
// Inverse roation of the above.
Eigen::Quaterniond adaptive_fill_octree_transform_to_octree();
2020-09-03 11:56:41 +02:00
FillAdaptive_Internal::OctreePtr build_octree(
// Mesh is rotated to the coordinate system of the octree.
const indexed_triangle_set &triangle_mesh,
// Up vector of the mesh rotated to the coordinate system of the octree.
const Vec3d &up_vector,
coordf_t line_spacing,
// If true, octree is densified below internal overhangs only.
bool support_overhangs_only);
2020-08-26 16:51:34 +02:00
}; // namespace FillAdaptive_Internal
2020-08-26 22:18:51 +02:00
//
// Some of the algorithms used by class FillAdaptive were inspired by
// Cura Engine's class SubDivCube
// https://github.com/Ultimaker/CuraEngine/blob/master/src/infill/SubDivCube.h
//
2020-08-26 16:51:34 +02:00
class FillAdaptive : public Fill
{
public:
virtual ~FillAdaptive() {}
protected:
virtual Fill* clone() const { return new FillAdaptive(*this); };
virtual void _fill_surface_single(
2020-09-03 19:21:55 +02:00
const FillParams &params,
2020-08-26 16:51:34 +02:00
unsigned int thickness_layers,
2020-09-03 19:21:55 +02:00
const std::pair<float, Point> &direction,
ExPolygon &expolygon,
2020-08-26 16:51:34 +02:00
Polylines &polylines_out);
virtual bool no_sort() const { return true; }
};
2020-09-09 09:29:50 +02:00
2020-08-26 16:51:34 +02:00
} // namespace Slic3r
#endif // slic3r_FillAdaptive_hpp_