Skip to content

Commit 7359be7

Browse files
committed
fixup! any pseudo-pyramid
1 parent 39509bf commit 7359be7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Movement/Kinematics/HangprinterKinematics.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,22 +419,26 @@ static bool isSameSide(float const v0[3], float const v1[3], float const v2[3],
419419
return dot0*dot1 > 0.0F;
420420
}
421421

422-
// For each triangle side in a pyramid, check if the point is inside the pyramid. Plus check the base too
423-
// Precondition: all the base anchors belong to the same plane,
424-
// except the top (last) anchor which is above that plane with respect to the bed
422+
// For each triangle side in a pseudo-pyramid, check if the point is inside the pyramid (Except for the base)
423+
// Also check that any point below the line between two exterior anchors (all anchors are exterior except for the last one)
424+
// is in the "inside part" all the way down to min_Z, however low it may be.
425+
// To further limit the movements in the X and Y axes one can simply set a smaller print radius.
425426
bool HangprinterKinematics::IsReachable(float axesCoords[MaxAxes], AxesBitmap axes) const noexcept /*override*/
426427
{
427428
float const coords[3] = {axesCoords[X_AXIS], axesCoords[Y_AXIS], axesCoords[Z_AXIS]};
428429
bool reachable = true;
429430

430-
// First we check is above the base plane
431-
reachable = isSameSide(anchors[0], anchors[1], anchors[2], anchors[HANGPRINTER_AXES - 1], coords);
432-
433431
// Check all the planes defined by triangle sides in the pyramid
434432
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - 1; ++i) {
435433
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], anchors[HANGPRINTER_AXES - 1], anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
436434
}
437435

436+
// For each side of the base, check the plane formed by side and another point bellow them in z.
437+
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - 1; ++i) {
438+
float const lower_point[3] = {anchors[i][0], anchors[i][1], anchors[i][2] - 1};
439+
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], lower_point, anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
440+
}
441+
438442
return reachable;
439443
}
440444

0 commit comments

Comments
 (0)