在较大的圆柱体内创建一个小圆柱体

在较大的圆柱体内创建一个小圆柱体

有人能给我提供一些代码或见解,告诉我如何在圆柱体内创建阴影圆柱体的图表吗?任何排版系统都可以(但请指定哪一种)。

是否也可以标记区域?例如,用字母(圆柱体 C、较小的圆柱体 P、纵向 T 等)?任何答案或对现有答案的引用都将不胜感激。谢谢!

答案1

如果我理解正确的话,下面的代码可能会对你有所帮助。

\documentclass{standalone}
\usepackage{tikz} 
\usetikzlibrary{calc} 

\tikzset{
  dim above/.style={to path={\pgfextra{
        \pgfinterruptpath
        \draw[>=latex,|<->|] let
        \p1=($(\tikztostart)!2mm!90:(\tikztotarget)$),
        \p2=($(\tikztotarget)!2mm!-90:(\tikztostart)$)
        in(\p1) -- (\p2) node[pos=.5,sloped,above]{#1};
        \endpgfinterruptpath
      }(\tikztostart) -- (\tikztotarget) \tikztonodes
    }
  },
  dim below/.style={to path={\pgfextra{
        \pgfinterruptpath
        \draw[>=latex,|<->|] let 
        \p1=($(\tikztostart)!2mm!90:(\tikztotarget)$),
        \p2=($(\tikztotarget)!2mm!-90:(\tikztostart)$)
        in (\p1) -- (\p2) node[pos=.5,sloped,below]{#1};
        \endpgfinterruptpath
      }(\tikztostart) -- (\tikztotarget) \tikztonodes
    }
  },
}   

\begin{document}
  \begin{tikzpicture}

\draw[thick,-latex] (0,0,0) -- (4,0,0) node[anchor=north east]{$y$};
\draw[thick,-latex] (0,0,0) -- (0,7.5,0) node[anchor=north west]{$z$};
\draw[thick,-latex] (0,0,0) -- (0,0,5) node[anchor=south east]{$x$};

\fill[top color=gray!50!black,bottom color=blue!10,middle color=gray,shading=axis,opacity=0.25] (0,0) circle (2cm and 0.5cm);
\fill[left color=gray!50!black,right color=blue!50!black,middle color=gray!50,shading=axis,opacity=0.25] (2,0) -- (2,4) arc (360:180:2cm and 0.5cm) -- (-2,0) arc (180:360:2cm and 0.5cm);
\fill[top color=blue!90!,bottom color=blue!2,middle color=blue!30,shading=axis,opacity=0.25] (0,4) circle (2cm and 0.5cm);
\draw (-2,4) -- (-2,0) arc (180:360:2cm and 0.5cm) -- (2,4) ++ (-2,0) circle (2cm and 0.5cm);
\draw[densely dashed] (-2,0) arc (180:0:2cm and 0.5cm);

\fill[top color=gray!50!black,bottom color=orange!10,middle color=gray,shading=axis,opacity=0.5] (0,0) circle (1.5cm and 0.25cm);
\fill[left color=gray!50!black,right color=orange!50!black,middle color=gray!50,shading=axis,opacity=0.25] (2,0) -- (2,4) arc (360:180:2cm and 0.5cm) -- (-2,0) arc (180:360:2cm and 0.5cm);
\fill[top color=blue!90!,bottom color=orange!2,middle color=orange!30,shading=axis,opacity=0.25] (0,4) circle (1.5cm and 0.25cm);
\draw (-1.5,4) -- (-1.5,0) arc (180:360:1.5cm and 0.25cm) -- (1.5,4) ++ (-1.5,0) circle (1.5cm and 0.25cm);
\draw[densely dashed] (-1.5,0) arc (180:0:1.5cm and 0.25cm);

\draw (-2,0) to[dim above=$T$,color=orange] (-2,4) ;
\node at (-1.75,4) {$C$};
\node at (-0.75,4) {$P$};
\end{tikzpicture}  
\end{document}

在此处输入图片描述

相关内容