## LaTeX forum ⇒ General ⇒ How can I draw a cylinder insribes a sphere?

LaTeX specific issues not fitting into one of the other forums of this category.
Tran Van Toan
Posts: 17
Joined: Sat Oct 28, 2017 1:18 am

### How can I draw a cylinder insribes a sphere?

I am trying to draw this picture in Tikz. I tried.
\documentclass[12pt,border=3mm]{standalone}\usepackage{fouriernc}\usepackage{tikz}\usepackage{tkz-euclide}\usetkzobj{all}\usepackage{tikz-3dplot}\usetikzlibrary{calc,backgrounds}\begin{document}\tdplotsetmaincoords{60}{110}\def\r{{2*sqrt(3)}}\begin{tikzpicture}[scale=1,tdplot_main_coords]\pathcoordinate (O) at (0,0,0)coordinate (T) at  (0,0,2)coordinate (A') at  (0,\r,4)coordinate (A) at  (0,\r,0);\coordinate (B) at ($(O) + (-50:{2*sqrt(3)} and \r)$);\coordinate (B') at ($(B)+(0,0,4)$);\coordinate (O') at ($(O)+(0,0,4)$);\draw[dashed] (A)--(A') (B) --(B') (O)--(O') (O)--(A) (T) --(A);\foreach \v/\position in {T/above,O/below,O'/above,A/below,B/below,A'/left,B'/left} {    \draw[draw =black, fill=black] (\v) circle (1.2pt) node [\position=0.2mm] {$\v$};}\begin{scope}[tdplot_screen_coords, on background layer]\pgfmathsetmacro{\R}{4}%%\pgfmathsetmacro{\r}{{2*sqrt(3)}}%\fill[ball color=cyan!50, opacity=1.0] (T) circle (\R);\end{scope}\tkzMarkRightAngle[size = 0.3](T,O,A);\draw [thick] (B) arc (-50:90:\r);\draw [thick, dashed] (A) arc (90:310:\r);\draw [thick] (B') arc (-50:90:\r);\draw [thick, dashed] (A') arc (90:310:\r);\end{tikzpicture}\end{document}

The cylinder look very bad. How can I repair?
Attachments
ScreenHunter 52.png (117.68 KiB) Viewed 91 times
ScreenHunter 51.png (7.53 KiB) Viewed 91 times