From d68fe1307f4f98aa51844bbf378d5d0a9467b8b2 Mon Sep 17 00:00:00 2001 From: Werner Hoch Date: Sun, 24 Feb 2008 10:24:13 +0100 Subject: [PATCH] libgeda: bugfix for bounding box calculation of mirrored arcs A mirrored arc has a negative sweep angle (called end_angle). This wasn't properly catched in the bounding box calculation. Bug reported by Kai-Martin Knaak on geda-user mailing list. --- libgeda/src/o_arc_basic.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libgeda/src/o_arc_basic.c b/libgeda/src/o_arc_basic.c index 06aa8be45..0055beecc 100644 --- a/libgeda/src/o_arc_basic.c +++ b/libgeda/src/o_arc_basic.c @@ -566,7 +566,15 @@ void world_get_arc_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, * The previous rectangle is extended to the final one * by checking whether the arc is over a main axis (vertical or horizontal). * If so, the rectangle is extended in these directions. + * + * In the mirror mode, the sweep angle is negativ. To get a + * CCW arc before this calculation we have to move the + * start angle to the end angle and reverse the sweep angle. */ + if (end_angle < 0) { + start_angle = (start_angle + end_angle + 360) % 360; + end_angle = -end_angle; + } angle = ((int) (start_angle / 90)) * 90; for(i = 0; i < 4; i++) { angle = angle + 90; -- 2.11.4.GIT