polygon-clipping icon indicating copy to clipboard operation
polygon-clipping copied to clipboard

Union is incomplete

Open pentacular opened this issue 4 years ago • 2 comments

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.

pentacular avatar Aug 18 '19 13:08 pentacular

Looks like the library handles missing T-junction cases fine in general, so I guess this is something more subtle.

pentacular avatar Aug 18 '19 14:08 pentacular

I've reproduced the error on my side. Something odd is happening... I haven't seen this behavior before. thanks for the bug!

mfogel avatar Aug 20 '19 15:08 mfogel