OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::Arachne::WideningBeadingStrategy Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/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_t > getNonlinearThicknesses (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
19 , parent(std::move(parent))
22{
23}
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:44
const coord_t min_input_width
Definition WideningBeadingStrategy.hpp:45
const coord_t min_output_width
Definition WideningBeadingStrategy.hpp:46

References Slic3r::Arachne::BeadingStrategy::BeadingStrategy(), min_input_width, min_output_width, and parent.

Here is the call graph for this function:

◆ ~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.

31{
32 // Use getTransitionThickness(1) to determine if this is a thin wall that should produce
33 // a single bead. This ensures consistency with getOptimalBeadCount() which uses the same
34 // threshold (via RedistributeBeadingStrategy) to decide between 1 and 2 beads.
35 // Previously used optimal_width which could differ from the outer wall width used in
36 // bead count calculations, causing inconsistency where bead_count=2 was requested but
37 // only 1 bead was produced.
38 //
39 // Orca #14376: only collapse to a single bead when at most one bead is requested. This
40 // branch emits one bead at the full wall thickness, so honoring it when bead_count >= 2
41 // (which happens inside 1<->2 transition bands) produces an over-wide extrusion that shows
42 // up as a surface bulge. Deferring to the parent keeps the requested two beads and also
43 // keeps compute() consistent with the bead count the skeletal graph asked for.
44 if (bead_count <= 1 && thickness < getTransitionThickness(1)) {
45 Beading ret;
46 ret.total_thickness = thickness;
47 if (thickness >= min_input_width) {
48 ret.bead_widths.emplace_back(std::max(thickness, min_output_width));
49 ret.toolpath_locations.emplace_back(thickness / 2);
50 ret.left_over = 0;
51 } else
52 ret.left_over = thickness;
53
54 return ret;
55 } else
56 return parent->compute(thickness, bead_count);
57}
coord_t total_thickness
Definition BeadingStrategy.hpp:37
Definition BeadingStrategy.hpp:36
coord_t getTransitionThickness(coord_t lower_bead_count) const override
Definition WideningBeadingStrategy.cpp:64

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

Here is the call graph for this function:

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

93{
94 std::vector<coord_t> ret;
95 ret.emplace_back(min_output_width);
96 std::vector<coord_t> pret = parent->getNonlinearThicknesses(lower_bead_count);
97 ret.insert(ret.end(), pret.begin(), pret.end());
98 return ret;
99}

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.

73{
74 if (thickness < min_input_width)
75 return 0;
76 coord_t ret = parent->getOptimalBeadCount(thickness);
77 if (thickness >= min_input_width && ret < 1)
78 return 1;
79 return ret;
80}
int64_t coord_t
Definition libslic3r.h:48

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.

60{
61 return parent->getOptimalThickness(bead_count);
62}

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

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

88{
89 return parent->getTransitionAnchorPos(lower_bead_count);
90}

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

References transitioning_angle.

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

83{
84 return parent->getTransitioningLength(lower_bead_count);
85}

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.

65{
66 if (lower_bead_count == 0)
67 return min_input_width;
68 else
69 return parent->getTransitionThickness(lower_bead_count);
70}

References min_input_width, and parent.

Referenced by compute().

Here is the caller graph for this function:

◆ toString()

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

Reimplemented from Slic3r::Arachne::BeadingStrategy.

26{
27 return std::string("Widening+") + parent->toString();
28}

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 BeadingStrategy(), BeadingStrategy(), Slic3r::Arachne::DistributedBeadingStrategy::DistributedBeadingStrategy(), and 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

◆ 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 BeadingStrategy(), BeadingStrategy(), Slic3r::Arachne::DistributedBeadingStrategy::DistributedBeadingStrategy(), and getTransitioningAngle().

◆ wall_add_middle_threshold

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

◆ wall_split_middle_threshold

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

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