Trajectories on the surface of a torus

Rational slope (Subscript[ω, 1])/(Subscript[ω, 2]), closed trajectories

Torus[u_,v_,R_]:={Cos[u](1+R Cos[v]),Sin[u](1+R Cos[v]),R Sin[v]}
TorusNormal[u_,v_]:=Torus[u,v,1]-{Cos[u],Sin[u],0}
TorusPath[a_,R_,n_,k_]:=Torus[n a,k a,R]
TorusPathPoints[R_,n_,k_,p_,s_]:=Table[TorusPath[2π(i+s)/p,R,n,k],{i,0,p-1}];
close[{a_,z___}]:={a,z,a}
Manipulate[
Block[{select,torus,path,around,through,pts,points,scene},
select[what_,obj_,alt_]:=If[MemberQ[display,what]||MemberQ[extras,what],obj,alt];
torus={Opacity[t],ParametricPlot3D[Torus[u,v,R],{u,0,2π},{v,0,2π},Mesh->select["mesh",Automatic,None],PlotStyle->Cyan][[1]]};
path=ParametricPlot3D[TorusPath[a,R,n,k],{a,0,2π},PlotStyle->{Thickness[0.006],Black}][[1]];
around={select["torus",Thick,{}],ParametricPlot3D[Torus[a,π,R],{a,0,2π},PlotStyle->select["torus",Yellow,Blue]][[1]]};
through={select["torus",Thick,{}],ParametricPlot3D[TorusPath[a,R,0,1],{a,0,2π},PlotStyle->select["torus",Yellow,Blue]][[1]]};
pts=TorusPathPoints[R,n,k,p,s];
points={select["torus",Yellow,Red],PointSize[Large],Point[pts]};
scene={
select["torus",Tooltip[torus,"torus"],{}],
select["path",Tooltip[path,"path"],{}],
select["around",Tooltip[around,"around the hole"],{}],
select["through",Tooltip[through,"through the hole"],{}],
select["points",Tooltip[points,"points"],{}]
};
Graphics3D[scene,SphericalRegion->True,Boxed->False,ImageSize->Large]
],
{{R,.5,Tooltip["R","torus radius"]},.05,2,Appearance->"Labeled",ImageSize->Tiny},
{{k,3,Tooltip["p","number of times through the hole"]},0,10,1,Appearance->"Labeled",ImageSize->Tiny},
{{n,2,Tooltip["q","number of times around the hole"]},0,10,1,Appearance->"Labeled",ImageSize->Tiny},
{{p,24,Tooltip["Points","number of points on path"]},1,100,1,Appearance->"Labeled",ImageSize->Tiny},
{{s,0,Tooltip["Shift of points","point shift"]},0,1,Appearance->"Labeled",ImageSize->Tiny},
{{t,0.4,Tooltip["Torus opacity","t"]},0,1,ImageSize->Tiny,Enabled:>MemberQ[display, "torus"]},
{{display,{"torus","path"}},{"torus","path", "points"},ControlType->TogglerBar},
{{extras,{"mesh"}},{"mesh","around","through"},ControlType->TogglerBar},
SaveDefinitions->True,TrackedSymbols:>{R,n,k,p,s,t,display,extras},AutorunSequencing->{1,2,3}]

Credit: Based on the code written by Tom Verhoeff  from Eindhoven University of Technology.

Dense trajectory on a torus for irrational slope (Subscript[ω, 1])/(Subscript[ω, 2])

Manipulate[
Show[ParametricPlot3D[{
Cos[Sqrt[2]t](3+Cos[t]),
Sin[Sqrt[2]t](3+Cos[t]),
Sin[t]},
{t,0,tmax},LabelStyle->20,ImageSize->750],
Graphics3D[{Red,PointSize[0.012],Point[{Cos[Sqrt[2]tmax](3+Cos[tmax]),Sin[Sqrt[2]tmax](3+Cos[tmax]),Sin[tmax]}]}]],
{{tmax,1,"Angle θ"},1,300,Appearance-> "Labeled"}]

Creation of this notebook was supported by IT Academy program of Information Technology Foundation for Education (HITSA).