我想使用 tikz 绘制此图形。但是我不知道如何在 Tikz 中绘制弯曲圆柱体。
有人能给出提示吗?谢谢
答案1
如果移除两条曲线的中间点并稍微调整角度,效果会更好,如下所示:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[xscale=0.9]
\shadedraw[shading=axis] (0,0) to[out=20,in=160] (10,0)--(10,0.5) to[out=160,in=20] (0,0.5)--cycle;
\draw(5,1.25) circle[x radius=1.5mm, y radius=2.5mm];
\end{tikzpicture}
\end{document}
此外,对于弯曲圆柱体的部分,您可以集成以下部分代码(虽然我忽略了阴影):
\documentclass[12pt,border=0.125cm]{standalone}
\usepackage{tikz,pgfplots}
\usepackage{xifthen}
\begin{document}
\def\sp{4mm}% adjust to scale
\begin{tikzpicture}[>=latex,line width=0.7pt,line cap=round]
\foreach \yshft in {0,7,-7}{
\begin{scope}[yshift=\yshft*\sp]
\node(e)[draw,xscale=1.8,yscale=3,circle,minimum size=2*\sp,outer sep=0pt,inner sep=0pt]at(3*\sp,0){};
\coordinate (A) at ([xshift=-7*\sp]e.north);
\coordinate (B) at ([xshift=-7*\sp]e.south);
\draw (e.north)--(e.south);
\draw (A)--(e.north);
\draw (B)--(e.south);
\draw (-4*\sp, 3*\sp).. controls (-4.5*\sp,3*\sp) and(-5*\sp, 2*\sp)..(-4*\sp,0*\sp);
\draw (-4*\sp,-3*\sp).. controls (-4.5*\sp,-3*\sp)and(-5*\sp,-2*\sp)..(-4*\sp,0*\sp);
\draw (-4*\sp, 3*\sp).. controls (-3.5*\sp,3*\sp) and(-3*\sp, 2*\sp)..(-4*\sp,0*\sp);
\ifthenelse{\yshft=0} {}{
\foreach \y in {-9,-8,...,-1,1,2,...,9}{
\draw [->](3*\sp, \y/3)-- ++(\y/21*\yshft, 0);}};
\end{scope}
}
\end{tikzpicture}
\end{document}
输出如下:
答案2
您可以从这样的事情开始。
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\shadedraw[shading=axis] (0,0) to[out=15,in=180] (5,1) to[out=0,in=165] (10,0)--(10,0.5) to[out=165,in=0] (5,1.5) to [out=180,in=15] (0,0.5)--cycle;
\draw(5,1.25) circle[x radius=1mm, y radius=2.5mm];
\end{tikzpicture}
\end{document}