Skip to content

Commit 666896a

Browse files
committed
WIP: HP: Allow prism-like setups instead of just pyramid-like setups
1 parent 7359be7 commit 666896a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Movement/Kinematics/HangprinterKinematics.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,14 +427,19 @@ bool HangprinterKinematics::IsReachable(float axesCoords[MaxAxes], AxesBitmap ax
427427
{
428428
float const coords[3] = {axesCoords[X_AXIS], axesCoords[Y_AXIS], axesCoords[Z_AXIS]};
429429
bool reachable = true;
430+
bool last_middle = true; // TODO make configurable
431+
unsigned discount_last = 0;
430432

431-
// Check all the planes defined by triangle sides in the pyramid
432-
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - 1; ++i) {
433-
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], anchors[HANGPRINTER_AXES - 1], anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
433+
if (last_middle) {
434+
// Check all the planes defined by triangle sides in the pyramid
435+
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - 1; ++i) {
436+
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], anchors[HANGPRINTER_AXES - 1], anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
437+
}
438+
discount_last = 1;
434439
}
435440

436441
// 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) {
442+
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - discount_last; ++i) {
438443
float const lower_point[3] = {anchors[i][0], anchors[i][1], anchors[i][2] - 1};
439444
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], lower_point, anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
440445
}

0 commit comments

Comments
 (0)