Refactoring: new method in Flow for calculating spacing between extrusions having different width

This commit is contained in:
Alessandro Ranellucci 2014-06-12 09:15:40 +02:00
parent 8ee11b3239
commit 6194cbf530
4 changed files with 26 additions and 10 deletions

View file

@ -40,7 +40,7 @@ Flow::new_from_spacing(float spacing, float nozzle_diameter, float height, bool
float
Flow::spacing() const {
if (this->bridge) {
return width + BRIDGE_EXTRA_SPACING;
return this->width + BRIDGE_EXTRA_SPACING;
}
float min_flow_spacing;
@ -54,6 +54,21 @@ Flow::spacing() const {
return this->width - OVERLAP_FACTOR * (this->width - min_flow_spacing);
}
/* This method returns the centerline spacing between an extrusion using this
flow and another one using another flow.
this->spacing(other) shall return the same value as other.spacing(*this) */
float
Flow::spacing(const Flow &other) const {
assert(this->height == other.height);
assert(this->bridge == other.bridge);
if (this->bridge) {
return this->width/2 + other.width/2 + BRIDGE_EXTRA_SPACING;
}
return this->spacing()/2 + other.spacing()/2;
}
/* This method returns extrusion volume per head move unit. */
double
Flow::mm3_per_mm() const {