pcb-rnd knowledge pool

 

unfixable polygon rat bug

polyratbug by Tibor 'Igor2' Palinkas on 2017-11-03

Tags: insight, bug, polygon, rat, circle

node source

 

 

Abstract: Unfixable bug: instead of the circular rat mark that indicates the pin is within the poly it tries to connect to, a rat line is drawn to a corner of the poly. Background.

 

The following tricky polygon vs. rat bug was reported by Evan Foss, among with the minimal test file that reporuces it.

After some debugging I figured this is "by design" in the polygon code and can not be fixed. IRC log:


when trying to check whether the point is within the polygon, it ignores holes
else it would never say it's within the poly, because it's always sitting in a clearance cutout hole, that's why it's not connected in the first place
makes sense
but look at your example
is it in a hole?
turn off silk
turn off pins/pads
zoom in, zoom in a lot
and you will find: it's not a hole, because the clearances all merged and they reached the outer contour of the poly
to keep the poylgon well behaved (and thus easy to process for all parts of the code!), the poly code has guarantees for a few things
one of the guarantees is that a hole is always fully within the polygon
a hole can't touch the contour
if the hole touches the contour, it's not a hole any more
instead the contour of the poly got more complex, and there are no holes
exactly what you see here, and your pin is sitting in the middle of an U
so unfortunately this is something I can not fix
because it's impossible to distinguish the case when we are sitting in the U because of clearance cutouts from the case when it's the polygon's shape as desribeed by the user, or by other object's clearances