mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 18:58:00 -06:00
Port Quartercubic infill pattern (#7243)
* Ported Quarter Cubic infill pattern from Cura * Code reformat
This commit is contained in:
parent
880081226a
commit
302b40af22
6 changed files with 162 additions and 2 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <boost/container/small_vector.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
#include "../ClipperUtils.hpp"
|
||||
#include "../ExPolygon.hpp"
|
||||
|
@ -3035,6 +3036,39 @@ Polylines FillCubic::fill_surface(const Surface *surface, const FillParams ¶
|
|||
return polylines_out;
|
||||
}
|
||||
|
||||
Polylines FillQuarterCubic::fill_surface(const Surface* surface, const FillParams& params)
|
||||
{
|
||||
using namespace boost::math::float_constants;
|
||||
|
||||
Polylines polylines_out;
|
||||
|
||||
coord_t line_width = coord_t(scale_(this->spacing));
|
||||
coord_t period = coord_t(scale_(this->spacing) / params.density) * 4;
|
||||
|
||||
// First half tetrahedral fill
|
||||
double pattern_z_shift = 0.0;
|
||||
coord_t shift = coord_t(one_div_root_two * (scale_(z) + pattern_z_shift * period * 2)) % period;
|
||||
shift = std::min(shift, period - shift); // symmetry due to the fact that we are applying the shift in both directions
|
||||
shift = std::min(shift, period / 2 - line_width / 2); // don't put lines too close to each other
|
||||
shift = std::max(shift, line_width / 2); // don't put lines too close to each other
|
||||
float dx1 = unscale_(shift);
|
||||
|
||||
// Second half tetrahedral fill
|
||||
pattern_z_shift = 0.5;
|
||||
shift = coord_t(one_div_root_two * (scale_(z) + pattern_z_shift * period * 2)) % period;
|
||||
shift = std::min(shift, period - shift); // symmetry due to the fact that we are applying the shift in both directions
|
||||
shift = std::min(shift, period / 2 - line_width / 2); // don't put lines too close to each other
|
||||
shift = std::max(shift, line_width / 2); // don't put lines too close to each other
|
||||
float dx2 = unscale_(shift);
|
||||
if (!this->fill_surface_by_multilines(
|
||||
surface, params,
|
||||
{{0.f, dx1}, {0.f, -dx1}, {float(M_PI / 2.), dx2}, {float(M_PI / 2.), -dx2}},
|
||||
polylines_out))
|
||||
BOOST_LOG_TRIVIAL(error) << "FillQuarterCubic::fill_surface() failed to fill a region.";
|
||||
|
||||
return polylines_out;
|
||||
}
|
||||
|
||||
Polylines FillSupportBase::fill_surface(const Surface *surface, const FillParams ¶ms)
|
||||
{
|
||||
assert(! params.full_infill());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue