In the cone parameterization the radius is variable, and with your rs definition, the cone height, h=maximum(rs)=2. Hence we have to draw of cylinder of radius 2, and the same height, h=2. Since the cylinder radius is constant, it is not recommended to use r as parameter. I’m using u, v, that are “classical” variables for a surface parameterization, and thus avoid confusion between variable and constant radius for the two surfaces:
function cyl_cone(; h =2, m=50, n=50)
#cone parameterizarion u∈[0, 2π], v∈[0, h];
X(u,v) = v*cos(u)
Y(u,v) = v*sin(u)
Z(u,v) = v
#cylinder circumscribed to the above cone; u∈[0, 2π], v∈[0, h]
x(u, v) = h*cos(u)
y(u, v) = h*sin(u)
z(u, v) = v
u=range(0, 2pi, length=m)
v = range(0, h, length=n)
plt =surface(x.(u, v'), y.(u, v'), ones(m) *v')
surface!(plt, (X.(u, v'), Y.(u, v'), Z.(u, v')))
return plt
end
plt =cyl_cone(;)