mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Rewrote Fill2.pm to C++, deleted Perl infills for good.
Removed dependency on Perl Math::PlanePath module. Fixed compilation with Visual Studio and SLIC3R_DEBUG: Visual Studio older than 2015 does not support the prinf type specifier %zu. Use %Iu instead. C++11 move semantics enabled.
This commit is contained in:
parent
3a31d37d35
commit
95ede7c4b8
49 changed files with 628 additions and 1803 deletions
|
@ -60,15 +60,25 @@ Polylines Fill::fill_surface(const Surface *surface, const FillParams ¶ms)
|
|||
|
||||
// Calculate a new spacing to fill width with possibly integer number of lines,
|
||||
// the first and last line being centered at the interval ends.
|
||||
//FIXME Vojtech: This
|
||||
// This function possibly increases the spacing, never decreases,
|
||||
// and for a narrow width the increase in spacing may become severe!
|
||||
// and for a narrow width the increase in spacing may become severe,
|
||||
// therefore the adjustment is limited to 20% increase.
|
||||
coord_t Fill::_adjust_solid_spacing(const coord_t width, const coord_t distance)
|
||||
{
|
||||
coord_t number_of_intervals = coord_t(coordf_t(width) / coordf_t(distance));
|
||||
return (number_of_intervals == 0) ?
|
||||
assert(width >= 0);
|
||||
assert(distance > 0);
|
||||
// floor(width / distance)
|
||||
coord_t number_of_intervals = width / distance;
|
||||
coord_t distance_new = (number_of_intervals == 0) ?
|
||||
distance :
|
||||
(width / number_of_intervals);
|
||||
const coordf_t factor = coordf_t(distance_new) / coordf_t(distance);
|
||||
assert(factor > 1. - 1e-5);
|
||||
// How much could the extrusion width be increased? By 20%.
|
||||
const coordf_t factor_max = 1.2;
|
||||
if (factor > factor_max)
|
||||
distance_new = coord_t(floor((coordf_t(distance) * factor_max + 0.5)));
|
||||
return distance_new;
|
||||
}
|
||||
|
||||
// Returns orientation of the infill and the reference point of the infill pattern.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue