Refactoring: keep height in Flow object and calculate spacing on demand

This commit is contained in:
Alessandro Ranellucci
2014-06-12 01:00:13 +02:00
parent 9bff6ccde7
commit 8ee11b3239
7 changed files with 86 additions and 73 deletions

View File

@@ -23,23 +23,26 @@ enum FlowRole {
class Flow
{
public:
float width;
float spacing;
float nozzle_diameter;
float width, height, nozzle_diameter;
bool bridge;
coord_t scaled_width;
coord_t scaled_spacing;
Flow(float _w, float _s, float _nd): width(_w), spacing(_s), nozzle_diameter(_nd), bridge(false) {
this->scaled_width = scale_(this->width);
this->scaled_spacing = scale_(this->spacing);
Flow(float _w, float _h, float _nd, bool _bridge = false)
: width(_w), height(_h), nozzle_diameter(_nd), bridge(_bridge) {};
float spacing() const;
double mm3_per_mm() const;
coord_t scaled_width() const {
return scale_(this->width);
};
double mm3_per_mm(float h);
coord_t scaled_spacing() const {
return scale_(this->spacing());
};
static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, float bridge_flow_ratio);
static Flow new_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge);
private:
static float _width(FlowRole role, float nozzle_diameter, float height, float bridge_flow_ratio);
static float _bridge_width(float nozzle_diameter, float bridge_flow_ratio);
static float _auto_width(FlowRole role, float nozzle_diameter, float height);
static float _width_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge);
static float _spacing(float width, float nozzle_diameter, float height, float bridge_flow_ratio);
};