Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small area infill flow compensation (graph version) causing some lines to not extrude (#4374) #4399

Open
wants to merge 1 commit into
base: nightly_dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/libslic3r/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,26 +358,24 @@ size_t GraphData::data_size() const
}

double GraphData::interpolate(double x_value) const{
double y_value = 0.;
double y_value = 1.0f;
if (this->data_size() < 1) {
// nothing
} else if (this->graph_points.size() == 1 || this->graph_points.front().x() >= x_value) {
} else if (this->graph_points.size() == 1 || this->graph_points[begin_idx].x() >= x_value) {
y_value = this->graph_points.front().y();
} else if (this->graph_points.back().x() <= x_value) {
} else if (this->graph_points[end_idx - 1].x() <= x_value) {
y_value = this->graph_points.back().y();
} else {
// find first and second datapoint
for (size_t idx = this->begin_idx; idx < this->end_idx; ++idx) {
const auto &data_point = this->graph_points[idx];
if (data_point.x() == x_value) {
if (is_approx(data_point.x(), x_value)) {
// lucky point
y_value = data_point.y();
break;
return data_point.y();
} else if (data_point.x() < x_value) {
// not yet, iterate
} else if (idx == 0) {
y_value = data_point.y();
break;
return data_point.y();
} else {
// interpolate
const auto &data_point_before = this->graph_points[idx - 1];
Expand Down Expand Up @@ -453,7 +451,7 @@ double GraphData::interpolate(double x_value) const{
} else {
assert(false);
}
break;
return y_value;
}
}
}
Expand Down