I've discovered that after enabling libgd, it draws the arcs upside-down
with respect to what gschem does.

It appears that libgd has angles starting with 0 degrees on the +ve X
axis (rightmost), and +ve clockwise.

gschem appears to have 0 degrees on the +ve X axis (rightmost), and +ve
ANTI-clockwise (which is more what an electrical engineer might
expect :))

The code before was obviously buggy - look at some of the "if"
statements - so I've re-written it. It appears to work in all cases I
tried.

libgd has a requirement that start_angle < end_angle, and draws
clockwise between the two. It doesn't like -ve angle inputs.

So.. for example, to draw between -10 and 10 degrees, spanning an arc of
20 degrees, you'd pass start_angle = 350 and end_angle = 370.

(I think it also works with start_angle = 350 and end_angle = 10 but the
manual does specifically say end_angle must be greater than start_angle)

*** If you want to wait on this bug, until after the noscreen work
merges - there is already a combined fix for this and noscreen in my
branch (git - not CVS yet) ***

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
diff --git a/libgeda/src/o_arc_basic.c b/libgeda/src/o_arc_basic.c
index 2403d3c..3f11f78 100644
--- a/libgeda/src/o_arc_basic.c
+++ b/libgeda/src/o_arc_basic.c
@@ -1582,24 +1582,17 @@ o_arc_image_write(TOPLEVEL *w_current, O
     color = image_black;
   }
 
-  start_angle = o_current->arc->start_angle;
-  end_angle   = o_current->arc->end_angle;
+  start_angle = 360 - (o_current->arc->end_angle + o_current->arc->start_angle);
+  end_angle   = 360 - o_current->arc->start_angle;
 
-  if ( end_angle < 0) {
-
-    if (end_angle >= 180) {
-      start_angle = (start_angle - (end_angle)) % 360;
-    } else {
-      start_angle = (start_angle + (end_angle)) % 360;
-    }
-
-    end_angle = abs(end_angle);
+  if (start_angle < 0) {
 
+    start_angle = start_angle + 360;
   }
+  if (end_angle < start_angle) {
 
-  end_angle = start_angle + end_angle;
-
-
+    end_angle = end_angle + 360;
+  }
 
 #if DEBUG
   printf("%d %d -- %d %d -- %d %d\n", 
@@ -1609,10 +1602,6 @@ #if DEBUG
          start_angle, end_angle);
 #endif
 
-  if (start_angle < end_angle) {
-
-    start_angle = start_angle + 360;
-  }
 
 #if DEBUG
   printf("%d %d -- %d %d -- %d %d\n", 

_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to