HNHacker News
TopNewBestAskShowJobs

s2mcallis

10 karma · joined March 13, 2022

submissionscomments
s2mcallis··on Show HN: TG – Fast geometry library for C
Yeah we're spherical mostly because working in spherical coordinates let's you not have to worry about the projection. S2Cells are really just nodes in a quadtree, the difference being our quad tree is implicit, you can (and we do) store them in a linear array in memory.
s2mcallis··on Show HN: TG – Fast geometry library for C
Howdy, I work on S2 [1] so I have questions! How do you deal with polygons that cross the antimeridian?

The indexing structure you've come up with seems very interesting. In spherical coordinates line sweep algorithms like that are a little less intuitive because there's not really a min and max y value to work with. Does your index support multiple polygons indexed together?

The lack of exact predicates worries me a little bit. It's tricky because it will work right until it doesn't for mysterious reasons, and it's very hard to test for if you haven't built it on a foundation of exact predicates. You'll periodically fall into the fractal foam around edges when testing if you cross them or not ([2] has some good pictures). We do this in S2 by relying on a set of predicates [3] that fall all the way back to symbolic perturbation if they have to. We simply don't have to think about colinear points in S2 for that reason.

[1] https://s2geometry.io/ [2] https://github.com/mourner/robust-predicates [3] https://github.com/google/s2geometry/blob/master/src/s2/s2pr...

s2mcallis··on When Double Precision Is Not Enough
I'd be interested in hearing if you have more info on this.
s2mcallis··on Ask HN: Google employees do you have a better version of Google internally?
We have a parallel copy that indexes our intranet but other than that we use the same one everyone else does.
s2mcallis··on S2: Computational geometry and spatial indexing on the sphere
S2 wouldn't be a bad choice, it lets you compute "coverings" of arbitrary regions as S2 cells, with variable resolution. Fixed size is trickier but is probably doable, especially if you're allowed to null out unused cells. Check out https://s2.sidewalklabs.com/regioncoverer/