from sympy import *
from spb import *
var("t u v theta phi")
r_sphere = 1
sphere = surface_spherical(1, (theta, 0, pi), (phi, pi, 2*pi))[0]
t = pi / 3 # half-cone angle
r_cone = r_sphere * sin(t)
graphics(
    wireframe(sphere, n1=13, rendering_kw={"line_dash": "dot"}),
    surface_spherical(1, (theta, pi - t, pi), (phi, pi, 2*pi),
        label="sphere cap", wireframe=True, wf_n1=5),
    surface_parametric(
        u * cos(v), u * sin(v), -u / tan(t), (u, 0, r_cone), (v, pi , 2*pi),
        label="cone", wireframe=True, wf_n1=7),
    backend=PB, grid=False
)