Ask Your Question

Revision history [back]

How about drawing the individual cylindrical sections with parametric_plot3d:

var('u v')

p  = parametric_plot3d( [cos(u),sin(u),abs(cos(u))*v], (u,-3*pi/4,-pi/4), (v,-1,1))
p += parametric_plot3d( [cos(u),sin(u),abs(sin(u))*v], (u,-pi/4,pi/4), (v,-1,1))
p += parametric_plot3d( [cos(u),sin(u),abs(cos(u))*v], (u,pi/4,3*pi/4), (v,-1,1))
p += parametric_plot3d( [cos(u),sin(u),abs(sin(u))*v], (u,3*pi/4,5*pi/4), (v,-1,1))

p += parametric_plot3d( [cos(u),abs(cos(u))*v,sin(u)], (u,-3*pi/4,-pi/4), (v,-1,1))
p += parametric_plot3d( [cos(u),abs(sin(u))*v,sin(u)], (u,-pi/4,pi/4), (v,-1,1))
p += parametric_plot3d( [cos(u),abs(cos(u))*v,sin(u)], (u,pi/4,3*pi/4), (v,-1,1))
p += parametric_plot3d( [cos(u),abs(sin(u))*v,sin(u)], (u,3*pi/4,5*pi/4), (v,-1,1))

p += parametric_plot3d( [abs(cos(u))*v,cos(u),sin(u)], (u,-3*pi/4,-pi/4), (v,-1,1))
p += parametric_plot3d( [abs(sin(u))*v,cos(u),sin(u)], (u,-pi/4,pi/4), (v,-1,1))
p += parametric_plot3d( [abs(cos(u))*v,cos(u),sin(u)], (u,pi/4,3*pi/4), (v,-1,1))
p += parametric_plot3d( [abs(sin(u))*v,cos(u),sin(u)], (u,3*pi/4,5*pi/4), (v,-1,1))

show(p)

Live example with nice clean edges.