I want to draw below picture.
How can we calculate the tangle angle automically.

%https://tex.stackexchange.com/questions/564162/drawing-half-cylinder-under-a-pyramid-through-tikz
Thank you in advance!
MWE
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{3d,perspective}
\begin{document}
\begin{tikzpicture}[rotate around y=60]
\def\radius{2}
\def\height{4}
\def\mark{0.2}
\def\ang{60}
\draw[thick] (-\radius,0,\radius) -- (\radius,0,\radius) -- (\radius,0,-\radius)--(-\radius,0,-\radius)--cycle;
\begin{scope}[rotate around y=-90,shift={(\radius,0,\radius)}]
\draw[thick] (0,0,0) arc(0:-180:\radius);
\end{scope}
\begin{scope}[rotate around y=90,shift={(\radius,0,\radius)}]
\draw[densely dashed, thick,black!80] (0,0,0) arc(0:-180+\ang:\radius);
\end{scope}
\begin{scope}[rotate around y=-90,shift={(\radius,0,-\radius)}]
\draw[thick] (0,0,0) arc (0:-\ang:\radius) -- ++(0,0,2*\radius);
\end{scope}
\end{tikzpicture}
\end{document}
Another method which I have write
\documentclass[border=3pt,tikz]{standalone}
\usetikzlibrary{calc,angles}
\begin{document}
\begin{tikzpicture}[declare function={goc=10;r=2.5;l=4;}]
\draw ({180-goc}:r) arc ({180-goc}:{360-goc}:r);
\draw[shift={(l,0)}] (270:r) arc ({270}:{360-goc}:r)
({180-goc}:r) coordinate (A) arc ({180-goc}:{180+0.25*goc}:r);
\draw[shift={(l,0)},dashed] ({180+0.25*goc}:r) arc ({180+0.25*goc}:{270-goc}:r);
\draw (270:r)--+(l,0)
({360-goc}:r)--({180-goc}:r)--+(l,0)
({360-goc}:r)--+(l,0)--(A);
\end{tikzpicture}
\end{document}




