Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is a full working example that semi-resembles the original example on Wikipedia:

var('u v')

sph_obj = parametric_plot3d(
    (sin(u)*cos(v), sin(u)*sin(v), cos(u)),
    (v, 0, 2*pi),
    (u, 0, 2*pi),
    opacity=0.3,
    color=(0.2, 0.1, 0.1),
)

cyl_obj = parametric_plot3d(
    (sin(v)/2, cos(v)/2 + 1/2, u),
    (v, 0, 2*pi),
    (u, -3/2, 3/2),
    opacity=0.7,
    color=(0.2, 0.2, 0.3),
    plot_points=(80, 3)
)

v_curve_obj = parametric_plot3d(
    (sin(v)*cos(v), sin(v)*sin(v), cos(v)),
    (v, 0, 2*pi),
    color="green",
    thickness=2,
)

(sph_obj + cyl_obj + v_curve_obj).rotateZ(3/2).show(
    viewer="tachyon",
    aspect_ratio=1,
    frame=False,
    zoom=1.3
)

image description