tidwall / geojson

GeoJSON for Go. Used by Tile38
MIT License
130 stars 28 forks source link

Fix wrong result in case of circle containing circle #27

Closed undeadcat closed 1 month ago

undeadcat commented 5 months ago

I believe there was a bug in the case of calling Contains with two circles.

The test that was failing was:

expect(t, !g.Contains(NewCircle(g.Center(), g.meters*3, 64)))

Rest of tests cases added for completeness only. Went with haversine comparison as it didn't have floating point error when comparing with the same circle: expect(t, g.Contains(g))

Happy to make any changes (or just treat this PR as an illustration of the bug, feel free to close it :-))