Files
OrcaSlicer/src/libslic3r/FlushVolPredictor.hpp
xun.zhang 81382448eb ENH: update flush data for H2D
1.Alsoe set default flush from support to 700

jira: STUDIO-10595

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I0d0a85cdac5e63b787c16b35ed6c05afc885a715
(cherry picked from commit 5fea5e6696a28d7ec9edcde38c43700cb3b7f596)
2025-09-18 16:49:36 +08:00

61 lines
1.5 KiB
C++

#ifndef FLUSH_VOL_PREDICTOR_HPP
#define FLUSH_VOL_PREDICTOR_HPP
#include<cstdint>
#include<unordered_map>
#include<string>
#include<vector>
namespace FlushPredict
{
enum FlushMachineType
{
Standard,
DualStandard,
DualHighFlow
};
struct RGBColor
{
unsigned char r{ 0 };
unsigned char g{ 0 };
unsigned char b{ 0 };
RGBColor(unsigned char r_,unsigned char g_,unsigned char b_) :r(r_),g(g_),b(b_){}
RGBColor() = default;
};
struct LABColor
{
double l{ 0 };
double a{ 0 };
double b{ 0 };
LABColor() = default;
LABColor(double l_,double a_,double b_):l(l_),a(a_),b(b_){}
};
// transfer colour in RGB space to LAB space
LABColor RGB2LAB(const RGBColor& color);
// calculate DeltaE2000
float calc_color_distance(const LABColor& lab1, const LABColor& lab2);
float calc_color_distance(const RGBColor& rgb1, const RGBColor& rgb2);
// check if DeltaE is within the threshold. We consider colors within the threshold to be the same
bool is_similar_color(const RGBColor& from, const RGBColor& to, float distance_threshold = 5.0);
}
class FlushVolPredictor;
class GenericFlushPredictor
{
using RGB = FlushPredict::RGBColor;
using MachineType = FlushPredict::FlushMachineType;
public:
explicit GenericFlushPredictor(const MachineType& type);
bool predict(const RGB& from, const RGB& to, float& flush);
private:
FlushVolPredictor* predictor{ nullptr };
};
#endif