• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# GeoSphere creation

## Recommended Posts

Wyrframe    2426
I need to generate a Geosphere at run-time, but I''m not sure how to do it... other than, of course, hard-coding every vertex and polygon. Could someone help me with finding a starting point for doing this? NOTE: Texture mapping coords not needed. ALSO NOTE: I don''t need much theory... I just need a starting point so that I can wrap my brain around it myself...

##### Share on other sites
castor    122
have a look at http://astronomy.swin.edu.au/pbourke/

##### Share on other sites
Wyrframe    2426
*bump*, and a solution for those who come by this in the future;

Easiest method; take a simple 6-sided 12-triangle cube, with its center at the origin and its corners at (Â±1,Â±1,Â±1). Tesselate it, such that each quad (pair of triangles) becomes four quads (eight triangles) meeting in the center of the original. Repeat as desired, essentially doubling detail each time.

+-------+           +---+---+|\      |           |\  |\  || \     |           | \ | \ ||  \    |           |  \|  \||   \   |  becomes  +---+---+|    \  |           |\  |\  ||     \ |           | \ | \ ||      \|           |  \|  \|+-------+           +---+---+

Now, take every vertex and normalize its position. I really can't think of why I didn't think of this when I first stared down at a wireframe of a geosphere.

What you will get is a geosphere; in the shape of a sphere but with six distinct groups of triangles, and with a very even vertex distribution. The vertices that were after the first (and every subsequent) tesselation will still be at their original location, since they are at unit vectors (ie (1,0,0), (0,-1,0), etc), and every other vertex will end up where it would be if it were on the surface of a sphere.

For those who don't know, "normalize" means take a vector and make its length exactly one by dividing each component (X,Y,Z) by the pre-normalization length (sqrt(X*X + Y*Y + Z*Z)).

Hope this helps!

Against TCPA!

[edited by - Wyrframe on March 1, 2004 2:22:23 AM]