One-sided trefoil knot

One-sided trefoil knot

\documentclass[border=10pt]{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}[width=\the\linewidth,inline=true]
settings.outformat="pdf";
settings.render=0;
settings.prc=false;
import graph3;
import tube;

size(200,0);
currentlight.background=paleyellow+opacity(0.0);
currentprojection=orthographic(camera=(-10,49,-58),up=(0.92,0.36,0.14));

real x(real t){return sin(2pi*t)+2sin(2*2pi*t);}
real y(real t){return cos(2pi*t)-2cos(2*2pi*t);}
real z(real t){return -sin(3*2pi*t);}
guide3 g=graph(x,y,z, 0, 1,operator..);

pair[][] p={
  {(-40, 20),( -56.8421, 23.4210),( -78.9473, 28.6842),(-90, 20)},
  {(-90, 20),(-101.0526, 11.3157),(-101.0526,-11.3157),(-90,-20)},
  {(-90,-20),( -78.9473,-28.6842),( -56.8421,-23.4210),(-40,-20)},
  {(-40,-20),( -23.1578,-16.5789),( -11.5789,-15     ),(  0,-15)},
  {(  0,-15),(  11.5789,-15     ),(  23.1578,-16.5789),( 40,-20)},
  {( 40,-20),(  56.8421,-23.4210),(  78.9473,-28.6842),( 90,-20)},
  {( 90,-20),( 101.0526,-11.3157),( 101.0526, 11.3157),( 90, 20)},
  {( 90, 20),(  78.9473, 28.6842),(  56.8421, 23.4210),( 40, 20)},
  {( 40, 20),(  23.1578, 16.5789),(  11.5789, 15     ),(  0, 15)},
  {(  0, 15),( -11.5789, 15     ),( -23.1578, 16.5789),(-40, 20)}
};

pen paint(real t){return hsv(t*360*0.1,0.997,0.997);}

guide gx=p[0][0];
for(int i=0;i

Source: TeX.SE

Author: g.kov (License)