gap fill : only if perimeters aren't touching

medial axis: concatenate_polylines_with_crossing fixed
This commit is contained in:
supermerill 2019-04-08 10:42:30 +02:00
parent 41c5d32744
commit a3bdc74045
2 changed files with 6 additions and 2 deletions

View File

@ -1149,7 +1149,7 @@ MedialAxis::concatenate_polylines_with_crossing(ThickPolylines& pp)
Vec2d v_other(other_reverse ? other.lines().back().vector().x() : other.lines().front().vector().x(),
other_reverse ? other.lines().back().vector().y() : other.lines().front().vector().y());
v_other *= (1 / std::sqrt(v_other.x()*v_other.x() + v_other.y()*v_other.y()));
float other_dot = (float)( v_poly.x()*v_other.x() + v_poly.y()*v_other.y() );
float other_dot = std::abs(float( v_poly.x()*v_other.x() + v_poly.y()*v_other.y() ));
if (other_dot > best_dot) {
best_candidate = &other;
best_idx = j;

View File

@ -50,6 +50,9 @@ void PerimeterGenerator::process()
// solid infill
coord_t solid_infill_spacing = this->solid_infill_flow.scaled_spacing();
// nozzle diameter
const double nozzle_diameter = this->print_config->nozzle_diameter.get_at(this->config->perimeter_extruder - 1);
// Calculate the minimum required spacing between two adjacent traces.
// This should be equal to the nominal flow spacing but we experiment
@ -69,7 +72,6 @@ void PerimeterGenerator::process()
// We consider overhang any part where the entire nozzle diameter is not supported by the
// lower layer, so we take lower slices and offset them by half the nozzle diameter used
// in the current layer
double nozzle_diameter = this->print_config->nozzle_diameter.get_at(this->config->perimeter_extruder-1);
this->_lower_slices_p = offset(*this->lower_slices, double(scale_(+nozzle_diameter/2)));
}
@ -587,6 +589,8 @@ void PerimeterGenerator::process()
if (!gaps.empty()) {
// collapse
double min = 0.2 * perimeter_width * (1 - INSET_OVERLAP_TOLERANCE);
//be sure we don't gapfill where the perimeters are already touching each other (negative spacing).
min = std::max(min, double(Flow::new_from_spacing(EPSILON, nozzle_diameter, this->layer_height, false).scaled_width()));
double max = 2. * perimeter_spacing;
ExPolygons gaps_ex = diff_ex(
offset2_ex(gaps, double(-min / 2), double(+min / 2)),