polygon-clipping
polygon-clipping copied to clipboard
Union is incomplete
test("incomplete fusion", t => { const clippings = [[[[-0.0842,0.0451],[0.09,0.0269],[0.09,0.0376],[0.0268,0.0485],[-0.0842,0.0525],[-0.0842,0.0451]]], [[[0.09,0.0059],[0.09,0.0269],[0.0056,0.0357],[0.09,0.0059]]], [[[0.09,-0.0063],[0.09,0.0059],[0.0056,0.0357],[-0.0842,0.0451],[0.09,-0.0063]]]]; const result = polygonClipping.union(...clippings); t.deepEqual( result, [[[[-0.0842,0.0451],[0.09,-0.0063],[0.09,0.0269],[0.0056,0.0357],[-0.0842,0.0451]]], [[[-0.0842,0.0451],[0.09,0.0269],[0.09,0.0376],[0.0268,0.0485],[-0.0842,0.0525],[-0.0842,0.0451]]]]); });
I'd expect to see a single polygon in the result, but I see two. It seems like it didn't merge an edge which was tiled by two adjacent polygons.
Looks like the library handles missing T-junction cases fine in general, so I guess this is something more subtle.
I've reproduced the error on my side. Something odd is happening... I haven't seen this behavior before. thanks for the bug!