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

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

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

Public Member Functions

 WideningBeadingStrategy (BeadingStrategyPtr parent, coord_t min_input_width, coord_t min_output_width)
 
 ~WideningBeadingStrategy () 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::vector< coord_tgetNonlinearThicknesses (coord_t lower_bead_count) const override
 
std::string toString () const override
 
double getSplitMiddleThreshold () const
 
double getTransitioningAngle () const
 

Protected Attributes

BeadingStrategyPtr parent
 
const coord_t min_input_width
 
const coord_t min_output_width
 
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

This is a meta-strategy that can be applied on any other beading strategy. If the part is thinner than a single line, this strategy adjusts the part so that it becomes the minimum thickness of one line.

This way, tiny pieces that are smaller than a single line will still be printed.

Constructor & Destructor Documentation

◆ WideningBeadingStrategy()

Slic3r::Arachne::WideningBeadingStrategy::WideningBeadingStrategy ( BeadingStrategyPtr  parent,
coord_t  min_input_width,
coord_t  min_output_width 
)

Takes responsibility for deleting

Parameters
parent
11 , parent(std::move(parent))
14{
15}
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
BeadingStrategyPtr parent
Definition WideningBeadingStrategy.hpp:40
const coord_t min_input_width
Definition WideningBeadingStrategy.hpp:41
const coord_t min_output_width
Definition WideningBeadingStrategy.hpp:42

◆ ~WideningBeadingStrategy()

Slic3r::Arachne::WideningBeadingStrategy::~WideningBeadingStrategy ( )
overridedefault

Member Function Documentation

◆ compute()

WideningBeadingStrategy::Beading Slic3r::Arachne::WideningBeadingStrategy::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.

23{
24 if (thickness < optimal_width) {
25 Beading ret;
26 ret.total_thickness = thickness;
27 if (thickness >= min_input_width)
28 {
29 ret.bead_widths.emplace_back(std::max(thickness, min_output_width));
30 ret.toolpath_locations.emplace_back(thickness / 2);
31 } else {
32 ret.left_over = thickness;
33 }
34 return ret;
35 } else {
36 return parent->compute(thickness, bead_count);
37 }
38}
coord_t optimal_width
Definition BeadingStrategy.hpp:99

References Slic3r::Arachne::BeadingStrategy::Beading::bead_widths, Slic3r::Arachne::BeadingStrategy::Beading::left_over, min_input_width, min_output_width, Slic3r::Arachne::BeadingStrategy::optimal_width, parent, Slic3r::Arachne::BeadingStrategy::Beading::toolpath_locations, and Slic3r::Arachne::BeadingStrategy::Beading::total_thickness.

◆ getNonlinearThicknesses()

std::vector< coord_t > Slic3r::Arachne::WideningBeadingStrategy::getNonlinearThicknesses ( coord_t  lower_bead_count) const
overridevirtual

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 from Slic3r::Arachne::BeadingStrategy.

74{
75 std::vector<coord_t> ret;
76 ret.emplace_back(min_output_width);
77 std::vector<coord_t> pret = parent->getNonlinearThicknesses(lower_bead_count);
78 ret.insert(ret.end(), pret.begin(), pret.end());
79 return ret;
80}

References min_output_width, and parent.

◆ getOptimalBeadCount()

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

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

Implements Slic3r::Arachne::BeadingStrategy.

54{
55 if (thickness < min_input_width)
56 return 0;
57 coord_t ret = parent->getOptimalBeadCount(thickness);
58 if (thickness >= min_input_width && ret < 1)
59 return 1;
60 return ret;
61}
int32_t coord_t
Definition libslic3r.h:39

References min_input_width, and parent.

◆ getOptimalThickness()

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

The ideal thickness for a given

Parameters
bead_count

Reimplemented from Slic3r::Arachne::BeadingStrategy.

41{
42 return parent->getOptimalThickness(bead_count);
43}

References 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::WideningBeadingStrategy::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.

69{
70 return parent->getTransitionAnchorPos(lower_bead_count);
71}

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::WideningBeadingStrategy::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.

64{
65 return parent->getTransitioningLength(lower_bead_count);
66}

References parent.

◆ getTransitionThickness()

coord_t Slic3r::Arachne::WideningBeadingStrategy::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.

46{
47 if (lower_bead_count == 0)
48 return min_input_width;
49 else
50 return parent->getTransitionThickness(lower_bead_count);
51}

References min_input_width, and parent.

◆ toString()

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

Reimplemented from Slic3r::Arachne::BeadingStrategy.

18{
19 return std::string("Widening+") + parent->toString();
20}

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().

◆ min_input_width

const coord_t Slic3r::Arachne::WideningBeadingStrategy::min_input_width
protected

◆ min_output_width

const coord_t Slic3r::Arachne::WideningBeadingStrategy::min_output_width
protected

Referenced by compute(), and getNonlinearThicknesses().

◆ name

◆ optimal_width

◆ 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: