mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
New sparse infill: "stars" - David's star shaped infill.
This is very similar to a "triangles" infill, but maximum two lines intersect at a single point. added utility function get_extents_vector()
This commit is contained in:
parent
eb0ab38618
commit
317e9131e8
10 changed files with 52 additions and 3 deletions
|
@ -25,6 +25,7 @@ Fill* Fill::new_from_type(const InfillPattern type)
|
|||
case ipLine: return new FillLine();
|
||||
case ipGrid: return new FillGrid2();
|
||||
case ipTriangles: return new FillTriangles();
|
||||
case ipStars: return new FillStars();
|
||||
case ipCubic: return new FillCubic();
|
||||
// case ipGrid: return new FillGrid();
|
||||
case ipArchimedeanChords: return new FillArchimedeanChords();
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
// in radians, ccw, 0 = East
|
||||
float angle;
|
||||
// In scaled coordinates. Maximum lenght of a perimeter segment connecting two infill lines.
|
||||
// Used by the FillRectilinear2, FillGrid2, FillTriangles and FillCubic.
|
||||
// Used by the FillRectilinear2, FillGrid2, FillTriangles, FillStars and FillCubic.
|
||||
// If left to zero, the links will not be limited.
|
||||
coord_t link_max_length;
|
||||
// In scaled coordinates. Used by the concentric infill pattern to clip the loops to create extrusion paths.
|
||||
|
|
|
@ -1517,12 +1517,26 @@ Polylines FillTriangles::fill_surface(const Surface *surface, const FillParams &
|
|||
Polylines polylines_out;
|
||||
if (! fill_surface_by_lines(surface, params2, 0.f, 0., polylines_out) ||
|
||||
! fill_surface_by_lines(surface, params2, float(M_PI / 3.), 0., polylines_out) ||
|
||||
! fill_surface_by_lines(surface, params2, float(2. * M_PI / 3.), 0., polylines_out)) {
|
||||
! fill_surface_by_lines(surface, params2, float(2. * M_PI / 3.), 0.5 * this->spacing / params2.density, polylines_out)) {
|
||||
printf("FillTriangles::fill_surface() failed to fill a region.\n");
|
||||
}
|
||||
return polylines_out;
|
||||
}
|
||||
|
||||
Polylines FillStars::fill_surface(const Surface *surface, const FillParams ¶ms)
|
||||
{
|
||||
// Each linear fill covers 1/3 of the target coverage.
|
||||
FillParams params2 = params;
|
||||
params2.density *= 0.333333333f;
|
||||
Polylines polylines_out;
|
||||
if (! fill_surface_by_lines(surface, params2, 0.f, 0., polylines_out) ||
|
||||
! fill_surface_by_lines(surface, params2, float(M_PI / 3.), 0., polylines_out) ||
|
||||
! fill_surface_by_lines(surface, params2, float(2. * M_PI / 3.), 0., polylines_out)) {
|
||||
printf("FillStars::fill_surface() failed to fill a region.\n");
|
||||
}
|
||||
return polylines_out;
|
||||
}
|
||||
|
||||
Polylines FillCubic::fill_surface(const Surface *surface, const FillParams ¶ms)
|
||||
{
|
||||
// Each linear fill covers 1/3 of the target coverage.
|
||||
|
|
|
@ -41,6 +41,17 @@ protected:
|
|||
virtual float _layer_angle(size_t idx) const { return 0.f; }
|
||||
};
|
||||
|
||||
class FillStars : public FillRectilinear2
|
||||
{
|
||||
public:
|
||||
virtual ~FillStars() {}
|
||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
||||
|
||||
protected:
|
||||
// The grid fill will keep the angle constant between the layers, see the implementation of Slic3r::Fill.
|
||||
virtual float _layer_angle(size_t idx) const { return 0.f; }
|
||||
};
|
||||
|
||||
class FillCubic : public FillRectilinear2
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue