Ok, I've got this so far then.  Still have to bloat the pads to force
them to overlap, else pads intersecting the edges of polygons don't
get picked.  We *still* miss pads that are within minspace of the edge
of a polygon but neither intersect nor plow into the polygon.

Index: find.c
===================================================================
RCS file: /cvsroot/pcb/pcb/src/find.c,v
retrieving revision 1.70
diff -p -U3 -r1.70 find.c
--- find.c      21 Dec 2008 04:17:49 -0000      1.70
+++ find.c      30 Dec 2008 02:55:20 -0000
@@ -2498,15 +2498,15 @@ IsArcInPolygon (ArcTypePtr Arc, PolygonT
  * - check the two end points of the line. If none of them matches
  * - check all segments of the polygon against the line.
  */
+
+/* This one returns TRUE if a line is over a polygon - that is, if it
+   would touch it if only it didn't clear polygons.  */
 Boolean
-IsLineInPolygon (LineTypePtr Line, PolygonTypePtr Polygon)
+IsLineOverPolygon (LineTypePtr Line, PolygonTypePtr Polygon)
 {
   BoxTypePtr Box = (BoxType *) Line;
   POLYAREA *lp;
 
-  /* lines with clearance never touch polygons */
-  if (TEST_FLAG (CLEARPOLYFLAG, Polygon) && TEST_FLAG (CLEARLINEFLAG, Line))
-    return False;
   if (!Polygon->Clipped)
     return False;
   if 
(TEST_FLAG(SQUAREFLAG,Line)&&(Line->Point1.X==Line->Point2.X||Line->Point1.Y==Line->Point2.Y))
@@ -2532,6 +2532,19 @@ IsLineInPolygon (LineTypePtr Line, Polyg
   return False;
 }
 
+/* This one is for electrical connectivity.  */
+Boolean
+IsLineInPolygon (LineTypePtr Line, PolygonTypePtr Polygon)
+{
+  BoxTypePtr Box = (BoxType *) Line;
+  POLYAREA *lp;
+
+  /* lines with clearance never touch polygons */
+  if (TEST_FLAG (CLEARPOLYFLAG, Polygon) && TEST_FLAG (CLEARLINEFLAG, Line))
+    return False;
+  return IsLineOverPolygon (Line, Polygon);
+}
+
 /* ---------------------------------------------------------------------------
  * checks if a pad connects to a non-clearing polygon
  *
@@ -2543,6 +2556,14 @@ IsPadInPolygon (PadTypePtr pad, PolygonT
     return IsLineInPolygon ((LineTypePtr) pad, polygon);
 }
 
+/* Same, but doesn't return FALSE just because the pad clears
+   polygons.  */
+Boolean
+IsPadOverPolygon (PadTypePtr pad, PolygonTypePtr polygon)
+{
+    return IsLineOverPolygon ((LineTypePtr) pad, polygon);
+}
+
 /* ---------------------------------------------------------------------------
  * checks if a polygon has a connection to a second one
  *
@@ -3641,7 +3662,7 @@ drc_callback (DataTypePtr data, LayerTyp
       break;
     case PAD_TYPE:
       if (pad->Clearance < 2 * PCB->Bloat)
-       if (IsPadInPolygon(pad,polygon))
+       if (IsPadOverPolygon(pad,polygon))
          {
            AddObjectToFlagUndoList (type, ptr1, ptr2, ptr2);
            SET_FLAG (TheFlag, pad);
@@ -3768,6 +3789,10 @@ DRCAll (void)
   TheFlag = (IsBad) ? DRCFLAG : (FOUNDFLAG | DRCFLAG | SELECTEDFLAG);
   ResetConnections (False);
   TheFlag = SELECTEDFLAG;
+  /* These ensure that pins/pads which clear polygons near the edge,
+     are still considered to be "in" the polygon.  */
+  Bloat = 2 * PCB->Bloat + 1;
+  fBloat = 2 * PCB->Bloat + 1;
   /* check minimum widths and polygon clearances */
   if (!IsBad)
     {


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

Reply via email to