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

gEDA-user: More on the polygon bugs



I've now officially spent way WAY too much time looking into this, but
here's what I've found:

The problems happen when the polygon clearing code tries to remove a
region.   In this case, a temporary rounded rectangle with the shape of
a pad + clearance.  A line in the existing polygon (the remaining part
of the partially cleared copper polygon) that SHOULD intersect this
polygon does not.  So a line which should get a new vertex in the middle
stays whole.  Then, inside some code I still haven't tried to figure
out, the attempt to collect the new set of contours and holes goes wrong
because of the missing vertex (the line can't be trimmed right).

The reason the lines do not intersect is that the FIRST time the pad
was cleared (remember, the first thing I found to avoid this was to fix
the multi-clearing of pads), two lines fully crossed in an 'X'.  A point
in an *integer coordinate system* was chosen to be the crossing point.
Each line is now two lines, going to that point.  So far, the roundoff
isn't that scary.  In the trimming, X becomes something like > (with
some of the segments deleted).  Now the duplicate subtraction comes
along to intersect > with /, only the point of the > doesn't actually
quite reach the /, so the / doesn't get split into two segments.  Then
you get problems.  Trying to bandaid that causes problems by creating
duplicate intersections elsewhere.

Part of the reason this happens so often is that there are a lot of
lines floating around with verrrry shallow angles just off vertical or
horizontal.  That causes the rounding of the intersection to be much
more significant in the shallow axis.  Where do these lines come from?
Back to the duplicate pad subtraction...  It turns out RoundRect (and
most things that call frac_circle) generate slightly wonky polygons.
frac_circle doesn't turn quite 90 degrees, so the sides of the pad
clearances are all slightly twisted.  This caught my eye while I was
looking at polygons at about 10000% magnification to see intersection
points and I didn't realize the mathematical implications of the
asthetically displeasing corners for a while.  If you fix RoundRect, you
can even get away with some double-pad-subtraction that blew up before,
becuase the resulting horizontal and vertical lines are less prone
to rounding errors when intersected with other lines.

If you have boards that still cause problems after applying the multi-
pad-sub patch I sent out, mail them to me and I'll see if this fixes
them.

(by the way, holes in the mask aren't rounded, so there's another reason
to tighten up your masks!  A perfectly aligned mask equal to the clearance
would *always* leave an arc of copper exposed).

-- 
Ben Jackson AD7GD
<ben@xxxxxxx>
http://www.ben.com/


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