From e79666a82b7fd907ed0210c034342f851daad1b8 Mon Sep 17 00:00:00 2001 From: Robby Candra Date: Fri, 11 Oct 2019 09:16:37 +0700 Subject: [PATCH] Followup to "Fix G2/G3 rounding" (#15510) --- Marlin/src/gcode/motion/G2_G3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index edace2b63e..6fecbdc0cc 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -290,8 +290,8 @@ void GcodeSuite::G2_G3(const bool clockwise) { len = d2.magnitude(), // Distance to mid-point of move from current 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 - const xy_pos_t s = { -d2.y, d2.x } / len; // Unit vector along perpendicular bisector - arc_offset = d2 + s * e * h; // The calculated offset (mid-point if |r| <= len) + const xy_pos_t s = { -d2.y, d2.x }; // Perpendicular bisector. (Divide by len for unit vector.) + arc_offset = d2 + s / len * e * h; // The calculated offset (mid-point if |r| <= len) } } }