def sphere_from_chaining(radius, segs):
    deg_per_seg = 180.0 / segs
    hs = (3.141592653589793 * radius) / segs
    l = []
    l.append((-radius, circle(0.3, segs)))
    h_sum = -radius
    for i in range(1, segs - 1):
        factor = sin(i * deg_per_seg)
        r = radius * factor
        h = hs * factor
        h_sum += h
        l.append((h_sum, circle(r, segs)))
    l.append((radius, circle(0.3, segs)))

    s = extrude_chaining(l, is_convex=True)
    return s


out = sphere_from_chaining(10, 60)
