mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-24 00:28:38 -07:00
Replace spline with PchipInterpolatorHelper in flow compensator
Swapped out the tk::spline implementation for PchipInterpolatorHelper in SmallAreaInfillFlowCompensator. Updated member types and method calls to use the new interpolator for improved flow compensation modeling.
This commit is contained in:
parent
3c47b60063
commit
0049fd7554
2 changed files with 4 additions and 10 deletions
|
|
@ -15,7 +15,6 @@
|
|||
#include "../PrintConfig.hpp"
|
||||
|
||||
#include "SmallAreaInfillFlowCompensator.hpp"
|
||||
#include "spline/spline.h"
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
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<tk::spline>();
|
||||
flowModel->set_points(eLengths, flowComps);
|
||||
flowModel = std::make_unique<PchipInterpolatorHelper>(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)
|
||||
|
|
|
|||
|
|
@ -4,12 +4,9 @@
|
|||
#include "../libslic3r.h"
|
||||
#include "../PrintConfig.hpp"
|
||||
#include "../ExtrusionEntity.hpp"
|
||||
#include "PchipInterpolatorHelper.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace tk {
|
||||
class spline;
|
||||
} // namespace tk
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class SmallAreaInfillFlowCompensator
|
||||
|
|
@ -26,8 +23,7 @@ private:
|
|||
std::vector<double> eLengths;
|
||||
std::vector<double> flowComps;
|
||||
|
||||
// TODO: Cubic Spline
|
||||
std::unique_ptr<tk::spline> flowModel;
|
||||
std::unique_ptr<PchipInterpolatorHelper> flowModel;
|
||||
|
||||
double flow_comp_model(const double line_length);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue