cqmore/polyhedron.py
def icosahedron(radius: float, detail: int = 0) -> Polyhedron:
    '''
    Create a icosahedron.

    ## Parameters

    - `radius`: radius of the icosahedron.
    - `detail`: setting this to a value greater than 0 adds vertices making it no longer a icosahedron.

    ## Examples 

        from cqmore.polyhedron import icosahedron
        from cqmore import Workplane

        radius = 1
        polyhedra = Workplane()
        for detail in range(5):
            polyhedra.add(
                Workplane()
                    .polyhedron(*icosahedron(radius, detail))
                    .translate((2 * radius * detail, 0, 0))
            )

    '''

    t = (1 + 5 ** 0.5) / 2
    vectors = (
        Vector(-1, t, 0), Vector(1, t, 0), Vector(- 1, -t, 0), Vector(1, -t, 0),
        Vector(0, -1, t), Vector(0, 1, t), Vector(0, -1, -t),  Vector(0, 1, -t),
        Vector(t, 0, -1), Vector(t, 0, 1), Vector(-t, 0, -1),  Vector(-t, 0, 1)
    )
    faces = (
        (0, 11, 5), (0, 5, 1), (0, 1, 7), (0, 7, 10), (0, 10, 11),
        (1, 5, 9), (5, 11, 4), (11, 10, 2),    (10, 7, 6),    (7, 1, 8),
        (3, 9, 4), (3, 4, 2), (3, 2, 6), (3, 6, 8),    (3, 8, 9),
        (4, 9, 5), (2, 4, 11), (6, 2, 10), (8, 6, 7), (9, 8, 1)
    )
    return _divide_project(vectors, faces, radius, detail)

    Create a icosahedron.

    ## Parameters

    - `radius`: radius of the icosahedron.
    - `detail`: setting this to a value greater than 0 adds vertices making it no longer a icosahedron.

    ## Examples 

        from cqmore.polyhedron import icosahedron
        from cqmore import Workplane

        radius = 1
        polyhedra = Workplane()
        for detail in range(5):
            polyhedra.add(
                Workplane()
                    .polyhedron(*icosahedron(radius, detail))
                    .translate((2 * radius * detail, 0, 0))
            )

    
Create a icosahedron.
Parameters

`radius`: radius of the icosahedron.
`detail`: setting this to a value greater than 0 adds vertices making it no longer a icosahedron.

Examples

from cqmore.polyhedron import icosahedron
from cqmore import Workplane


Create a icosahedron . Parameters ` radius ` : radius of the icosahedron . ` detail ` : setting this to a value greater than 0 adds vertices making it no longer a icosahedron . Examples from cqmore . polyhedron import icosahedron from cqmore import Workplane
def icosahedron(radius: float, detail: int = 0) -> Polyhedron:
    t = (1 + 5 ** 0.5) / 2
    vectors = (
        Vector(-1, t, 0), Vector(1, t, 0), Vector(- 1, -t, 0), Vector(1, -t, 0),
        Vector(0, -1, t), Vector(0, 1, t), Vector(0, -1, -t),  Vector(0, 1, -t),
        Vector(t, 0, -1), Vector(t, 0, 1), Vector(-t, 0, -1),  Vector(-t, 0, 1)
    )
    faces = (
        (0, 11, 5), (0, 5, 1), (0, 1, 7), (0, 7, 10), (0, 10, 11),
        (1, 5, 9), (5, 11, 4), (11, 10, 2),    (10, 7, 6),    (7, 1, 8),
        (3, 9, 4), (3, 4, 2), (3, 2, 6), (3, 6, 8),    (3, 8, 9),
        (4, 9, 5), (2, 4, 11), (6, 2, 10), (8, 6, 7), (9, 8, 1)
    )
    return _divide_project(vectors, faces, radius, detail)
def icosahedron ( radius : float , detail : int = 0 ) -> Polyhedron : t = ( 1 + 5 ** 0.5 ) / 2 vectors = ( Vector ( - 1 , t , 0 ) , Vector ( 1 , t , 0 ) , Vector ( - 1 , - t , 0 ) , Vector ( 1 , - t , 0 ) , Vector ( 0 , - 1 , t ) , Vector ( 0 , 1 , t ) , Vector ( 0 , - 1 , - t ) , Vector ( 0 , 1 , - t ) , Vector ( t , 0 , - 1 ) , Vector ( t , 0 , 1 ) , Vector ( - t , 0 , - 1 ) , Vector ( - t , 0 , 1 ) ) faces = ( ( 0 , 11 , 5 ) , ( 0 , 5 , 1 ) , ( 0 , 1 , 7 ) , ( 0 , 7 , 10 ) , ( 0 , 10 , 11 ) , ( 1 , 5 , 9 ) , ( 5 , 11 , 4 ) , ( 11 , 10 , 2 ) , ( 10 , 7 , 6 ) , ( 7 , 1 , 8 ) , ( 3 , 9 , 4 ) , ( 3 , 4 , 2 ) , ( 3 , 2 , 6 ) , ( 3 , 6 , 8 ) , ( 3 , 8 , 9 ) , ( 4 , 9 , 5 ) , ( 2 , 4 , 11 ) , ( 6 , 2 , 10 ) , ( 8 , 6 , 7 ) , ( 9 , 8 , 1 ) ) return _divide_project ( vectors , faces , radius , detail )
Create a icosahedron.
Create a icosahedron .
'''
    Create a icosahedron.

    ## Parameters

    - `radius`: radius of the icosahedron.
    - `detail`: setting this to a value greater than 0 adds vertices making it no longer a icosahedron.

    ## Examples 

        from cqmore.polyhedron import icosahedron
        from cqmore import Workplane

        radius = 1
        polyhedra = Workplane()
        for detail in range(5):
            polyhedra.add(
                Workplane()
                    .polyhedron(*icosahedron(radius, detail))
                    .translate((2 * radius * detail, 0, 0))
            )

    '''
radius
float
detail
int