tikz add tag
Anonymous 1123
I want to draw this pictures

![ScreenHunter 1067.png](/image?hash=da41f6f2d7c246f047148ff9dc516f6d748de533e802eaf2d88f729b12464b4c)
![ScreenHunter 1068.png](/image?hash=533434280d54a42fea040f100ff3e55ba32919fd793d1e46e392c9080552edf0)

I tried

```
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
%\usetikzlibrary{intersections,calc}
\begin{document}
\pgfmathsetmacro\th{70}
\pgfmathsetmacro\az{70}
\tdplotsetmaincoords{\th}{\az}
\pgfmathsetmacro\h{3} %height of cylinder
\pgfmathsetmacro\R{3} %radius of base
\pgfmathsetmacro\v{\h + 3} 
\pgfmathsetmacro\t{-\R} 
\begin{tikzpicture} [scale=1, tdplot_main_coords, axis/.style={blue,thick}]
	\path
	(0,0,0) coordinate (O) 
	(0,0,\v) coordinate (B) 
	(0,0,\t) coordinate (A);
	\pgfmathsetmacro\cott{{cot(\th)}}
	\pgfmathsetmacro\fraction{\R*\cott/(\v-\h)}
	\pgfmathsetmacro\fractionTwo{\R*\cott/\t}
	\pgfmathsetmacro\fraction{\fraction<1 ? \fraction : 1}
	\pgfmathsetmacro\angle{{acos(\fraction)}}
	\pgfmathsetmacro\angleTwo{{acos(\fractionTwo)}}
	\pgfmathsetmacro\PhiOne{180+(\az-90)+\angle}
	\pgfmathsetmacro\PhiTwo{180+(\az-90)-\angle}
	\pgfmathsetmacro\PhiOneBis{180+(\az-90)+\angleTwo}
	\pgfmathsetmacro\PhiTwoBis{180+(\az-90)-\angleTwo}
	\pgfmathsetmacro\sinPhiOne{{sin(\PhiOne)}}
	\pgfmathsetmacro\cosPhiOne{{cos(\PhiOne)}}
	\pgfmathsetmacro\sinPhiTwo{{sin(\PhiTwo)}}
	\pgfmathsetmacro\cosPhiTwo{{cos(\PhiTwo)}}
	\pgfmathsetmacro\sinPhiOneBis{{sin(\PhiOneBis)}}
	\pgfmathsetmacro\cosPhiOneBis{{cos(\PhiOneBis)}}
	\pgfmathsetmacro\sinPhiTwoBis{{sin(\PhiTwoBis)}}
	\pgfmathsetmacro\cosPhiTwoBis{{cos(\PhiTwoBis)}}
	\pgfmathsetmacro\sinazp{{sin(\az-90)}}
	\pgfmathsetmacro\cosazp{{cos(\az-90)}}
	\pgfmathsetmacro\sinazm{{sin(90-\az)}}
	\pgfmathsetmacro\cosazm{{cos(90-\az)}}
	\draw[dashed] (\tdplotmainphi:\R) arc(\tdplotmainphi:\tdplotmainphi+180:\R);
	
	\draw[thick] (\tdplotmainphi:\R)  arc(\tdplotmainphi:\tdplotmainphi-180:\R);
	
	\tdplotdrawarc[tdplot_main_coords,thick]{(0,0,\h)}{\R}{\PhiOne}{360+\PhiTwo}{anchor=north}{}
	\tdplotdrawarc[tdplot_main_coords,dashed]{(0,0,\h)}{\R}{\PhiTwo}{\PhiOne}{anchor=north}{}
	\draw[thick]  ({\R*cos(\tdplotmainphi)},{\R*sin(\tdplotmainphi)},0 ) -- ({\R*cos(\tdplotmainphi)},{\R*sin(\tdplotmainphi)},\h );
	\draw[thick]  ({\R*cos(\tdplotmainphi-180)},{\R*sin(\tdplotmainphi-180)},0 ) -- ({\R*cos(\tdplotmainphi-180)},{\R*sin(\tdplotmainphi-180)},\h );
	\draw[thick] (B) -- (\R*\cosPhiOne,\R*\sinPhiOne,\h);
	\draw[thick] (B) -- (\R*\cosPhiTwo,\R*\sinPhiTwo,\h);
	\draw[thick] (A) -- (\R*\cosPhiOneBis,\R*\sinPhiOneBis,0);
	\draw[thick] (A) -- (\R*\cosPhiTwoBis,\R*\sinPhiTwoBis,0);
	\foreach \p in {O,B,A}
	\draw[fill=black] (\p) circle (1pt);
	\foreach \p/\g in {O/-45,B/90,A/-90}
	\path (\p)+(\g:3mm) node{$\p$};
	\draw[dashed]  (A)--(B)    (-\R*\sinazm,-\R*\cosazm,0) -- (-\R*\sinazp,+\R*\cosazp,0) ;
	\end{tikzpicture}
\end{document}
```
![ScreenHunter 1069.png](/image?hash=8cfd72f76356a055d9551474a8561c978c72aab561c445c0346d937270e089ad)
How can I draw them by using `3dtools`?
Top Answer
user 3.14159
This is a very simpleminded code.
```
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,3dtools}
\tikzset{
	protect/.code={
		\clip[overlay,reset cm,even odd clip,use named path=#1] 
		(-16383.99999pt,-16383.99999pt) rectangle (16383.99999pt,16383.99999pt);
}}
\begin{document}
\begin{tikzpicture}
 \begin{scope}[3d/install view={phi=30,theta=70},
 	declare function={R=3;% radius of the base of the cones and cylinder
	h=2;% height of the cone
	H=4;% height of the cyclinder 
	}]
  \path 
   (0,0,0) coordinate (O) % center of base of the lower cone
   (0,0,H) coordinate (H); % center of base of the upper cone
  \path[3d/screen coords,save named path=tmp] ([xshift=-R*1cm-0.4pt]O) rectangle 
  ([xshift=R*1cm+0.4pt]H);
%  
  % get the correct bounding box
  \path[opacity=0] (O) pic{3d/cone={r=R,h=-h}}; 
  % draw the part of the lower cone blocked by the cylinder
  \begin{scope}[3d/visible/.style={draw,very thin,cheating dash}]
   \clip[use named path=tmp];
   \path (O) pic{3d/cone={r=R,h=-h}};
  \end{scope}
  % draw the part of the lower cone not blocked by the cylinder
  \begin{scope}
   \tikzset{protect=tmp}
   \path (O) pic{3d/cone={r=R,h=-h}};
  \end{scope}
  % cylinder mantle
  \draw[3d/screen coords] ([xshift=-R*1cm]O) -- ([xshift=-R*1cm]H)
   ([xshift=R*1cm]O) -- ([xshift=R*1cm]H);
  % upper cone 
  \path (H) pic{3d/cone={r=R,h=h}};
 \end{scope}
\end{tikzpicture}
\end{document}
```
![Screen Shot 2021-01-09 at 7.55.47 AM.png](/image?hash=784056c9d8c4691af7c55a5c81cc15477b7eed92cc276950d46e19b35e323365)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.