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

Re: gEDA-user: PCB DRC crash with due to bloat / shrink breaking gemoetry



On 9/12/10, Peter Clifton <pcjc2@xxxxxxxxx> wrote:
> On Sun, 2010-09-12 at 06:57 +0000, ineiev wrote:
>> Peter Clifton wrote:
>> > I think the rule it is triggering on in this case is probably bogus, and
>> > the "Shrink" parameter should not apply to a pad solid inside a polygon.
>>
>> IMHO DRC should report an error if pad width is less than minimum trace
>> width.
...
> I'm still not sure the DRC check is correct though.

It probably would be more correct when the pad is merged
into a polygon to check whether the width of the resulting copper
is more than minimum, however, PCB code seems to lack proper
routines to check this. For example, DRC happily ignores
"Potential for broken trace" in the attached file due
to incorrect check in IsPolygonInPolygon:

/* first check if both bounding boxes intersect. If not, return quickly */
  if (P1->Clipped->contours->xmin - Bloat > P2->Clipped->contours->xmax ||
      P1->Clipped->contours->xmax + Bloat < P2->Clipped->contours->xmin ||
      P1->Clipped->contours->ymin - Bloat > P2->Clipped->contours->ymax ||
      P1->Clipped->contours->ymax + Bloat < P2->Clipped->contours->ymin)
    return false;

The check only works in some cases when the overlapping areas of
the polygons touch the bounding box limits.

And this is a different misfeature.

> Also, we'll have to
> do a cursory scan to ensure that nothing  is trying to call with x2 < x1
> or y2 < y1. I realise there are/were asserts to this effect, but since
> hardly anyone build PCB with debugging asserts disabled, you can never
> be 100% sure!

Or ensure that the results of RectPoly are checked. I find single
place to modify:
diff --git a/src/polygon.c b/src/polygon.c
index 586e8cc..108b585 100644
--- a/src/polygon.c
+++ b/src/polygon.c
@@ -1644,12 +1644,13 @@ r_NoHolesPolygonDicer (POLYAREA * pa,
     }
   else
     {
-      POLYAREA *poly2, *left, *right;
+      POLYAREA *poly2, *left = pa, *right = NULL;

       /* make a rectangle of the left region slicing through the
middle of the first hole */
       poly2 = RectPoly (p->xmin, (p->next->xmin + p->next->xmax) / 2,
                         p->ymin, p->ymax);
-      poly_AndSubtract_free (pa, poly2, &left, &right);
+      if (poly2)
+	poly_AndSubtract_free (pa, poly2, &left, &right);
       if (left)
         {
           POLYAREA *cur, *next;

Kind regards,
Ineiev

Attachment: poly.pcb
Description: Binary data


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