SetDirectory["C:\\drorbn\\AcademicPensieve\\2013-07\\Vis4D"]

g[t_] := Which[
0≤(τ=t)<1, {-Cos[3π τ], Sin[3 π τ], 2τ-1},
0≤(τ-=1)<1, {2-Cos[π τ], 0, 1+Sin[π τ]},
0≤(τ-=1)<1, {3, 0, 1-2τ},
0≤(τ-=1)<1,  {2+Cos[π τ],0,-1-Sin[π τ]},
0≤(τ-=1)<1,  {Cos[3π τ], -Sin[3 π τ], 2τ-1},
0≤(τ-=1)<1, {-2+Cos[π τ], 0, 1+Sin[π τ]},
0≤(τ-=1)<1, {-3, 0, 1-2τ},
0≤(τ-=1)≤1,  {-2-Cos[π τ],0,-1-Sin[π τ]}
];
g1[t_] := g[t] /. {
{x_,y_,z_} /; -1≤z≤1 :> {x,3z, y},
{x_,y_,z_} /; z>1 :> {x,z+2, y},
{x_,y_,z_} /; z<-1 :> {x,z-2, y}
};

MakeImage["Trefoil3D",
Graphics3D[Tube[
Table[g1[t], {t, 0,8, 0.01}], 0.3
],
PlotRange->{All, All,{-4.1, 4.1}}, Boxed -> False, ViewPoint -> {0,2,2}],
ImageSize -> {600}]

MakeImage["TrefoilBlack",
Graphics[Table[
g1[t] /. {x_,y_,z_} :> {
Disk[{x,y},0.1]
},
{t,0,8,0.01}
]],
ImageSize -> {600}]

MakeImage["TrefoilBroken",
Graphics[Table[
If[Min[Abs[t-{4+1/6,0.5, 5-1/6}]]<0.05, {},
g1[t] /. {x_,y_,z_} :> {
Disk[{x,y},0.1]
}
],
{t,0,8,0.01}
]],
ImageSize -> {600}]

MakeImage["TrefoilColoured",
Graphics[{
Table[
g1[t] /. {x_,y_,z_} :> {
Opacity[0.1],
Hue[(1-z)/3],
Disk[{x,y},0.2]
},
{j,10},{t,0,8,0.01}
]
}],
ImageSize -> {600}]

?RandomPermutation