Preparation for new infill

This commit is contained in:
Lukáš Hejl 2020-08-26 16:51:34 +02:00
parent add3894e8c
commit 42a7f2b1d8
9 changed files with 95 additions and 1 deletions

View file

@ -345,6 +345,7 @@ void Layer::make_fills()
f->layer_id = this->id();
f->z = this->print_z;
f->angle = surface_fill.params.angle;
f->adapt_fill_octree = this->object()->adaptiveInfillOctree();
// calculate flow spacing for infill pattern generation
bool using_internal_flow = ! surface_fill.surface.is_solid() && ! surface_fill.params.flow.bridge;

View file

@ -0,0 +1,19 @@
#include "../ClipperUtils.hpp"
#include "../ExPolygon.hpp"
#include "../Surface.hpp"
#include "FillAdaptive.hpp"
namespace Slic3r {
void FillAdaptive::_fill_surface_single(
const FillParams &params,
unsigned int thickness_layers,
const std::pair<float, Point> &direction,
ExPolygon &expolygon,
Polylines &polylines_out)
{
}
} // namespace Slic3r

View file

@ -0,0 +1,53 @@
#ifndef slic3r_FillAdaptive_hpp_
#define slic3r_FillAdaptive_hpp_
#include "FillBase.hpp"
namespace Slic3r {
namespace FillAdaptive_Internal
{
struct CubeProperties
{
double edge_length; // Lenght of edge of a cube
double height; // Height of rotated cube (standing on the corner)
double diagonal_length; // Length of diagonal of a cube a face
double line_z_distance; // Defines maximal distance from a center of a cube on Z axis on which lines will be created
double line_xy_distance;// Defines maximal distance from a center of a cube on X and Y axis on which lines will be created
};
struct Cube
{
Vec3d center;
size_t depth;
CubeProperties properties;
std::vector<Cube*> children;
};
struct Octree
{
Cube *root_cube;
Vec3d origin;
};
}; // namespace FillAdaptive_Internal
class FillAdaptive : public Fill
{
public:
virtual ~FillAdaptive() {}
protected:
virtual Fill* clone() const { return new FillAdaptive(*this); };
virtual void _fill_surface_single(
const FillParams &params,
unsigned int thickness_layers,
const std::pair<float, Point> &direction,
ExPolygon &expolygon,
Polylines &polylines_out);
virtual bool no_sort() const { return true; }
};
} // namespace Slic3r
#endif // slic3r_FillAdaptive_hpp_

View file

@ -16,6 +16,7 @@
#include "FillRectilinear.hpp"
#include "FillRectilinear2.hpp"
#include "FillRectilinear3.hpp"
#include "FillAdaptive.hpp"
namespace Slic3r {
@ -37,6 +38,7 @@ Fill* Fill::new_from_type(const InfillPattern type)
case ipArchimedeanChords: return new FillArchimedeanChords();
case ipHilbertCurve: return new FillHilbertCurve();
case ipOctagramSpiral: return new FillOctagramSpiral();
case ipAdaptiveCubic: return new FillAdaptive();
default: throw std::invalid_argument("unknown type");
}
}

View file

@ -19,6 +19,10 @@ class ExPolygon;
class Surface;
enum InfillPattern : int;
namespace FillAdaptive_Internal {
struct Octree;
};
class InfillFailedException : public std::runtime_error {
public:
InfillFailedException() : std::runtime_error("Infill failed") {}
@ -69,6 +73,8 @@ public:
// In scaled coordinates. Bounding box of the 2D projection of the object.
BoundingBox bounding_box;
FillAdaptive_Internal::Octree* adapt_fill_octree = nullptr;
public:
virtual ~Fill() {}