Reputation: 103
When looking at the wiki for the game "Songs of the Eons" under development, I see the claim that the number of tiles on the planet generated could be calculated by
30*s²+2
in which s
is the planet size.
They also say that the planet is constructed by almost all hexagons and only 12 pentagons.
I know a bit about the sub-divison techniques (like the root-3 subdivision), but I am completely lost on this.
I have looked through this, or this, but I didn't notice one that gives the answer. Perhaps the closest one would be this, but it is still different in tile numbers.
Someone knows how this is done? Some papers or source codes would be great.
Upvotes: 3
Views: 441
Reputation: 29126
One of the comments to the top answer in your second link mentions how this is done: The sphere is created by subdividing the triangular faces of an icosahedron. The resulting triangles can be grouped into hexagons. Some of the hexagons will cross the edges. The triangles at the tips of the original faces can only be grouped into pentagons.
The base construction (s = 1) will give you the canonical football tesselation. With increasing size, you get:
For each of the 12 vertices of the icosahedron, you get one pentagon. Forr each of the 30 edges of the icosahedron, you get (s − 1) hexagons. With each increase of s by 1, the number of full hexagons (in white) increases by 3·(s − 1). For s = 1, you just have one full hexagon. So for each of the 20 faces of the icosahedron, you get:
H = 1 + 3·∑(k = 1 ... s) k
= 1 + 3/2 (s − 1)·s
In total:
T = 30·(s − 1) + 20·(1 + 3/2 (s − 1)·s) + 12
= 30·s − 30 + 20 + 30·(s − 1)·s + 12
= 30·s2 + 2
Upvotes: 4