How to calculate geodesic sphere vertex coordinates?

1.2k Views Asked by At

For a 3D graphics application to draw a sphere, I usually combine it from a triangle strips, like so:

enter image description here

It's extremely easy to generate, using sin/cos with polar coordinates to generate vertices. As well as to texture it. Since you're using pair of polar coordinates - you may naturally map them to points of 2d image. But here goes the problem - If you increase "level of details", by increasing triangle count to make it look nice at closer distances - you'll get triangles at the poles almost degenerated to lines. There are excessively many of them and want to get rid. So I've heard of geodesic spheres:

enter image description here

But I totally miss idea for a vertex and texture coordinate generation - Like How to generate i-th vertex, or i-th face? I mean how would you naturally enumerate them? (You'll have to, since computer memory is always one-dimensional)

So you got a such a mesh of $N$ triangular faces, and for each $i$ from $0$ to $N$, representing single triangle, you will have 3 vertices $(x_1(i),y_1(i),z_1(i)), (x_2(i),y_2(i),z_2(i)), (x_3(i),y_3(i),z_3(i))$ If you have these formulas you may construct it very easily, as you got all vertex coordinatex. What these formulas could look like?

And how would you even may wrap rectangular texture onto that shape? Like for each $i$ how can I find correcponding $x$ and $y$ on a 2D texture image?