我有一張圖片如下:
\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}