Skew Correction for UBL
Also remove unused grid slicing function when using UBL segmented.
This commit is contained in:
@ -580,14 +580,7 @@ void Planner::calculate_volumetric_multipliers() {
|
||||
void Planner::apply_leveling(float &rx, float &ry, float &rz) {
|
||||
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
if (WITHIN(rx, X_MIN_POS + 1, X_MAX_POS) && WITHIN(ry, Y_MIN_POS + 1, Y_MAX_POS)) {
|
||||
const float tempry = ry - (rz * planner.yz_skew_factor),
|
||||
temprx = rx - (ry * planner.xy_skew_factor) - (rz * (planner.xz_skew_factor - (planner.xy_skew_factor * planner.yz_skew_factor)));
|
||||
if (WITHIN(temprx, X_MIN_POS, X_MAX_POS) && WITHIN(tempry, Y_MIN_POS, Y_MAX_POS)) {
|
||||
rx = temprx;
|
||||
ry = tempry;
|
||||
}
|
||||
}
|
||||
skew(rx, ry, rz);
|
||||
#endif
|
||||
|
||||
if (!leveling_active) return;
|
||||
@ -678,14 +671,7 @@ void Planner::calculate_volumetric_multipliers() {
|
||||
}
|
||||
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
if (WITHIN(raw[X_AXIS], X_MIN_POS, X_MAX_POS) && WITHIN(raw[Y_AXIS], Y_MIN_POS, Y_MAX_POS)) {
|
||||
const float temprx = raw[X_AXIS] + raw[Y_AXIS] * planner.xy_skew_factor + raw[Z_AXIS] * planner.xz_skew_factor,
|
||||
tempry = raw[Y_AXIS] + raw[Z_AXIS] * planner.yz_skew_factor;
|
||||
if (WITHIN(temprx, X_MIN_POS, X_MAX_POS) && WITHIN(tempry, Y_MIN_POS, Y_MAX_POS)) {
|
||||
raw[X_AXIS] = temprx;
|
||||
raw[Y_AXIS] = tempry;
|
||||
}
|
||||
}
|
||||
unskew(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -345,6 +345,30 @@ class Planner {
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
|
||||
FORCE_INLINE static void skew(float &cx, float &cy, const float &cz) {
|
||||
if (WITHIN(cx, X_MIN_POS + 1, X_MAX_POS) && WITHIN(cy, Y_MIN_POS + 1, Y_MAX_POS)) {
|
||||
const float sx = cx - (cy * xy_skew_factor) - (cz * (xz_skew_factor - (xy_skew_factor * yz_skew_factor))),
|
||||
sy = cy - (cz * yz_skew_factor);
|
||||
if (WITHIN(sx, X_MIN_POS, X_MAX_POS) && WITHIN(sy, Y_MIN_POS, Y_MAX_POS)) {
|
||||
cx = sx; cy = sy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FORCE_INLINE static void unskew(float &cx, float &cy, const float &cz) {
|
||||
if (WITHIN(cx, X_MIN_POS, X_MAX_POS) && WITHIN(cy, Y_MIN_POS, Y_MAX_POS)) {
|
||||
const float sx = cx + cy * xy_skew_factor + cz * xz_skew_factor,
|
||||
sy = cy + cz * yz_skew_factor;
|
||||
if (WITHIN(sx, X_MIN_POS, X_MAX_POS) && WITHIN(sy, Y_MIN_POS, Y_MAX_POS)) {
|
||||
cx = sx; cy = sy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SKEW_CORRECTION
|
||||
|
||||
#if PLANNER_LEVELING
|
||||
|
||||
#define ARG_X float rx
|
||||
|
Reference in New Issue
Block a user