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

Label positioning is wrong on rooms that aren't perfectly square? #58

Closed iomturner closed 4 years ago

iomturner commented 4 years ago

@mourner if you remember I previously posted having issues with L shaped rooms (https://github.com/mapbox/polylabel/issues/55) where you told me to decrease the tolerance to 0.00001. But now I noticed another issue with rooms that aren't perfectly square:

https://stackblitz.com/edit/mapbox-simple-map-cbnty5?file=index.ts

Screen Shot 2020-03-24 at 1 27 42 PM

not sure if this helps but i also posted this when i zoomed into the points:

Screen Shot 2020-03-24 at 1 39 38 PM
iomturner commented 4 years ago

i have noticed out of the two rooms/ squares. there are not 100% aligned into a rectangle... and with the tolerance level so low it off centers the label... sigh how do I get the labels center for complex shapes without lowing the tolerance too much that it becomes broken on rectangles not 100% aligned...

mourner commented 4 years ago

Duplicate of #33