polygon-clipping
polygon-clipping copied to clipboard
Error: Unable to complete output ring
I'm getting the following exception and I'm not sure why. The input looks good to me.
Error: Unable to complete output ring starting at [0, 56]. Last matching segment found ends at [0.7000000000000001, 55.6].
Here's what I am passing as input, it is 100% reproducible for me:
const polygon = [[
[[0,56],[4,56],[4,60],[0,60],[0,56]],
[[0.5,56.4],[0.5,56.6],[1.5,56.6],[1.5,56.4],[0.5,56.4]]
]];
const clip = [[
[2.3000000000000003,55.6],
[0.7000000000000001,55.6],
[0.6999999999999998,56.4],
[2.3,56.4],
[2.3000000000000003,55.6]
]];
return difference(polygon, clip);
Works fine with other inputs, just this particular set of polys causes the problem.