Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_objects_collision

This commit is contained in:
enricoturri1966 2021-10-05 15:33:37 +02:00
commit 982172b878
8 changed files with 132 additions and 62 deletions
src/libslic3r

View file

@ -1639,12 +1639,13 @@ void visit_antipodals (Idx& ia, Idx &ib, Fn &&fn)
// Set current caliper direction to be the lower edge angle from X axis
int cmp = cmp_angles(ia.prev_dir(), ia.dir(), ib.dir());
Idx *current = cmp <= 0 ? &ia : &ib, *other = cmp <= 0 ? &ib : &ia;
Idx *initial = current;
bool visitor_continue = true;
size_t a_start = ia.idx(), b_start = ib.idx();
bool a_finished = false, b_finished = false;
size_t start = initial->idx();
bool finished = false;
while (visitor_continue && !(a_finished && b_finished)) {
while (visitor_continue && !finished) {
Point current_dir_a = current == &ia ? current->dir() : -current->dir();
visitor_continue = fn(ia.idx(), ib.idx(), current_dir_a);
@ -1664,8 +1665,7 @@ void visit_antipodals (Idx& ia, Idx &ib, Fn &&fn)
std::swap(current, other);
}
if (ia.idx() == a_start) a_finished = true;
if (ib.idx() == b_start) b_finished = true;
if (initial->idx() == start) finished = true;
}
}
@ -1702,8 +1702,8 @@ bool intersects(const Polygon &A, const Polygon &B)
BoundingBox bbA{{A[bA.xmin].x(), A[bA.ymin].y()}, {A[bA.xmax].x(), A[bA.ymax].y()}};
BoundingBox bbB{{B[bB.xmin].x(), B[bB.ymin].y()}, {B[bB.xmax].x(), B[bB.ymax].y()}};
if (!bbA.overlap(bbB))
return false;
// if (!bbA.overlap(bbB))
// return false;
// Establish starting antipodals as extreme vertex pairs in X or Y direction
// which reside on different polygons. If no such pair is found, the two