Skip to content

Commit

Permalink
fix ExtrusionLoop::split_at() and improved ExtrusionLoop::split_at_ve…
Browse files Browse the repository at this point in the history
…rtex()
  • Loading branch information
supermerill committed Jun 11, 2024
1 parent 4521871 commit eaf2953
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libslic3r/ExtrusionEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ bool ExtrusionLoop::split_at_vertex(const Point &point, const double scaled_epsi
p2.append(std::move(p1));
path->polyline.swap(p2); // swap points & fitting result
}
} else {
} else if (idx > 0 && idx < path->size() - 1) {
// new paths list starts with the second half of current path
ExtrusionPaths new_paths;
PolylineOrArc p1, p2;
Expand Down Expand Up @@ -236,8 +236,8 @@ void ExtrusionLoop::split_at(const Point &point, bool prefer_non_overhang, const
const Point *p1 = this->paths[path_idx].polyline.get_points().data() + segment_idx;
const Point *p2 = p1;
++ p2;
double d2_1 = (point - *p1).cast<double>().squaredNorm();
double d2_2 = (point - *p2).cast<double>().squaredNorm();
double d2_1 = (p - *p1).cast<double>().squaredNorm();
double d2_2 = (p - *p2).cast<double>().squaredNorm();
const double thr2 = scaled_epsilon * scaled_epsilon;
if (d2_1 < d2_2) {
if (d2_1 < thr2)
Expand Down

0 comments on commit eaf2953

Please sign in to comment.