tamasmeszaros/libnest2d

Overlaping Polygons Issue

Opened this issue · 7 comments

Why is this polygon of mine overlapping? I'm sure the start point is also the endpoint and is arranged clockwise.
[[ 79.3 173.1]
[ 88.1 173.1]
[ 88.1 181.5]
[107.3 181.5]
[107.3 172.7]
[115.9 172.7]
[115.9 133.5]
[107.3 133.5]
[107.3 125.1]
[ 87.9 125.1]
[ 87.9 133.7]
[ 79.3 133.7]
[ 79.3 173.1]]
out

Different geometry, but I'm having a similar problem where the packed shapes unexpectedly overlap, and also don't respect the minimum distance constraint. Do you have any further insight on this? If you find anything, I'd be interested to know.

@chnadell After carefully reading libnest2D's source code, I realized that their code can only be used for convex polygons. If you want to use a concave polygon, use a convex hull or write more in the source code.

Ah that is good to know. I am even having trouble with convex polygons, e.g., here is a 2d projection where packed hexagons overlap:
packed_polygons_001

Screenshot 2024-09-09 100504
Screenshot 2024-09-06 163558

The same problem is occurring. If you have any solution, please let me know.

I think your polygons are not convex polygons

any solution for concave polygons?