set title "Interlocking Tori - PM3D surface with depth sorting and transparency"

unset border
unset key
set object 1 rect from screen 0, 0, 0 to screen 1, 1, 0 behind 
set object 1 rect fc  rgb "gray"  fillstyle solid 1.0  border -1
set view 64, 345, 1.24375, 0.995902
set isosamples 50, 20
unset xtics
unset ytics
unset ztics
set parametric
set dummy u,v
set urange [ -pi : pi ]
set vrange [ -pi : pi ]

set palette rgbformulae 8, 9, 7
set style fill  transparent solid 0.30 border
set pm3d depthorder border linecolor rgb "#a0a0f0"  linewidth 0.5

splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d, \
    1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d

pause -1 "Hit return to continue"

unset title
set label 1 "Kuen's Surface" at screen 0.57, 0.9
set label 1 font "frscript,20"
set pm3d depthorder border linetype -1 linewidth 0.5
set style fill  transparent solid 0.65 border
set palette
set hidden3d

set ticslevel 0
unset xtics ; unset ytics ; unset ztics
unset border ; unset colorbox ; unset key
set lmargin at screen 0.1
set bmargin at screen 0.1
set rmargin at screen 0.9
set tmargin at screen 0.9

set parametric
set dummy u,v
set urange [-4.5:4.5]
set vrange [0.05:pi-0.05]
set isosamples 51,51
set view 122, 357, 1.35, 1.08

a = 1.0

x(u,v) = 2.*a*(cos(u)+u*sin(u))*sin(v) / (1+u**2.*(sin(v))**2)
y(u,v) = 2.*a*(sin(u)-u*cos(u))*sin(v) / (1+u**2.*(sin(v))**2)
z(u,v) = a*log(tan(v/2.))+2.*cos(v)/(1+u**2.*(sin(v))**2)

splot x(u,v), y(u,v), z(u,v) with pm3d

pause -1 "Hit return to continue"
reset
