我有一张如下图所示的图片:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw(0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0);
\draw(0,0) arc(-90:90:2);
\draw[dashed](0,0) arc(-90:-270:2);
\draw(0,0) arc(180:90:4);
\draw(0,0) arc(180:90:4);
\draw[dashed](0,0) arc(-180:90:4);
\draw(4,0) arc(-90:-180:4);
\draw[dashed](4,0) arc(-90:180:4);
\end{tikzpicture}
\end{document}
现在我想在 3 个圆弧重叠的部分上画阴影,我该怎么做呢?就像这张图一样:
如果我想在 ABC 之间画线,该怎么办?非常感谢!
答案1
除了填充线的阴影之外,还有类似这样的填充。您可以在环境\clip
内部借助一些帮助进行填充scope
。要设置交叉点的坐标,请使用intersections
库。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns,intersections}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip(0,2) circle (2);
\clip(4,0) circle (4);
\fill[pattern=north west lines,pattern color=red](4,4) circle (4);
\end{scope}
%\draw(0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0);
\draw (0,0) rectangle (4,4);
\draw[name path=left](0,0) arc(-90:90:2);
\draw[dashed](0,0) arc(-90:-270:2);
\draw[name path=lower](0,0) arc(180:90:4);
%\draw(0,0) arc(180:90:4);
\draw[dashed](0,0) arc(-180:90:4);
\draw[name path=upper](4,0) arc(-90:-180:4);
\draw[dashed](4,0) arc(-90:180:4);
%%
\path [name intersections={of=lower and upper}];
\coordinate (A) at (intersection-1);
\path [name intersections={of=left and upper}];
\coordinate (B) at (intersection-1);
\path [name intersections={of=left and lower}];
\coordinate (C) at (intersection-2);
%%
\node[left,red] at (A) {A};
\node[below,red] at (B) {B};
\node[above,red] at (C) {C};
%%
\fill[blue,fill=blue,opacity=0.3] (A)--(B)--(C)--cycle;
\draw[blue,thick] (A)--(B)--(C)--cycle;
\end{tikzpicture}
\end{document}