from sympy import *
from spb import *
var("t u v theta phi")
r_sphere = 1
t = pi / 3 # half-cone angle
r_cone = r_sphere * sin(t)
p1 = plot3d_spherical(
    r_sphere, (theta, 0, pi), (phi, pi, 2*pi),
    "", rendering_kw={"opacity": 0},
    wireframe=True, wf_n1=13, wf_rendering_kw={"line_dash": "dot"},
    backend=PB, show=False, grid=False)
p2 = plot3d_spherical(
    r_sphere, (theta, pi - t, pi), (phi, pi, 2*pi),
    "sphere cap", wireframe=True, wf_n1=5,
    backend=PB, show=False)
p3 = plot3d_parametric_surface(
    u * cos(v), u * sin(v), -u / tan(t), (u, 0, r_cone), (v, pi , 2*pi),
    "cone", wireframe=True, wf_n1=7,
    backend=PB, show=False)
final = p1 + p2 + p3
# in real world, uncomment this line and remove the following two
# final.show()
fig = final.fig
fig