我在这个论坛上找到了多个“解决方案”,但它们要么不能完全满足我的要求,要么根本无法以任何形式重现。
我有这个 tikzpicture:
我想要填充的区域(用浅灰色和深灰色巧妙标记)。
代码
\begin{tikzpicture}
\begin{scope}
%outer shape
\clip (-8,0) arc (180:-180:8cm and 6cm)coordinate[pos=0.03] (A)coordinate[pos=0.47] (B)coordinate[pos=0.53] (C)coordinate[pos=0.97] (D);
\draw [name path = outer,line width = 1](-8,0) arc (180:-180:8cm and 6cm);
%inner cutout
\draw (-3,.2) .. controls (-2,-0.3) and (-1,-0.5) .. (0,-.5) .. controls (1,-0.5) and (2,-0.3) .. (3,0.2);
\draw (-2.3,-0.1) .. controls (-1.5,0.3) and (-1,0.5) .. (0,.5) .. controls (1,0.5) and (1.5,0.3) .. (2.3,-0.1);
\draw (-8,0) arc (180:-180:8cm and 4cm);
%scope for shading the outer band
\begin{scope}
\draw [dashed, name path = upper lower]let \p1 = (A),\p2 = (B) in (A) arc (180:360:{\x2/2 - \x1/2} and {\x2/4 - \x1/4});
\draw [dashed, name path = upper upper]let \p1 = (A),\p2 = (B) in (A) arc (-180:-360:{\x2/2 - \x1/2} and {\x2/4 - \x1/4});
\draw [dashed, name path = lower upper]let \p1 = (C),\p2 = (D) in (C) arc (180:360:{\x2/2 - \x1/2} and {\x2/4 - \x1/4});
\draw [dashed, name path = lower lower]let \p1 = (C),\p2 = (D) in (C) arc (-180:-360:{\x2/2 - \x1/2} and {\x2/4 - \x1/4});
\end{scope}
\end{scope}
\end{tikzpicture}