OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::Algorithm::RegionExpansionParameters Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Algorithm/RegionExpansion.hpp>

Static Public Member Functions

static RegionExpansionParameters build (float full_expansion, float expansion_step, size_t max_nr_expansion_steps)

Public Attributes

float tiny_expansion
float initial_step
float other_step
size_t num_other_steps
float max_inflation
double arc_tolerance

Detailed Description

Member Function Documentation

◆ build()

RegionExpansionParameters Slic3r::Algorithm::RegionExpansionParameters::build ( float full_expansion,
float expansion_step,
size_t max_nr_expansion_steps )
static
49{
50 assert(full_expansion > 0);
51 assert(expansion_step > 0);
52 assert(max_nr_expansion_steps > 0);
53
54 RegionExpansionParameters out;
55 // Initial expansion of src to make the source regions intersect with boundary regions just a bit.
56 // The expansion should not be too tiny, but also small enough, so the following expansion will
57 // compensate for tiny_expansion and bring the wave back to the boundary without producing
58 // ugly cusps where it touches the boundary.
59 out.tiny_expansion = std::min(0.25f * full_expansion, scaled<float>(0.05f));
60 size_t nsteps = size_t(ceil((full_expansion - out.tiny_expansion) / expansion_step));
61 if (max_nr_expansion_steps > 0)
62 nsteps = std::min(nsteps, max_nr_expansion_steps);
63 assert(nsteps > 0);
64 out.initial_step = (full_expansion - out.tiny_expansion) / nsteps;
65 if (nsteps > 1 && 0.25 * out.initial_step < out.tiny_expansion) {
66 // Decrease the step size by lowering number of steps.
67 nsteps = std::max<size_t>(1, (floor((full_expansion - out.tiny_expansion) / (4. * out.tiny_expansion))));
68 out.initial_step = (full_expansion - out.tiny_expansion) / nsteps;
69 }
70 if (0.25 * out.initial_step < out.tiny_expansion || nsteps == 1) {
71 out.tiny_expansion = 0.2f * full_expansion;
72 out.initial_step = 0.8f * full_expansion;
73 }
74 out.other_step = out.initial_step;
75 out.num_other_steps = nsteps - 1;
76
77 // Accuracy of the offsetter for wave propagation.
78 out.arc_tolerance = scaled<double>(0.1);
79
80 // Maximum inflation of seed contours over the boundary. Used to trim boundary to speed up
81 // clipping during wave propagation. Needs to be in sync with the offsetter accuracy.
82 // Clipper positive round offset should rather offset less than more.
83 // Still a little bit of additional offset was added.
84 out.max_inflation = (out.tiny_expansion + nsteps * out.initial_step) * 1.1;
85// (clipper_round_offset_error(out.tiny_expansion, co.ArcTolerance) + nsteps * clipper_round_offset_error(out.initial_step, co.ArcTolerance) * 1.5; // Account for uncertainty
86
87 return out;
88}
BoundingBox scaled(const BoundingBoxf &bb)
Definition BoundingBox.hpp:284

References arc_tolerance, initial_step, max_inflation, num_other_steps, other_step, Slic3r::scaled(), and tiny_expansion.

Referenced by Slic3r::LayerRegion::process_external_surfaces(), Slic3r::Algorithm::propagate_waves(), and Slic3r::Algorithm::propagate_waves_ex().

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

Member Data Documentation

◆ arc_tolerance

double Slic3r::Algorithm::RegionExpansionParameters::arc_tolerance

◆ initial_step

float Slic3r::Algorithm::RegionExpansionParameters::initial_step

◆ max_inflation

float Slic3r::Algorithm::RegionExpansionParameters::max_inflation

◆ num_other_steps

size_t Slic3r::Algorithm::RegionExpansionParameters::num_other_steps

◆ other_step

float Slic3r::Algorithm::RegionExpansionParameters::other_step

◆ tiny_expansion

float Slic3r::Algorithm::RegionExpansionParameters::tiny_expansion

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