Menu

#24 Cleaning straight lines results in empty path

1.0
open
nobody
None
2017-10-05
2017-10-05
Anonymous
No

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.

Discussion


Log in to post a comment.