Edit and compile if you like:
\documentclass{article}\usepackage{tikz}\usepackage{tikz-3dplot}\usetikzlibrary{math}\usepackage[active,tightpage]{preview}\PreviewEnvironment{tikzpicture}\setlength\PreviewBorder{1pt}%% File name: truncated-cylinder.tex% Description:% A geometric representation of a truncated cylinder is shown.%% Date of creation: April, 9th, 2021.% Date of last modification: October, 9th, 2022.% Author: Efra�n Soto Apolinar.% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/% Source: page 44 of the% Glosario Ilustrado de Matem\'aticas Escolares.% https://tinyurl.com/5udm2ufy%% Terms of use:% According to TikZ.net% https://creativecommons.org/licenses/by-nc-sa/4.0/% Your commitment to the terms of use is greatly appreciated.%\begin{document}%\tdplotsetmaincoords{70}{100}%\begin{tikzpicture}[tdplot_main_coords]\pgfmathsetmacro{\r}{2}% Base of the truncated cylinder\draw[thick,fill=cyan!35,opacity=0.75] plot[domain=0:6.2832,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{0.0});\draw[red,thick,dashed] plot[domain=1.570796327:4.71238898,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{0.0});% Vertical wall (back, external radius)\fill[gray!35,opacity=0.5] (0,\r,0)-- plot[domain=1.571:4.71238898,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{0})-- (0,-\r,4)-- plot[domain=4.71238898:1.571,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{4.0-\r*sin(\t r)})-- (0,\r,0);% Vertical wall (front, external radius)
Click to download: truncated-cylinder.tex • truncated-cylinder.pdf
Open in Overleaf: truncated-cylinder.tex
See more on the author page of Efraín Soto Apolinar.