Vertical spiral in cylinder

Vertical spiral

\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 solids;
import graph3;
usepackage("newtxmath");
size(200,400);
real r=3;
real h=2.5pi;

currentprojection=orthographic(8,2,4);

revolution R=cylinder(O,r,h);

// The circular helix
triple f(real t){
  real a=r*cos(t);
  real b=r*sin(t);
  real c=t;
  return (a,b,c);
}

real k=7;
path3 plane=(k,k,0)--(k,-k,0)--(-k,-k,0)--(-k,k,0)--cycle;
draw(plane);
label("$\alpha$",(k,-k,0),2dir(20));

draw(surface(R),lightgreen+opacity(0.5),render(compression=Low));
draw(surface(circle((0,0,h),r)),lightgreen+opacity(0.5),render(compression=Low));
draw(O--(0,0,h)^^O--(0,r,0)^^O--(r,0,0),dashed);
dot(scale(.7)*"$O$",(0,0,0),dir(165));
dot((0,0,h));

guide3 g=graph(f,0,h,150);
draw(Label("$\varphi$",Relative(.05)),g);
draw(Label("$\varphi$",Relative(.05)),g);

triple P=f(1),overP=f(1+2pi);
triple P1=(P.x,P.y,0),P2=(0,0,P.z);

draw(overP--P1);
draw(P2--P^^O--P1,dashed);

dot(scale(.7)*"$P$",P,2dir(120));
dot(scale(.7)*"$\overline{P}$",overP,dir(-20));
dot(scale(.7)*"$P_1$",P1,dir(-90));
dot(scale(.7)*"$P_2$",P2,dir(150));

xaxis3(Label("$x^1$",Relative(.5),2LeftSide),r,6,Arrow3);
yaxis3(Label("$x^2$",Relative(.5),4dir(20)),r,6,Arrow3);
zaxis3(Label("$x^3=$ a",Relative(.6),2RightSide),h,h+4,Arrow3);
\end{asy}
\end{document}

Source: TeX.SE

Author: Nguyen Van Chi (License)