# pouët.net

## icosahedron / hexasphere / geodesic sphere code/math

category: code [glöplog]
if you have regular hexagons, those have like 120 degrees in each corner, three of them meet, that's 360 degrees, which means the result will be flat, not curved. A sphere has positive curvature, will have less than 360 degrees meeting at a single point (if the polygons are big enough, like bigger than infinitesimal). Think about a cone, which is an extreme example. This is why football have pentagons and hexagons alternating instead of just hexagons (hi gargaj :). A regular pentagon has 108 degrees internal angle, so two hexagons and one pentagon is less than 360 degrees, making it possible to form an approximation of a sphere.
added on the 2013-02-16 01:08:06 by blala
i personally like to normalize the vertices of a cube:

http://www.iquilezles.org/www/articles/patchedsphere/patchedsphere.htm

which gives you pretty decently equally sized polygons, and of course a natural (somehow stretch-free) texture mapping coordinates, if you are still in that whole UV mapping thing.

added on the 2013-02-16 20:25:01 by iq
if you're into boxmapping, you mean ;)
If you want a low distortion mapping with simple code, you might give this a try http://blog.marmakoide.org/?p=1
some nice stuff in this thread. thanks everyone!
added on the 2013-02-18 19:48:43 by jaw
iq: Normalization rules!!
used that method not only once in the past..
added on the 2013-02-19 07:27:31 by lsl