Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::Arachne::BeadingStrategy Class Referenceabstract

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

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

Classes

struct  Beading
 

Public Member Functions

 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))
 
 BeadingStrategy (const BeadingStrategy &other)
 
virtual ~BeadingStrategy ()=default
 
virtual Beading compute (coord_t thickness, coord_t bead_count) const =0
 
virtual coord_t getOptimalThickness (coord_t bead_count) const
 
virtual coord_t getTransitionThickness (coord_t lower_bead_count) const
 
virtual coord_t getOptimalBeadCount (coord_t thickness) const =0
 
virtual coord_t getTransitioningLength (coord_t lower_bead_count) const
 
virtual float getTransitionAnchorPos (coord_t lower_bead_count) const
 
virtual std::vector< coord_tgetNonlinearThicknesses (coord_t lower_bead_count) const
 
virtual std::string toString () const
 
double getSplitMiddleThreshold () const
 
double getTransitioningAngle () const
 

Protected Attributes

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

Mostly virtual base class template.

Strategy for covering a given (constant) horizontal model thickness with a number of beads.

The beads may have different widths.

TODO: extend with printing order?


Class Documentation

◆ Slic3r::Arachne::BeadingStrategy::Beading

struct Slic3r::Arachne::BeadingStrategy::Beading

The beading for a given horizontal model thickness.

+ Collaboration diagram for Slic3r::Arachne::BeadingStrategy::Beading:
Class Members
vector< coord_t > bead_widths
coord_t left_over The distance of the toolpath location of each bead from the outline.
vector< coord_t > toolpath_locations The line width of each bead from the outer inset inward.
coord_t total_thickness

Constructor & Destructor Documentation

◆ BeadingStrategy() [1/2]

Slic3r::Arachne::BeadingStrategy::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) 
)
18{
19 name = "Unknown";
20}
double wall_add_middle_threshold
Threshold when a middle wall should be split into two, as a ratio of the optimal wall width.
Definition BeadingStrategy.hpp:103
coord_t optimal_width
Definition BeadingStrategy.hpp:99
std::string name
Definition BeadingStrategy.hpp:97
double transitioning_angle
The length of the region to smoothly transfer between bead counts.
Definition BeadingStrategy.hpp:111
double wall_split_middle_threshold
Optimal bead width, nominal width off the walls in 'ideal' circumstances.
Definition BeadingStrategy.hpp:101
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 o...
Definition BeadingStrategy.hpp:105

References name.

◆ BeadingStrategy() [2/2]

Slic3r::Arachne::BeadingStrategy::BeadingStrategy ( const BeadingStrategy other)
23 : optimal_width(other.optimal_width)
24 , wall_split_middle_threshold(other.wall_split_middle_threshold)
25 , wall_add_middle_threshold(other.wall_add_middle_threshold)
26 , default_transition_length(other.default_transition_length)
27 , transitioning_angle(other.transitioning_angle)
28 , name(other.name)
29{}

◆ ~BeadingStrategy()

virtual Slic3r::Arachne::BeadingStrategy::~BeadingStrategy ( )
virtualdefault

Member Function Documentation

◆ compute()

virtual Beading Slic3r::Arachne::BeadingStrategy::compute ( coord_t  thickness,
coord_t  bead_count 
) const
pure virtual

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

Implemented in Slic3r::Arachne::DistributedBeadingStrategy, Slic3r::Arachne::LimitedBeadingStrategy, Slic3r::Arachne::OuterWallInsetBeadingStrategy, Slic3r::Arachne::RedistributeBeadingStrategy, and Slic3r::Arachne::WideningBeadingStrategy.

◆ getNonlinearThicknesses()

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

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

virtual coord_t Slic3r::Arachne::BeadingStrategy::getOptimalBeadCount ( coord_t  thickness) const
pure virtual

◆ getOptimalThickness()

coord_t Slic3r::Arachne::BeadingStrategy::getOptimalThickness ( coord_t  bead_count) const
virtual

The ideal thickness for a given

Parameters
bead_count

Reimplemented in Slic3r::Arachne::LimitedBeadingStrategy, Slic3r::Arachne::OuterWallInsetBeadingStrategy, Slic3r::Arachne::RedistributeBeadingStrategy, and Slic3r::Arachne::WideningBeadingStrategy.

67{
68 return optimal_width * bead_count;
69}

References optimal_width.

Referenced by getTransitionAnchorPos(), and getTransitionThickness().

+ Here is the caller graph for this function:

◆ getSplitMiddleThreshold()

double Slic3r::Arachne::BeadingStrategy::getSplitMiddleThreshold ( ) const

◆ getTransitionAnchorPos()

float Slic3r::Arachne::BeadingStrategy::getTransitionAnchorPos ( coord_t  lower_bead_count) const
virtual

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 in Slic3r::Arachne::LimitedBeadingStrategy, Slic3r::Arachne::RedistributeBeadingStrategy, and Slic3r::Arachne::WideningBeadingStrategy.

39{
40 coord_t lower_optimum = getOptimalThickness(lower_bead_count);
41 coord_t transition_point = getTransitionThickness(lower_bead_count);
42 coord_t upper_optimum = getOptimalThickness(lower_bead_count + 1);
43 return 1.0 - float(transition_point - lower_optimum) / float(upper_optimum - lower_optimum);
44}
virtual coord_t getOptimalThickness(coord_t bead_count) const
Definition BeadingStrategy.cpp:66
virtual coord_t getTransitionThickness(coord_t lower_bead_count) const
Definition BeadingStrategy.cpp:71
int32_t coord_t
Definition libslic3r.h:39

References getOptimalThickness(), and getTransitionThickness().

Referenced by Slic3r::Arachne::SkeletalTrapezoidation::filterTransitionMids(), and Slic3r::Arachne::SkeletalTrapezoidation::generateTransitionEnds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTransitioningAngle()

double Slic3r::Arachne::BeadingStrategy::getTransitioningAngle ( ) const
62{
64}

References transitioning_angle.

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

+ Here is the caller graph for this function:

◆ getTransitioningLength()

coord_t Slic3r::Arachne::BeadingStrategy::getTransitioningLength ( coord_t  lower_bead_count) const
virtual

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 in Slic3r::Arachne::LimitedBeadingStrategy, Slic3r::Arachne::OuterWallInsetBeadingStrategy, Slic3r::Arachne::RedistributeBeadingStrategy, and Slic3r::Arachne::WideningBeadingStrategy.

32{
33 if (lower_bead_count == 0)
34 return scaled<coord_t>(0.01);
36}

References default_transition_length.

Referenced by Slic3r::Arachne::SkeletalTrapezoidation::dissolveNearbyTransitions(), Slic3r::Arachne::SkeletalTrapezoidation::filterTransitionMids(), and Slic3r::Arachne::SkeletalTrapezoidation::generateTransitionEnds().

+ Here is the caller graph for this function:

◆ getTransitionThickness()

coord_t Slic3r::Arachne::BeadingStrategy::getTransitionThickness ( coord_t  lower_bead_count) const
virtual

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

Reimplemented in Slic3r::Arachne::LimitedBeadingStrategy, Slic3r::Arachne::OuterWallInsetBeadingStrategy, Slic3r::Arachne::RedistributeBeadingStrategy, and Slic3r::Arachne::WideningBeadingStrategy.

72{
73 const coord_t lower_ideal_width = getOptimalThickness(lower_bead_count);
74 const coord_t higher_ideal_width = getOptimalThickness(lower_bead_count + 1);
75 const double threshold = lower_bead_count % 2 == 1 ? wall_split_middle_threshold : wall_add_middle_threshold;
76 return lower_ideal_width + threshold * (higher_ideal_width - lower_ideal_width);
77}

References getOptimalThickness(), wall_add_middle_threshold, and wall_split_middle_threshold.

Referenced by Slic3r::Arachne::SkeletalTrapezoidation::generateTransitionMids(), getTransitionAnchorPos(), and Slic3r::Arachne::SkeletalTrapezoidation::updateIsCentral().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toString()

std::string Slic3r::Arachne::BeadingStrategy::toString ( ) const
virtual

Member Data Documentation

◆ default_transition_length

coord_t Slic3r::Arachne::BeadingStrategy::default_transition_length
protected

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

◆ name

◆ optimal_width

◆ transitioning_angle

double Slic3r::Arachne::BeadingStrategy::transitioning_angle
protected

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

◆ wall_add_middle_threshold

double Slic3r::Arachne::BeadingStrategy::wall_add_middle_threshold
protected

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

◆ wall_split_middle_threshold

double Slic3r::Arachne::BeadingStrategy::wall_split_middle_threshold
protected

Optimal bead width, nominal width off the walls in 'ideal' circumstances.

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


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