polygon-clipping: Error: Unable to find segment <...> in SweepLine tree

Performing a union() on these shapes results in the following error being thrown:

Error: Unable to find segment #203 [-91.4137213, 29.5316244] -> [-91.41360941065206, 29.53135] in SweepLine tree. Please submit a bug report.
    at SweepLine.process (webpack://polygon-clipping/./src/sweep-line.js?:58:24)
    at Operation.run (webpack://polygon-clipping/./src/operation.js?:89:35)
    at Object.union (webpack://polygon-clipping/./src/index.js?:18:30)
    at Object.doIt (/Users/mfogel/attm/geojson-clipping/src/lib.js:111:46)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for the library! I just wanted to let you know that I’m still running into this issue in v0.12.2. An example:

Error: Unable to find segment #20721 [55.30656169817111, -0.2354412611228236] -> #20708 [55.306561698171116, -0.23544126112283084] in SweepLine tree. Please submit a bug report.
    at SweepLine.process (polygon-clipping.umd.js?cd87:2492)
    at Operation.run (polygon-clipping.umd.js?cd87:2687)
    at Object.intersection (polygon-clipping.umd.js?cd87:2723)

from a simple intersection() of two triangles:

polygonClipping.intersection(
    [[[45.453725638212774, -12.137388821597067],
    [-55.272182946591585, 72.37275533915876],
    [-85.90794231648893, 39.94558857427045]]],
    [[[55.306561698171116, -0.23544126112283084],
    [-32.420524023851065, 55.25973972178699],
    [-54.0332884780095, 31.725063385193412]]]);