1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 21:36:21 +00:00

Followup to "Fix G2/G3 rounding" (#15510)

This commit is contained in:
Robby Candra 2019-10-11 09:16:37 +07:00 committed by Scott Lahteine
parent b20d5a7cc6
commit e79666a82b

View File

@ -290,8 +290,8 @@ void GcodeSuite::G2_G3(const bool clockwise) {
len = d2.magnitude(), // Distance to mid-point of move from current len = d2.magnitude(), // Distance to mid-point of move from current
h2 = (r - len) * (r + len), // factored to reduce rounding error h2 = (r - len) * (r + len), // factored to reduce rounding error
h = (h2 >= 0) ? SQRT(h2) : 0.0f; // Distance to the arc pivot-point from midpoint h = (h2 >= 0) ? SQRT(h2) : 0.0f; // Distance to the arc pivot-point from midpoint
const xy_pos_t s = { -d2.y, d2.x } / len; // Unit vector along perpendicular bisector const xy_pos_t s = { -d2.y, d2.x }; // Perpendicular bisector. (Divide by len for unit vector.)
arc_offset = d2 + s * e * h; // The calculated offset (mid-point if |r| <= len) arc_offset = d2 + s / len * e * h; // The calculated offset (mid-point if |r| <= len)
} }
} }
} }