On Wed, 2008-05-21 at 09:06 +0100, Robert Fitzsimons wrote:
> The clearance polygon created around an angled square pad doesn't
> correctly follow the angle of pad, instead a non-angled round-corner
> rectangle is produced based on the extents of the square pad.  The
> following patch will produce a suitably angled rounded-corner rectangle
> around the square pad.
> 
> Robert

I remember debating this one before, it is intentional I think. The
clearance gap between the pad and the mask should be the same distance
all the way around.

I was unsure, but DJ convinced me.. this is right if the process
registration tolerance is just some normally distributed offset in both
the X and Y directions (independently).

I do agree that a square mask cutout would allow slightly more
registration error, e.g. maximum offset in X _and_ Y directions
simultaneously, for little loss otherwise.

Another consideration though, square mask cutouts are what other tools
seem to use. (This said, some use octagonal cutouts around round holes).


> Index: src/polygon.c
> ===================================================================
> RCS file: /cvsroot/pcb/pcb/src/polygon.c,v
> retrieving revision 1.59
> diff -u -r1.59 polygon.c
> --- src/polygon.c     2 Dec 2007 09:35:40 -0000       1.59
> +++ src/polygon.c     21 May 2008 07:43:17 -0000
> @@ -451,6 +451,77 @@
>    return np;
>  }
>  
> +/* make a rounded-corner rectangle */
> +POLYAREA *
> +SquarePadPoly (PadType * pad)
> +{
> +  PLINE *contour = NULL;
> +  POLYAREA *np = NULL;
> +  Vector v;
> +  double d;
> +  double tx, ty;
> +  double cx, cy;
> +  PadType _t=*pad,*t=&_t;
> +  PadType _c=*pad,*c=&_c;
> +  int halfthick = (pad->Thickness + 1) / 2;
> +  int halfclear = (pad->Thickness + pad->Clearance + 1) / 2;
> +
> +  d =
> +    sqrt (SQUARE (pad->Point1.X - pad->Point2.X) +
> +          SQUARE (pad->Point1.Y - pad->Point2.Y));
> +  if (d != 0)
> +    {
> +      double a = halfthick / d;
> +      tx = (t->Point1.Y - t->Point2.Y) * a;
> +      ty = (t->Point2.X - t->Point1.X) * a;
> +      a = halfclear / d;
> +      cx = (c->Point1.Y - c->Point2.Y) * a;
> +      cy = (c->Point2.X - c->Point1.X) * a;
> +    }
> +  else
> +    {
> +      tx = halfthick / 2;
> +      ty = 0;
> +      cx = halfclear / 2;
> +      cy = 0;
> +    }
> +
> +  t->Point1.X -= ty;
> +  t->Point1.Y += tx;
> +  t->Point2.X += ty;
> +  t->Point2.Y -= tx;
> +  c->Point1.X -= cy;
> +  c->Point1.Y += cx;
> +  c->Point2.X += cy;
> +  c->Point2.Y -= cx;
> +
> +  v[0] = c->Point1.X - tx;
> +  v[1] = c->Point1.Y - ty;
> +  if ((contour = poly_NewContour (v)) == NULL)
> +    return 0;
> +  frac_circle (contour, (t->Point1.X - tx), (t->Point1.Y - ty), v, 4);
> +
> +  v[0] = t->Point2.X - cx;
> +  v[1] = t->Point2.Y - cy;
> +  poly_InclVertex (contour->head.prev, poly_CreateNode (v));
> +  frac_circle (contour, (t->Point2.X - tx), (t->Point2.Y - ty), v, 4);
> +
> +  v[0] = c->Point2.X + tx;
> +  v[1] = c->Point2.Y + ty;
> +  poly_InclVertex (contour->head.prev, poly_CreateNode (v));
> +  frac_circle (contour, (t->Point2.X + tx), (t->Point2.Y + ty), v, 4);
> +
> +  v[0] = t->Point1.X + cx;
> +  v[1] = t->Point1.Y + cy;
> +  poly_InclVertex (contour->head.prev, poly_CreateNode (v));
> +  frac_circle (contour, (t->Point1.X + tx), (t->Point1.Y + ty), v, 4);
> +
> +  /* now we have the line contour */
> +  if (!(np = ContourToPoly (contour)))
> +    return NULL;
> +  return np;
> +}
> +
>  /* clear np1 from the polygon */
>  static int
>  Subtract (POLYAREA * np1, PolygonType * p, Boolean fnp)
> @@ -583,13 +654,8 @@
>  
>    if (TEST_FLAG (SQUAREFLAG, pad))
>      {
> -      BDimension t = pad->Thickness / 2;
> -      LocationType x1, x2, y1, y2;
> -      x1 = MIN (pad->Point1.X, pad->Point2.X) - t;
> -      x2 = MAX (pad->Point1.X, pad->Point2.X) + t;
> -      y1 = MIN (pad->Point1.Y, pad->Point2.Y) - t;
> -      y2 = MAX (pad->Point1.Y, pad->Point2.Y) + t;
> -      if (!(np = RoundRect (x1, x2, y1, y2, pad->Clearance / 2)))
> +      if (!
> +          (np = SquarePadPoly (pad)))
>          return -1;
>      }
>    else
> 
> 
> 
> 
> _______________________________________________
> geda-dev mailing list
> [email protected]
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
-- 
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!)



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

Reply via email to