Fast, Constant-Time Sphere Indexing
donw.io
donw.io
Usually, subdividing the faces of a Platonic solid is the way to go. This post describes tessellation of triangles on the faces of an octahedron. The dual approach is squares on the faces of a cube. A good implementation of this is s2 [1].
And in case someone is interested in the Spherical Fibonacci Mapping mentioned in the article, here [2] is a non-broken link to the paper.
[1] https://www.microsoft.com/en-us/research/wp-content/uploads/...
[2] https://docplayer.net/40493580-Spherical-fibonacci-mapping.h...
I had a 360x180 sphere of values, and I needed to rotate the sphere in some combination of translations. I did this by converting the az/el/value triplets to Cartesian XYZ and multiplying by a rotation matrix.
However, when I tried to convert the translated values back to a rotated az/el/value result, the results broke due to what was effectively lat/lon narrowing (ie, 1x1-degree cells are smaller nearer the "poles", so the rotations didn't map evenly).
After research, I settled on using HTM. I was able to borrow the C code from some MySQL extension that implemented HTM (looks like it's at https://github.com/smonkewitz/scisql ), then use that math to more reliably convert the rotated values back to an appropriate az/el/value result.
Still one of the neatest problems I ever solved.
(2) Math being directly applied to near-hardware level, the GPU, with a good explanation.
What's not to love?
Anyway, neat article, the interactive diagrams are very nice.