如何使用 TikZ 绘制贝壳?

如何使用 TikZ 绘制贝壳?

一开始,我尝试画一个与我想要的很不一样的圆柱体......

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4}
\usepackage{tikz-3dplot}
\tdplotsetmaincoords{60}{-30}
\tdplotsetrotatedcoords{0}{90}{90}%
\begin{document}
\begin{tikzpicture}
  [tdplot_rotated_coords,
    scale=3,
    mdc/.style={fill=blue, color=blue,draw=none, opacity=.4,line join=round},
    length/.style={<->,thick,line cap=round}]
  \def\d{1}
  \def\r{\d*.45}

    % Cylinder 
  \foreach \t in {0,12,...,348}
    \draw[mdc] ({cos(\t   )*\r+\d/2},  0, {sin(\t   )*\r+\d/2}) % side vertice of cylinder
            -- ({cos(\t+12)*\r+\d/2},  0, {sin(\t+12)*\r+\d/2})
            -- ({cos(\t+12)*\r+\d/2}, \d, {sin(\t+12)*\r+\d/2})
            -- ({cos(\t   )*\r+\d/2}, \d, {sin(\t   )*\r+\d/2})
            -- cycle;
\end{tikzpicture}
\end{document}

在此处输入图片描述

我很好奇是否可以用 TikZ 绘制贝壳图形(如下图所示),但上面的代码和下面的图形与我想要的完全不同......

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

答案1

我使用下面的代码,可能并不完美:

\documentclass{standalone}
\usepackage{tikz}
\tikzset{
pics/.cd,
shell/.style = {
    code = {
      \path [top color = black!25, bottom color = white]
        (0,.05*6/3) ellipse [x radius = 3-.05, y radius = 2-.032];
      \path [left color = black!25, right color = black!25, middle color = white]
        (-3,0) -- (-3,-2) arc (180:360:3 and 2)
               -- (3,0) arc (360:180:3 and 2);
      \foreach \r in {225,315}
        \foreach \i [evaluate = {\s=30;}] in {0,2,...,30}
          \fill [black, fill opacity = 1/50]
            (0,0.2) -- (\r+\s-\i:3 and 2) -- ++(0,-2)
            arc        (\r+\s-\i:\r-\s+\i:3 and 2) -- ++(0,2) -- cycle;
      \foreach \r in {45,135}
        \foreach \i [evaluate = {\s=30;}] in {0,2,...,30}
          \fill [black, fill opacity = 1/50]
            (0,0.2) -- (\r+\s-\i:3 and 2)
            arc (\r+\s-\i:\r-\s+\i:3 and 2)  -- cycle;
      \path [top color = white, bottom color = white]
        (0,.05*6/3) ellipse [x radius = 2-.05, y radius = 4/3-.05*4/3];
    }
  }
}
\begin{document}
\begin{tikzpicture}
  \path (0,0,0) pic {shell} ;
\end{tikzpicture}
\end{document}

壳

相关内容