ID: | 19 |
From: | ge...@igor2.repo.hu |
Date: | Sat, 20 Aug 2016 05:14:38 +0200 (CEST) |
Subject: | Re: [pcb-rnd] Polygon bug (only in windows) |
in-reply-to: | 14 from Evan Foss <ev...@gmail.com> |
Hi Evan, On Fri, 19 Aug 2016, Evan Foss wrote: > Hi Folks, > > I was checking for the bug James reported and unintentionally found > another one. Take a rectangle of copper (silk probably works too) and > drag a corner across it until you get 2 triangles. This causes the > program to crash. Sounds like a self-intersecting polygon. That is illegal in pcb's polygon code. It does try to make you unable to draw such a contour but there are so many ways to edit existing polygons that it's possible to do it. If you compile with --debug, the code will run a lot of extra check so it will catch it as soon as you do it and assert for invalid polygon. If you do this in non-debug compilation it lets the poly live and you get the rendering artifacts (best case) or random crashes elsewhere (worst case). There was a thread about this on the geda-user mailing list. The concluson is something like this: - it's better to keep the requirement of non-self-intersecting polygons, because handling corner cases everywhere in the code (including all current and future HIDs, exporters, etc.) is just too expensive - it'd be better to enable some of the --debug checks in production - in theory it would be also better to split up the self-intersecting poly into multiple canonical polygons; it's not too easy, tho. Generally, I was looking into external polygon clipping libraries - this is a thing core shouldn't try to reimplement. Such a lib would be a good candidate for writing an external utility first for splitting self-intersecting polys and get pcb-rnd to tell the user to run it on the .pcb file if the .pcb file has invalid polygons. So far I couldn't find a suitable lib (requirements: written in C, compatible license, still maintained). Regards, Igor2
Reply subtree:
19 Re: [pcb-rnd] Polygon bug (only in windows) from ge...@igor2.repo.hu