From 5c1eb595e6572f6eb739c16269fa4aaf27233524 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 3 Oct 2016 14:48:44 -0500 Subject: [PATCH] Fix for G2/G3 negative radius As suggested in #4940 --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 145a171ca8..5b2f5d2d33 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2796,7 +2796,7 @@ inline void gcode_G0_G1( x1 = current_position[X_AXIS], y1 = current_position[Y_AXIS], x2 = destination[X_AXIS], y2 = destination[Y_AXIS]; if (r && (x2 != x1 || y2 != y1)) { - const float e = clockwise ? -1 : 1, // clockwise -1, counterclockwise 1 + const float e = clockwise ^ (r < 0) ? -1 : 1, // clockwise -1/1, counterclockwise 1/-1 dx = x2 - x1, dy = y2 - y1, // X and Y differences d = HYPOT(dx, dy), // Linear distance between the points h = sqrt(sq(r) - sq(d * 0.5)), // Distance to the arc pivot-point