Generating Icospheres

Generating Icospheres

Without any subdivisions the Icosahedron has 12 vertices and 20 faces, in general though (not 100% sure about the vertices formular):

generating_icospheres_a1cd0e07ff03ae07f9274aa6016fc0242dcd3de9.svg

The 12 vertices of an icosahedron with edge length 2 can be described as:

generating_icospheres_df9761f31c477f84117451aaee02ebe9450fc84b.svg

where generating_icospheres_d3358117f72b81086a355ac20d0407ba10203b90.svg is the golden ratio:

generating_icospheres_c169f88966fdcc7a91ffffe519a357f3f11969c8.svg

To generate an icosahedron with radius 1, every coordinate will be normalized:

generating_icospheres_57cefb24bf2336b863b4a3abc33e91d1b0ec0700.svg

where:

generating_icospheres_2dae68eb2cdac76a02a7821e47dfc9a087f1ddef.svg
void generate_ico_sphere() {
    const f32 X = .525731112119133606f;
    const f32 Z = .850650808352039932f;
    const V3 vertices[12] {
        {-X,  0,  Z}, { X,  0,  Z}, {-X,  0, -Z}, { X,  0, -Z},
        { 0,  Z,  X}, { 0,  Z, -X}, { 0, -Z,  X}, { 0, -Z, -X},
        { Z,  X,  0}, {-Z,  X,  0}, { Z, -X,  0}, {-Z, -X,  0},
    };

    const u32 indices[60] {
        0,  1,  4,
        0,  4,  9,
        9,  4,  5,
        4,  8,  5,
        4,  1,  8,
        8,  1, 10,
        8, 10,  3,
        5,  8,  3,
        5,  3,  2,
        2,  3,  7,
        7,  3, 10,
        7, 10,  6,
        7,  6, 11,
        11, 6,  0,
        0,  6,  1,
        6, 10,  1,
        9, 11,  0,
        9,  2, 11,
        9,  5,  2,
        7, 11,  2,
    };
}
Calendar October 22, 2023