diff --git a/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp b/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp index e472b20794..4a5e3606bb 100644 --- a/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp +++ b/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.cpp @@ -15,7 +15,6 @@ #include "../PrintConfig.hpp" #include "SmallAreaInfillFlowCompensator.hpp" -#include "spline/spline.h" #include namespace Slic3r { @@ -73,8 +72,7 @@ SmallAreaInfillFlowCompensator::SmallAreaInfillFlowCompensator(const Slic3r::GCo throw Slic3r::InvalidArgument("Final compensation factor for small area infill flow compensation model must be 1.0"); } - flowModel = std::make_unique(); - flowModel->set_points(eLengths, flowComps); + flowModel = std::make_unique(eLengths, flowComps); } catch (std::exception& e) { BOOST_LOG_TRIVIAL(error) << "Error parsing small area infill compensation model: " << e.what(); @@ -92,7 +90,7 @@ double SmallAreaInfillFlowCompensator::flow_comp_model(const double line_length) return 1.0; } - return (*flowModel)(line_length); + return flowModel->interpolate(line_length); } double SmallAreaInfillFlowCompensator::modify_flow(const double line_length, const double dE, const ExtrusionRole role) diff --git a/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.hpp b/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.hpp index 1bfa5149f7..de1df98170 100644 --- a/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.hpp +++ b/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.hpp @@ -4,12 +4,9 @@ #include "../libslic3r.h" #include "../PrintConfig.hpp" #include "../ExtrusionEntity.hpp" +#include "PchipInterpolatorHelper.hpp" #include -namespace tk { -class spline; -} // namespace tk - namespace Slic3r { class SmallAreaInfillFlowCompensator @@ -26,8 +23,7 @@ private: std::vector eLengths; std::vector flowComps; - // TODO: Cubic Spline - std::unique_ptr flowModel; + std::unique_ptr flowModel; double flow_comp_model(const double line_length);