Plotting surfaces of revolution

Consider a parametrically described curve (x(t),y(t)) with t in some interval [a,b]. To plot the surface of revolution obtained by rotating this curve about the x axis, we do:

    plot3d( [x, y*cos(s), y*sin(s)], s=0..2*Pi, t=a..b);

Example 1: Rotating the curve [t+3*sin(t), 4+3*cos(t)], t=0..4*Pi about the x axis:

    > plot3d([t+3*sin(t), (4+3*cos(t))*cos(s), (4+3*cos(t))*sin(s)], s=0..3/2*Pi, t=0..4*Pi);

Example 2: Rotating the curve y=3+sin(x), x=0..4*Pi about the x axis. The parametric form of the curve is [t, 3+sin(t)], t=0..4*Pi. Therefore we obtain the surface of revolution by:

    > plot3d([t, (3+sin(t))*cos(s), (3+sin(t))*sin(s)], s=0..2*Pi, t=0..4*Pi);

Rotations about other axes or lines follow a similar idea.

Back to table of contents