[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: rant: pcb print from command line



On Mon, Mar 8, 2010 at 5:50 PM, DJ Delorie <dj@xxxxxxxxxxx> wrote:
>
>> When djopt is then run, it splits the overshooting line to create a
>> good line plus a 0.01 thou long "freckle".
>
> Perhaps it shouldn't do that, then :-)
>
> But keep the other code too, in case someone else does it.

OK, here's an updated patch with a more detailed explanatory comment:

diff --git a/src/djopt.c b/src/djopt.c
index 68b3641..3e85a62 100644
--- a/src/djopt.c
+++ b/src/djopt.c
@@ -75,6 +75,10 @@ RCSID ("$Id$");
 #define ORIENT(x) ((x) & 0xf0)
 #define DIRECT(x) ((x) & 0x0f)

+/* square of the length of the longest "freckle" */
+#define LONGEST_FRECKLE	3
+#define SQ(x)		((x) * (x))
+
 struct line_s;

 typedef struct corner_s
@@ -1230,6 +1234,33 @@ simple_optimize_corner (corner_s * c)
 	}
     }
   check (c, 0);
+  if (c->n_lines == 1 && !c->via)
+    {
+      corner_s *c0 = other_corner (c->lines[0], c);
+      if (SQ(c->x - c0->x) + SQ(c->y - c0->y) < LONGEST_FRECKLE)
+	{
+          /*
+           * Remove this line, as it is a "freckle".  A freckle is an extremely
+           * short line (around 0.01 thou) that is unconnected at one end.
+           * Freckles are almost insignificantly small, but are annoying as
+           * they prevent the mitering optimiser from working.
+           * Freckles sometimes arise because of a bug in the autorouter that
+           * causes it to create small overshoots (typically 0.01 thou) at the
+           * intersections of vertical and horizontal lines. These overshoots
+           * are converted to freckles as a side effect of canonicalize_line().
+           * Note that canonicalize_line() is not at fault, the bug is in the
+           * autorouter creating overshoots.
+           * The autorouter bug arose some time between the 20080202
and 20091103
+           * releases.
+           * This code is probably worth keeping even if the autorouter bug is
+           * fixed, as "freckles" could conceivably arise in other ways.
+           */
+	  dprintf ("freckle %d,%d to %d,%d\n",
+		   c->x, c->y, c0->x, c0->y);
+	  move_corner (c, c0->x, c0->y);
+	}
+    }
+  check (c, 0);
   return rv;
 }


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user