mapbox / polylabel

A fast algorithm for finding the pole of inaccessibility of a polygon (in JavaScript and C++)
Other
1.44k stars 151 forks source link

endless loop when vertices lie on the edge joining two other vertices #91

Closed ecoinomist closed 4 months ago

ecoinomist commented 2 years ago

Please try computing the center of this polygon:

[[-300,-2700],[-300,-2300],[500,-2300],[500,-2872.0465053408525],[1101.5552288470312,-2029.8691849550091],[2700,-2500],[-631187325490387600,-5259894379086588000],[2806.312641353628,64.56245288212403],[1500,500],[1500,700],[1300,700],[-1500,0],[-800,-1400],[-800,-2000],[-1000,-2000],[-1000,-3000]]
mourner commented 4 months ago

Apologies for not responding. Looks like the problem here is not geometric, but rather numerical — one of the points in the example is [-631187325490387600,-5259894379086588000], these kinds of values are just too big for any reasonable amount of computation. I'm inclined to mark this as "won't fix" and close.