Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::Arachne::RedistributeBeadingStrategy Class Reference

#include <src/libslic3r/Arachne/BeadingStrategy/RedistributeBeadingStrategy.hpp>

+ Inheritance diagram for Slic3r::Arachne::RedistributeBeadingStrategy:
+ Collaboration diagram for Slic3r::Arachne::RedistributeBeadingStrategy:

Public Member Functions

 RedistributeBeadingStrategy (coord_t optimal_width_outer, double minimum_variable_line_ratio, BeadingStrategyPtr parent)
 
 ~RedistributeBeadingStrategy () override=default
 
Beading compute (coord_t thickness, coord_t bead_count) const override
 
coord_t getOptimalThickness (coord_t bead_count) const override
 
coord_t getTransitionThickness (coord_t lower_bead_count) const override
 
coord_t getOptimalBeadCount (coord_t thickness) const override
 
coord_t getTransitioningLength (coord_t lower_bead_count) const override
 
float getTransitionAnchorPos (coord_t lower_bead_count) const override
 
std::string toString () const override
 
virtual std::vector< coord_tgetNonlinearThicknesses (coord_t lower_bead_count) const
 
double getSplitMiddleThreshold () const
 
double getTransitioningAngle () const
 

Protected Attributes

BeadingStrategyPtr parent
 
coord_t optimal_width_outer
 
double minimum_variable_line_ratio
 
std::string name
 
coord_t optimal_width
 
double wall_split_middle_threshold
 Optimal bead width, nominal width off the walls in 'ideal' circumstances.
 
double wall_add_middle_threshold
 Threshold when a middle wall should be split into two, as a ratio of the optimal wall width.
 
coord_t default_transition_length
 Threshold when a new middle wall should be added between an even number of walls, as a ratio of the optimal wall width.
 
double transitioning_angle
 The length of the region to smoothly transfer between bead counts.
 

Detailed Description

A meta-beading-strategy that takes outer and inner wall widths into account.

The outer wall will try to keep a constant width by only applying the beading strategy on the inner walls. This ensures that this outer wall doesn't react to changes happening to inner walls. It will limit print artifacts on the surface of the print. Although this strategy technically deviates from the original philosophy of the paper. It will generally results in better prints because of a smoother motion and less variation in extrusion width in the outer walls.

If the thickness of the model is less then two times the optimal outer wall width and once the minimum inner wall width it will keep the minimum inner wall at a minimum constant and vary the outer wall widths symmetrical. Until The thickness of the model is that of at least twice the optimal outer wall width it will then use two symmetrical outer walls only. Until it transitions into a single outer wall. These last scenario's are always symmetrical in nature, disregarding the user specified strategy.

Constructor & Destructor Documentation

◆ RedistributeBeadingStrategy()

Slic3r::Arachne::RedistributeBeadingStrategy::RedistributeBeadingStrategy ( coord_t  optimal_width_outer,
double  minimum_variable_line_ratio,
BeadingStrategyPtr  parent 
)

/param optimal_width_outer Outer wall width, guaranteed to be the actual (save rounding errors) at a bead count if the parent strategies' optimum bead width is a weighted average of the outer and inner walls at that bead count. /param minimum_variable_line_ratio Minimum factor that the variable line might deviate from the optimal width.

16 , parent(std::move(parent))
19{
20 name = "RedistributeBeadingStrategy";
21}
std::string name
Definition BeadingStrategy.hpp:97
BeadingStrategy(coord_t optimal_width, double wall_split_middle_threshold, double wall_add_middle_threshold, coord_t default_transition_length, float transitioning_angle=pi_div(3))
Definition BeadingStrategy.cpp:12
coord_t optimal_width_outer
Definition RedistributeBeadingStrategy.hpp:51
BeadingStrategyPtr parent
Definition RedistributeBeadingStrategy.hpp:50
double minimum_variable_line_ratio
Definition RedistributeBeadingStrategy.hpp:52

References Slic3r::Arachne::BeadingStrategy::name.

◆ ~RedistributeBeadingStrategy()

Slic3r::Arachne::RedistributeBeadingStrategy::~RedistributeBeadingStrategy ( )
overridedefault

Member Function Documentation

◆ compute()

BeadingStrategy::Beading Slic3r::Arachne::RedistributeBeadingStrategy::compute ( coord_t  thickness,
coord_t  bead_count 
) const
overridevirtual

Retrieve the bead widths with which to cover a given thickness.

Requirement: Given a constant bead_count the output of each bead width must change gradually along with the thickness.

Note
The bead_count might be different from the BeadingStrategy::optimal_bead_count

Implements Slic3r::Arachne::BeadingStrategy.

64{
65 Beading ret;
66
67 // Take care of all situations in which no lines are actually produced:
68 if (bead_count == 0 || thickness < minimum_variable_line_ratio * optimal_width_outer) {
69 ret.left_over = thickness;
70 ret.total_thickness = thickness;
71 return ret;
72 }
73
74 // Compute the beadings of the inner walls, if any:
75 const coord_t inner_bead_count = bead_count - 2;
76 const coord_t inner_thickness = thickness - 2 * optimal_width_outer;
77 if (inner_bead_count > 0 && inner_thickness > 0) {
78 ret = parent->compute(inner_thickness, inner_bead_count);
79 for (auto &toolpath_location : ret.toolpath_locations) toolpath_location += optimal_width_outer;
80 }
81
82 // Insert the outer wall(s) around the previously computed inner wall(s), which may be empty:
83 const coord_t actual_outer_thickness = bead_count > 2 ? std::min(thickness / 2, optimal_width_outer) : thickness / bead_count;
84 ret.bead_widths.insert(ret.bead_widths.begin(), actual_outer_thickness);
85 ret.toolpath_locations.insert(ret.toolpath_locations.begin(), actual_outer_thickness / 2);
86 if (bead_count > 1) {
87 ret.bead_widths.push_back(actual_outer_thickness);
88 ret.toolpath_locations.push_back(thickness - actual_outer_thickness / 2);
89 }
90
91 // Ensure correct total and left over thickness.
92 ret.total_thickness = thickness;
93 ret.left_over = thickness - std::accumulate(ret.bead_widths.cbegin(), ret.bead_widths.cend(), static_cast<coord_t>(0));
94 return ret;
95}
int32_t coord_t
Definition libslic3r.h:39

References Slic3r::Arachne::BeadingStrategy::Beading::bead_widths, Slic3r::Arachne::BeadingStrategy::Beading::left_over, minimum_variable_line_ratio, optimal_width_outer, parent, Slic3r::Arachne::BeadingStrategy::Beading::toolpath_locations, and Slic3r::Arachne::BeadingStrategy::Beading::total_thickness.

◆ getNonlinearThicknesses()

std::vector< coord_t > Slic3r::Arachne::BeadingStrategy::getNonlinearThicknesses ( coord_t  lower_bead_count) const
virtualinherited

Get the locations in a bead count region where BeadingStrategy::compute exhibits a bend in the widths. Ordered from lower thickness to higher.

This is used to insert extra support bones into the skeleton, so that the resulting beads in long trapezoids don't linearly change between the two ends.

Reimplemented in Slic3r::Arachne::WideningBeadingStrategy.

47{
48 return {};
49}

Referenced by Slic3r::Arachne::SkeletalTrapezoidation::generateExtraRibs().

+ Here is the caller graph for this function:

◆ getOptimalBeadCount()

coord_t Slic3r::Arachne::RedistributeBeadingStrategy::getOptimalBeadCount ( coord_t  thickness) const
overridevirtual

The number of beads should we ideally usefor a given model thickness

Implements Slic3r::Arachne::BeadingStrategy.

40{
42 return 0;
43 if (thickness <= 2 * optimal_width_outer)
44 return thickness > (1.0 + parent->getSplitMiddleThreshold()) * optimal_width_outer ? 2 : 1;
45 return parent->getOptimalBeadCount(thickness - 2 * optimal_width_outer) + 2;
46}

References minimum_variable_line_ratio, optimal_width_outer, and parent.

◆ getOptimalThickness()

coord_t Slic3r::Arachne::RedistributeBeadingStrategy::getOptimalThickness ( coord_t  bead_count) const
overridevirtual

The ideal thickness for a given

Parameters
bead_count

Reimplemented from Slic3r::Arachne::BeadingStrategy.

24{
25 const coord_t inner_bead_count = std::max(static_cast<coord_t>(0), bead_count - 2);
26 const coord_t outer_bead_count = bead_count - inner_bead_count;
27 return parent->getOptimalThickness(inner_bead_count) + optimal_width_outer * outer_bead_count;
28}

References optimal_width_outer, and parent.

◆ getSplitMiddleThreshold()

double Slic3r::Arachne::BeadingStrategy::getSplitMiddleThreshold ( ) const
inherited
57{
59}
double wall_split_middle_threshold
Optimal bead width, nominal width off the walls in 'ideal' circumstances.
Definition BeadingStrategy.hpp:101

References Slic3r::Arachne::BeadingStrategy::wall_split_middle_threshold.

◆ getTransitionAnchorPos()

float Slic3r::Arachne::RedistributeBeadingStrategy::getTransitionAnchorPos ( coord_t  lower_bead_count) const
overridevirtual

The fraction of the transition length to put between the lower end of the transition and the point where the unsmoothed bead count jumps.

Transitions are used to smooth out the jumps in integer bead count; the jumps turn into ramps which could be positioned relative to the jump location.

Reimplemented from Slic3r::Arachne::BeadingStrategy.

54{
55 return parent->getTransitionAnchorPos(lower_bead_count);
56}

References parent.

◆ getTransitioningAngle()

double Slic3r::Arachne::BeadingStrategy::getTransitioningAngle ( ) const
inherited
62{
64}
double transitioning_angle
The length of the region to smoothly transfer between bead counts.
Definition BeadingStrategy.hpp:111

References Slic3r::Arachne::BeadingStrategy::transitioning_angle.

Referenced by Slic3r::Arachne::SkeletalTrapezoidation::updateIsCentral().

+ Here is the caller graph for this function:

◆ getTransitioningLength()

coord_t Slic3r::Arachne::RedistributeBeadingStrategy::getTransitioningLength ( coord_t  lower_bead_count) const
overridevirtual

The length of the transitioning region along the marked / significant regions of the skeleton.

Transitions are used to smooth out the jumps in integer bead count; the jumps turn into ramps with some incline defined by their length.

Reimplemented from Slic3r::Arachne::BeadingStrategy.

49{
50 return parent->getTransitioningLength(lower_bead_count);
51}

References parent.

◆ getTransitionThickness()

coord_t Slic3r::Arachne::RedistributeBeadingStrategy::getTransitionThickness ( coord_t  lower_bead_count) const
overridevirtual

The model thickness at which BeadingStrategy::optimal_bead_count transitions from lower_bead_count to lower_bead_count + 1

Reimplemented from Slic3r::Arachne::BeadingStrategy.

31{
32 switch (lower_bead_count) {
34 case 1: return (1.0 + parent->getSplitMiddleThreshold()) * optimal_width_outer;
35 default: return parent->getTransitionThickness(lower_bead_count - 2) + 2 * optimal_width_outer;
36 }
37}

References minimum_variable_line_ratio, optimal_width_outer, and parent.

◆ toString()

std::string Slic3r::Arachne::RedistributeBeadingStrategy::toString ( ) const
overridevirtual

Reimplemented from Slic3r::Arachne::BeadingStrategy.

59{
60 return std::string("RedistributeBeadingStrategy+") + parent->toString();
61}

References parent.

Member Data Documentation

◆ default_transition_length

coord_t Slic3r::Arachne::BeadingStrategy::default_transition_length
protectedinherited

Threshold when a new middle wall should be added between an even number of walls, as a ratio of the optimal wall width.

Referenced by Slic3r::Arachne::BeadingStrategy::getTransitioningLength().

◆ minimum_variable_line_ratio

double Slic3r::Arachne::RedistributeBeadingStrategy::minimum_variable_line_ratio
protected

◆ name

◆ optimal_width

◆ optimal_width_outer

coord_t Slic3r::Arachne::RedistributeBeadingStrategy::optimal_width_outer
protected

◆ parent

◆ transitioning_angle

double Slic3r::Arachne::BeadingStrategy::transitioning_angle
protectedinherited

The length of the region to smoothly transfer between bead counts.

The maximum angle between outline segments smaller than which we are going to add transitions Equals 180 - the "limit bisector angle" from the paper

Referenced by Slic3r::Arachne::BeadingStrategy::getTransitioningAngle().

◆ wall_add_middle_threshold

double Slic3r::Arachne::BeadingStrategy::wall_add_middle_threshold
protectedinherited

Threshold when a middle wall should be split into two, as a ratio of the optimal wall width.

Referenced by Slic3r::Arachne::DistributedBeadingStrategy::getOptimalBeadCount(), and Slic3r::Arachne::BeadingStrategy::getTransitionThickness().

◆ wall_split_middle_threshold

double Slic3r::Arachne::BeadingStrategy::wall_split_middle_threshold
protectedinherited

The documentation for this class was generated from the following files: