Cleaning straight lines results in empty path
Boolean operations and offsetting library in Javascript
Brought to you by:
timo23414
Cleaning straight lines results in empty path.
// Random path between 2 points
var pathA = ClipperLib.Clipper.CleanPolygons([[
{ X: 12, Y: 34 },
{ X: 56, Y: 78 }
]], 1);
// pathA = [[]]
// Straight line
var pathB = ClipperLib.Clipper.CleanPolygons([[
{ X: 10, Y: 10 },
{ X: 20, Y: 20 },
{ X: 30, Y: 30 },
{ X: 40, Y: 40 }
]], 1);
// pathB = [[]]
// L shape
var pathC = ClipperLib.Clipper.CleanPolygons([[
{ X: 10, Y: 10 },
{ X: 10, Y: 20 },
{ X: 20, Y: 20 }
]], 1);
// pathC = [[ { X: 10, Y: 10 }, { X: 10, Y: 20 }, { X: 20, Y: 20 } ]] // Expected
This may not be a highly used use case as straight lines can only be open polygons but I don't think this is the intended behaviour.