I need to draw a Truncated Icosahedron

I need to create a Truncated Icosahedron (soccer ball shaped solid).
details here: http://mathworld.wolfram.com/TruncatedIcosahedron.html

Specifically I'm looking for a formula which can generate the shape, not just a list of vertexes. Also, this is an important task which I need to somplete quickly so I'm looking for source code, not theory.

I'd appreciate any help on this.
NailheadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guitaristxCommented:
Do you realize that the "shape" is specified by vertices in OpenGL?

Also, do you realize that having a list of vertices is actually faster and better for you than a formula, especially considering that the formula will be calculating square roots (which is usually quite slow)?

If I have convinced you yet, see here:
http://en.wikipedia.org/wiki/Truncated_icosahedron

It gives you a list of the vertices.  I can help you decode the list so that you can create the faces appropriately in OpenGL, if you like.
NailheadAuthor Commented:
Ah yes, I didn't realize what would be invovled in the computing of the shape. I would very much like to go with your advice and take you up on that offer. :)
guitaristxCommented:
I knew I'd seen it before!
http://www.scienceu.com/geometry/facts/solids/coords/tr_icosa.html

Okay, the first section is the vertices.  Ignore the
OFF
    60   32    0
bit.

The next section is the faces, as lists of vertices.  They *should* be in CCW order.  The format is:
<number of sides (5 or 6)> vertex1 vertex2 ... vertexN

That should do it!
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

ozoCommented:
static GLfloat vdata[60][3]={
        {0, 0, 1.021},
        {0.4035482, 0, 0.9378643},
        {-0.2274644, 0.3333333, 0.9378643},
        {-0.1471226, -0.375774, 0.9378643},
        {0.579632, 0.3333333, 0.7715933},
        {0.5058321, -0.375774, 0.8033483},
        {-0.6020514, 0.2908927, 0.7715933},
        {-0.05138057, 0.6666667, 0.7715933},
        {0.1654988, -0.6080151, 0.8033483},
        {-0.5217096, -0.4182147, 0.7715933},
        {0.8579998, 0.2908927, 0.4708062},
        {0.3521676, 0.6666667, 0.6884578},
        {0.7841999, -0.4182147, 0.5025612},
        {-0.657475, 0.5979962, 0.5025612},
        {-0.749174, -0.08488134, 0.6884578},
        {-0.3171418, 0.8302373, 0.5025612},
        {0.1035333, -0.8826969, 0.5025612},
        {-0.5836751, -0.6928964, 0.4708062},
        {0.8025761, 0.5979962, 0.2017741},
        {0.9602837, -0.08488134, 0.3362902},
        {0.4899547, 0.8302373, 0.3362902},
        {0.7222343, -0.6928964, 0.2017741},
        {-0.8600213, 0.5293258, 0.1503935},
        {-0.9517203, -0.1535518, 0.3362902},
        {-0.1793548, 0.993808, 0.1503935},
        {0.381901, -0.9251375, 0.2017741},
        {-0.2710537, -0.9251375, 0.3362902},
        {-0.8494363, -0.5293258, 0.2017741},
        {0.8494363, 0.5293258, -0.2017741},
        {1.007144, -0.1535518, -0.06725804},
        {0.2241935, 0.993808, 0.06725804},
        {0.8600213, -0.5293258, -0.1503935},
        {-0.7222343, 0.6928964, -0.2017741},
        {-1.007144, 0.1535518, 0.06725804},
        {-0.381901, 0.9251375, -0.2017741},
        {0.1793548, -0.993808, -0.1503935},
        {-0.2241935, -0.993808, -0.06725804},
        {-0.8025761, -0.5979962, -0.2017741},
        {0.5836751, 0.6928964, -0.4708062},
        {0.9517203, 0.1535518, -0.3362902},
        {0.2710537, 0.9251375, -0.3362902},
        {0.657475, -0.5979962, -0.5025612},
        {-0.7841999, 0.4182147, -0.5025612},
        {-0.9602837, 0.08488134, -0.3362902},
        {-0.1035333, 0.8826969, -0.5025612},
        {0.3171418, -0.8302373, -0.5025612},
        {-0.4899547, -0.8302373, -0.3362902},
`       {-0.8579998, -0.2908927, -0.4708062},
        {0.5217096, 0.4182147, -0.7715933},
        {0.749174, 0.08488134, -0.6884578},
        {0.6020514, -0.2908927, -0.7715933},
        {-0.5058321, 0.375774, -0.8033483},
        {-0.1654988, 0.6080151, -0.8033483},
        {0.05138057, -0.6666667, -0.7715933},
        {-0.3521676, -0.6666667, -0.6884578},
        {-0.579632, -0.3333333, -0.7715933},
        {0.1471226, 0.375774, -0.9378643},
        {0.2274644, -0.3333333, -0.9378643},
        {-0.4035482, 0, -0.9378643},
        {0, 0, -1.021}
};
static GLuint pentagons[12][5]={
        {0,3,8,5,1},
        {2,7,15,13,6},
        {4,10,18,20,11},
        {9,14,23,27,17},
        {12,21,31,29,19},
        {16,26,36,35,25},
        {22,32,42,43,33},
        {24,30,40,44,34},
        {28,39,49,48,38},
        {37,47,55,54,46},
        {41,45,53,57,50},
        {51,52,56,59,58}
};
static GLuint hexagons[20][6]={
        {0,1,4,11,7,2},
        {0,2,6,14,9,3},
        {1,5,12,19,10,4},
        {3,9,17,26,16,8},
        {5,8,16,25,21,12},
        {6,13,22,33,23,14},
        {7,11,20,30,24,15},
        {10,19,29,39,28,18},
        {13,15,24,34,32,22},
        {17,27,37,46,36,26},
        {18,28,38,40,30,20},
        {21,25,35,45,41,31},
        {23,33,43,47,37,27},
        {29,31,41,50,49,39},
        {32,34,44,52,51,42},
        {35,36,46,54,53,45},
        {38,48,56,52,44,40},
        {42,51,58,55,47,43},
        {48,49,50,57,59,56},
        {53,54,55,58,59,57}
};
ozoCommented:
#define P 1.6180339889
static GLfloat vertices[]={
 -P      ,  2      , -(1+2*P),
 -1      , -3*P    ,  0      ,
  (2+P)  , -2*P    ,  1      ,
  0      ,  1      ,  3*P    ,
 -1      , -(2+P)  ,  2*P    ,
 -3*P    ,  0      ,  1      ,
  1      , -(2+P)  ,  2*P    ,
 -2*P    ,  1      , -(2+P)  ,
  1      ,  (2+P)  , -2*P    ,
  2      ,  (1+2*P), -P      ,
 -(2+P)  , -2*P    ,  1      ,
 -(2+P)  ,  2*P    , -1      ,
 -1      , -(2+P)  , -2*P    ,  
 -P      , -2      , -(1+2*P),
 -(1+2*P), -P      ,  2      ,
  (1+2*P),  P      ,  2      ,
 -1      ,  3*P    ,  0      ,
  (1+2*P),  P      , -2      ,
 -2      ,  (1+2*P),  P      ,
 -(1+2*P), -P      , -2      ,
  3*P    ,  0      ,  1      ,
  P      , -2      ,  (1+2*P),
  (1+2*P), -P      , -2      ,
  0      , -1      , -3*P    ,
  0      , -1      ,  3*P    ,
  1      ,  (2+P)  ,  2*P    ,
 -(1+2*P),  P      , -2      ,
 -2      ,  (1+2*P), -P      ,
  1      , -3*P    ,  0      ,
  (1+2*P), -P      ,  2      ,
 -2*P    , -1      , -(2+P)  ,
  2*P    ,  1      ,  (2+P)  ,
  P      ,  2      ,  (1+2*P),
  (2+P)  ,  2*P    , -1      ,
 -(2+P)  , -2*P    , -1      ,
  P      , -2      , -(1+2*P),
  2      , -(1+2*P),  P      ,
  3*P    ,  0      , -1      ,
 -2*P    ,  1      ,  (2+P)  ,
 -(1+2*P),  P      ,  2      ,
 -P      , -2      ,  (1+2*P),
  (2+P)  , -2*P    , -1      ,
 -1      ,  (2+P)  ,  2*P    ,
 -P      ,  2      ,  (1+2*P),
  1      ,  3*P    ,  0      ,
 -2*P    , -1      ,  (2+P)  ,
  P      ,  2      , -(1+2*P),
  1      , -(2+P)  , -2*P    ,
  2*P    ,  1      , -(2+P)  ,
  2*P    , -1      ,  (2+P)  ,
 -1      ,  (2+P)  , -2*P    ,
  2      ,  (1+2*P),  P      ,
  (2+P)  ,  2*P    ,  1      ,
 -2      , -(1+2*P), -P      ,
  0      ,  1      , -3*P    ,
 -3*P    ,  0      , -1      ,
  2*P    , -1      , -(2+P)  ,
  2      , -(1+2*P), -P      ,
 -2      , -(1+2*P),  P      ,
 -(2+P)  ,  2*P    ,  1
};

static GLubyte pentagon[12][5] = {
{13, 23, 35, 47, 12},
{18, 59, 11, 27, 16},
{19, 30, 7, 26, 55},
{21, 24, 40, 4, 6},
{43, 3, 32, 25, 42},
{44, 9, 33, 52, 51},
{46, 54, 0, 50, 8},
{48, 17, 37, 22, 56},
{49, 31, 15, 20, 29},
{5, 39, 38, 45, 14},
{53, 1, 58, 10, 34},
{57, 28, 36, 2, 41}
};

static GLubyte hexagon[20][6] = {
{10, 14, 45, 40, 4, 58},
{11, 26, 7, 0, 50, 27},
{18, 59, 39, 38, 43, 42},
{2, 36, 6, 21, 49, 29},
{20, 37, 22, 41, 2, 29},
{25, 51, 52, 15, 31, 32},
{26, 11, 59, 39, 5, 55},
{28, 1, 53, 12, 47, 57},
{28, 1, 58, 4, 6, 36},
{31, 32, 3, 24, 21, 49},
{34, 19, 30, 13, 12, 53},
{37, 17, 33, 52, 15, 20},
{41, 22, 56, 35, 47, 57},
{44, 9, 8, 50, 27, 16},
{45, 38, 43, 3, 24, 40},
{48, 46, 54, 23, 35, 56},
{5, 55, 19, 34, 10, 14},
{51, 25, 42, 18, 16, 44},
{7, 0, 54, 23, 13, 30},
{9, 8, 46, 48, 17, 33}
};

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,0,vertices);
for( i=0;i<12; i++ ){
  glDrawElements(GL_POLYGON, 5, GL_UNSIGNED_BYTE, pentagon[i] );
}
for( i=0;i<20; i++ ){
  glDrawElements(GL_POLYGON, 6, GL_UNSIGNED_BYTE, hexagon[i] );
}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NailheadAuthor Commented:
Thanks for the help!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.