KLayout / klayout

KLayout Main Sources
http://www.klayout.org
GNU General Public License v3.0
789 stars 203 forks source link

Internal error: ../../../src/db/db/dbPolygonTools.cc:489 _cut_polygon_internal (poly, line, right_of_line) was not true #166

Closed lukasc-ubc closed 6 years ago

lukasc-ubc commented 6 years ago

In KLayout 0.25.4, MacOS:

wg_loss_zep2.DXF.zip

Edit: It would be nice if there was a utility that checked for strange polygon things, such as in the above layout. By doing a "Size Shape" 0.001 and -0.001, I was able to get it to save.

klayoutmatthias commented 6 years ago

Hi Lukas,

This error means the polygon cut algorithm which reduces the number of points down to the maximum allowed number encountered a weired situation it cannot resolve. If you used boolean operations, these situations should not arise as the resulting polygons are merged. I'll check the test case. Thanks for providing it.

DXF works because it does not have a maximum vertex count. The same holds for OASIS and CIF.

Best regards,

Matthias

klayoutmatthias commented 6 years ago

Hi Lukas,

I was able to fix the issue. The reason was actually a rounding issue: the small gaps that appear in the output are sometimes closed when the polygon cut algorithm splits the polygons due to cut-point snapping. This induces a topology change that the algorithm is not expecting. I can fix this by using a higher precision internally.

I can now save your layout even with a max vertex count of 4 which gives a funny fractured layout. But XOR-wise it's (almost, within 1 DBU) the same than the original :-)

Matthias