Skip to content

Commit adcc980

Browse files
committed
WIP: HP: Allow prism-like setups instead of just pyramid-like setups
1 parent d59cf0d commit adcc980

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
@@ -478,14 +478,19 @@ bool HangprinterKinematics::IsReachable(float axesCoords[MaxAxes], AxesBitmap ax
478478
{
479479
float const coords[3] = {axesCoords[X_AXIS], axesCoords[Y_AXIS], axesCoords[Z_AXIS]};
480480
bool reachable = true;
481+
bool last_middle = true; // TODO make configurable
482+
unsigned discount_last = 0;
481483

482-
// Check all the planes defined by triangle sides in the pyramid
483-
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - 1; ++i) {
484-
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], anchors[HANGPRINTER_AXES - 1], anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
484+
if (last_middle) {
485+
// Check all the planes defined by triangle sides in the pyramid
486+
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - 1; ++i) {
487+
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], anchors[HANGPRINTER_AXES - 1], anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
488+
}
489+
discount_last = 1;
485490
}
486491

487492
// For each side of the base, check the plane formed by side and another point bellow them in z.
488-
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - 1; ++i) {
493+
for (size_t i = 0; reachable && i < HANGPRINTER_AXES - discount_last; ++i) {
489494
float const lower_point[3] = {anchors[i][0], anchors[i][1], anchors[i][2] - 1};
490495
reachable = isSameSide(anchors[i], anchors[(i+1) % (HANGPRINTER_AXES - 1)], lower_point, anchors[(i+2) % (HANGPRINTER_AXES - 1)], coords);
491496
}

0 commit comments

Comments
 (0)