Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Another advantage of triangle grids: they work great for spherical maps, whether that sphere's mesh derives from a tetrahedron or octahedron or icosahedron. You'd need some fancier logic for movements around the edges of the "sphere's" base mesh, but once that's solved you're golden.


A really nice thing about this is there exists a continuous space-filling curve over a tetrahedron[1] where the end connects back to the start, like a Moore curve for squares. There's a clever way to use this curve to calculate the surface distance between two cells on the tetrahedron, and it works at arbitrary precision, requiring only 2-bits per granularity to identify cells. It's great for spatial indexing as you can use a quadtree.

[1]:https://www.youtube.com/watch?v=pw_50szQfA0


That's indeed something I'm planning on using for my own very-WIP attempt at a spherical-map strategy game (except with an icosahedron instead of tetrahedron as the starting point), for those exact reasons :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: