martinez: A case where intersection is incorrect

Hi,

I am not sure if it is due to the polygons are self-intersecting, or that the borders are overlapping, but I have a case where the intersection (as well as most of the other operations) give incorrect results.

The polygons used: var p0_x = [ [ [0,0], [0,1], [1,0], [1,1], [0,0] ] ]; var p1_x = [ [ [0, 0.5], [0, 1.5], [1, 0.5], [1, 1.5], [0, 0.5] ] ];

Using the pen by AtiX (thx:) - screen shot 2016-09-08 at 14 34 15

Gives an intersection - screen shot 2016-09-08 at 14 36 17

and union - screen shot 2016-09-08 at 14 37 20

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 35 (18 by maintainers)

Most upvoted comments

FYI, I am splicing world map into vector tiles, then I went into this problem. The connection with this issue is the overlapping edge. I have added a buffer to avoid overlapping edges, but it would be good that this bug be fixed~ Cheers!

This case cause infinite loop:

martinez.intersection([[[-180,-16.96624016044842],[-179.99279992799933,-16.955822640501808],[-179.98919989199896,-16.94714137387956],[-179.9351993519936,-16.90026253411949],[-179.90279902799034,-16.87595498757723],[-179.81999819998205,-16.780461054732626],[-179.8523985239853,-16.691912135185817],[-179.86319863198636,-16.67975836191468],[-179.89199891998925,-16.686703375212474],[-179.92799927999286,-16.709274668430282],[-179.93879938799392,-16.716219681728077],[-180,-16.787406068030354],[-180,-16.96624016044842]]], [[[-180,0],[-180,-45],[-135,-45],[-135,0],[-180,0]]])