Revision history [back]

Those are cool!

I just learned how to apply a colormap to 3dplots--probably a secondary issue for you at this stage, but it gives an example of plotting a surface:

var('r v')
cmsel = [colormaps['autumn'](i) for i in sxrange(0,1,0.05)]
p = plot3d(0.2*(r**2 + v**2) + cos(2*r)*sin(2*v),(r,-2,2), (v,-2,2), adaptive=True, color=cmsel, plot_points=10, opacity=0.9)
p2 = sphere((0,0,0),1,color='black',opacity=0.5)
(p+p2).show(aspect_ratio=(1,1,1), figsize=[7,3])

For doing the seashell plots, it looks like parametric_plot3d might be the plotting function you want. Here's an example:

u, v = var('u,v')
f1 = (4+(3+cos(v))*sin(u), 4+(3+cos(v))*cos(u), 4+sin(v))
f2 = (8+(3+cos(v))*cos(u), 3+sin(v), 4+(3+cos(v))*sin(u))
p1 = parametric_plot3d(f1, (u,0,2*pi), (v,0,2*pi), texture="red")
p2 = parametric_plot3d(f2, (u,0,2*pi), (v,0,2*pi), texture="blue")
p1 + p2

And maybe the last pieces of information you need are defining functions and setting parameters (copied from your Natalina example):

return float(aa/360*2*pi)

D=1