OrcaSlicer/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.hpp
SoftFever 34ad17bcd2
Fix small area flow comp regression and some other small tweaks (#5844)
* Fix regression, always create SmallAreaInfillFlowCompensator model
small_area_infill_flow_compensation is per-region parameter, it's not necessary to iterate though all regions to check whether to create a model.

* Make SmallAreaInfillFlowCompensator robus.
1. handle spaces/tabs/new lines etc
2. don't throw expection, fall back to no-op instead if parsing failed

* Fixing an issue that changing small_area_infill_flow_compensation per modifier didn't take effect
2024-06-25 00:20:20 +08:00

37 lines
963 B
C++

#ifndef slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_
#define slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_
#include "../libslic3r.h"
#include "../PrintConfig.hpp"
#include "../ExtrusionEntity.hpp"
#include "spline/spline.h"
#include <memory>
namespace Slic3r {
class SmallAreaInfillFlowCompensator
{
public:
SmallAreaInfillFlowCompensator() = delete;
explicit SmallAreaInfillFlowCompensator(const Slic3r::GCodeConfig& config);
~SmallAreaInfillFlowCompensator() = default;
double modify_flow(const double line_length, const double dE, const ExtrusionRole role);
private:
// Model points
std::vector<double> eLengths;
std::vector<double> flowComps;
// TODO: Cubic Spline
std::unique_ptr<tk::spline> flowModel;
double flow_comp_model(const double line_length);
double max_modified_length() { return eLengths.back(); }
};
} // namespace Slic3r
#endif /* slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_ */