圆柱体。OXYZ。3D 圆柱体。带点的圆柱体

圆柱体。OXYZ。3D 圆柱体。带点的圆柱体

我想帮助在 3d 中绘制圆柱体,圆柱两侧都有点(p1、p2、…pn)

答案1

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
\begin{document}
\tdplotsetmaincoords{105}{-30}
\begin{tikzpicture}[tdplot_main_coords,bullet/.style={circle,fill,inner sep=2pt}]
 \pgfmathsetmacro{\Radius}{1.5}
 \pgfmathsetmacro{\Height}{4}
 \draw[-stealth] (0,0,0) coordinate (O) -- (2.5*\Radius,0,0) node[pos=1.05] {$x$};
 \draw[-stealth] (O) -- (0,2.5*\Radius,0) node[pos=1.05] {$y$};
 \draw[-stealth] (O) -- (0,0,1.25*\Height) node[pos=1.05] {$x$};
 \draw[dashed] plot[variable=\x,domain=\tdplotmainphi:\tdplotmainphi-180,smooth]
    ({\Radius+\Radius*cos(\x)},{\Radius*sin(\x)},0);
 \begin{scope}[canvas is xy plane at z=0]   
  \foreach \X [count=\Y] in {-2/3,-1/3,2/3}
  {\node[bullet,transform shape] (B-\Y) at (\Radius+\Radius*\X,0){};}
  \foreach \Y in {1,2,3}
  {\node[anchor=south] at (B-\Y){\ifnum\Y=3
  $P_n$
  \else
  $P_\Y$
  \fi};}
 \end{scope}
 \draw[left color=gray,right color=gray!80,middle color=gray!20,fill opacity=0.5]
  plot[variable=\x,domain=\tdplotmainphi:\tdplotmainphi+180,smooth]
   ({\Radius+\Radius*cos(\x)},{\Radius*sin(\x)},0)
   -- plot[variable=\x,domain=\tdplotmainphi+180:\tdplotmainphi,smooth]
   ({\Radius+\Radius*cos(\x)},{\Radius*sin(\x)},\Height) -- cycle;
 \begin{scope}[canvas is xy plane at z=\Height] 
  \fill[gray!30] (\Radius,0) circle[radius=\Radius];
  \foreach \X [count=\Y] in {-2/3,-1/3,2/3}
  {\node[bullet,transform shape] (T-\Y) at (\Radius+\Radius*\X,0){};}
  \foreach \Y in {1,2,3}
  {\node[anchor=south] at (T-\Y){\ifnum\Y=3
  $P_n$
  \else
  $P_\Y$
  \fi};}
 \end{scope}
\end{tikzpicture} 
\end{document} 

在此处输入图片描述

相关内容