-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From Icosahedron to Base Cells. #701
Comments
The process of indexing from lat,lng to cell (hex) ID has some documentation in the internals section of the website: https://h3geo.org/docs/core-library/latLngToCellDesc The layout of each icosahedron face is shown in https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates You may want to look at a rendering of the worldwide H3 grid, such as at the top of this post: https://www.uber.com/blog/h3/ Sadly that does not have the icosahedron edges overlaid on it too, but each of the 12 icosahedron vertexex is located at the center of each pentagon shown there. |
Each face is split into:
|
Yes, including these pictures into the official documentation would clearify how these hexagons are layed on top of the icosahedron faces. As well as the textual description you gave next. Especially the third picture is clearifying, I would also recommend adding some further information to clearly explain that this is indeed at resolution 0, at least that is what I think it is. Bonus would be how to mathematically or table-wise or algorithmetically reconstruct it :) |
Note that in addition to the 7-fold per resolution enhancement ("aperture 7") used in the indexed H3 resolutions, the theory of hexagonal discrete global grids also uses aperture 4 and aperture 3 enhancements. Begin with 12 pentagons centered on the vertices of the icosahedron (these do tile the sphere; they form a dodecahedron, which is the dual of an icosahedron). Then perform a single aperture 3 and a single aperture 4 enhancement. That gives you the 122 base cells.
The rotation is necessary in aperture 7 to maintain the cell center points as the resolution increases (a "central place" grid). You could construct a central place grid that maintained the same orientation across all resolutions using just aperture 4. One such grid is the ISEA4H grid available in |
What I find weird about Uber H3 is how it starts with 122 base cells, 110 of which are hexagons and 12 of which are pentagons.
Then the documentation mentions it's based on "icosahedron" which has 12 vertices and 20 triangles.
Now what I understand so far is that each of these vertices is surrounded by a pentagon which would mean 12 pentagons x 5 triangles = 60 triangles.
However these pentagons would probably not fit onto the sphere, not sure though.
Then Uber H3 states base cells 110 hexagons and 12 pentagons, so the number of triangles here would be: 110x6 + 12x5 =
660 + 60 = 720 triangles.
Trying to reason back to 20 triangles, where each triangle could be subdivided into 4 triangles would give:
720 / 4 = 180 first pass
or when can also use a different approach to figure out how many triangles the original 20 need to be split up into:
720/20 = 36
The second one was my initial reasoning.
Dividing 36 by 4 again would give 9.
And then one is stuck with 9 triangles, which cannot be divided by 4 anymore, so that would be weird.
Trying 180 next:
180/4 = 45
Again one gets stuck.
So it's hard to understand how the icosahedron triangles are turned into pentagons and hexagon cells and also how these are ultimately covered by triangles. (Plus uber h3 does some extra, it apperently rotates them as well by 19.x something degrees).
Anyway failing to reconstruct it myself/the idea time for some googling:
https://stackoverflow.com/questions/42069420/hexagonal-tilling-of-hemi-sphere/42093868#42093868
which also leads to here:
https://stackoverflow.com/questions/42069420/hexagonal-tilling-of-hemi-sphere/42093868#42093868
So the first link has a somewhat surprising solution, I don't quite understand it yet, I have seen it in Uber H3 videos or papers from others where instead of subdividing the triangle into perfect other triangles, it more or less creates some kind of lines inside of the triangle.
I think this is what Uber H3 is doing.
However on the math part, how does uber h3 go from 12 vertices + 20 triangles for icosahedron to 122 base cells ?
How many vertices does the resolution 0 contain ?
There are some formulas here:
https://h3geo.org/docs/core-library/restable
But they seem to start after the distribution has already taken place,. and it starts from resolution 0/base cells.
What is undocumented is how it gets from a icosahedron to the base cells.
I think this would be helpfull to understand Uber H3 better, especially when having to verify verteces on the sphere.
I also wonder if the rotating per resolution that Uber H3 does is necessary, or if a non-rotated version would also be interesting and if it's possible.
It might be easier to understand if it's not rotated. Perhaps if possible an option can be build into Uber H3 so that it doesn't rotate (?)
The text was updated successfully, but these errors were encountered: