答案1
另一个 tikz 解决方案。它使用calc
库来绘制一些坐标和等号。显然,它patterns
也需要库。
\documentclass[border=2mm]{standalone}
\usepackage {tikz}
\usetikzlibrary{calc}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}[scale=1.25,line join=round]
% coordinates
\coordinate (O) at (0,0);
\coordinate (O') at ({3*sqrt(2)},0);
\coordinate (T) at ({sqrt(2)},0);
\coordinate (P) at ({1.5*sqrt(2)},{sqrt(3.5)});
\coordinate (M) at ($(O) !0.4!(P)$); % blue mark
\coordinate (N) at ($(O')!0.4!(P)$); % blue mark
% shaded region
\fill[pattern=north west lines,pattern color=red] (O) -- (O') -- (P) -- cycle;
% circles
\draw[fill=white] (O) circle ({sqrt(2)});
\draw[fill=white] (O') circle ({2*sqrt(2)});
\draw[gray,dashed] ($(P)-({2*sqrt(2)},0)$) arc (180:360:{2*sqrt(2)});
% triangle and blue marks
\draw (O) -- (O') -- (P) -- cycle;
\draw[blue,thick] ($(M)!0.15cm!270:(P)$) -- ($(M)!0.15cm!90:(P)$);
\draw[blue,thick] ($(N)!0.15cm!270:(P)$) -- ($(N)!0.15cm!90:(P)$);
% points and nodes
\fill (O) circle (1pt) node [below] {$O$};
\fill (O') circle (1pt) node [below] {$O'$};
\fill (T) circle (1pt);
\fill (P) circle (1pt) node [above] {$P$};
\node at ($(O)!0.5!(T)$) [below] {$\sqrt{2}$};
\node at ($(T)!0.5!(O')$) [below] {$2\sqrt{2}$};
\end{tikzpicture}
\end{document}
答案2
您可以使用pedeven odd rule
内的 d 路径组合来绘制填充区域。有关详细信息,请查看代码中的注释。clip
scope
添加标签非常简单/基本,您应该能够自己完成。如果不会,请查看 TikZ 手册 (pgfmanual.pdf) 中的教程。
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
% (for debugging purposes only)
\usetikzlibrary{backgrounds}
\begin{document}
\begin{tikzpicture}
% (so we don't have to repeat the coordinates over and over again)
\coordinate (A) at (0,-1);
\coordinate (B) at (4.9,0);
\coordinate (C) at (2.65,2);
% (create some "abbreviations for the pathes)
\newcommand{\Triangle}{(A) -- (B) -- (C) -- cycle}
\newcommand{\CircleA}{(A) circle [radius=2]}
\newcommand{\CircleB}{(B) circle [radius=3]}
% draw the stuff
\draw
\Triangle
\CircleA
\CircleB
;
% draw the filling
\begin{scope}
\clip \Triangle;
\fill[
even odd rule,
gray,
]
\Triangle
\CircleA
\CircleB
;
\end{scope}
% -------------------------------------------------------------------------
% for debugging purposes to prove that no white filling is needed
\begin{scope}[on background layer={color=yellow}]
\fill (current bounding box.south west)
rectangle (current bounding box.north east);
\end{scope}
% -------------------------------------------------------------------------
\end{tikzpicture}
\end{document}
答案3
这是一种使用的方法元帖子包裹在 中luamplib
。您需要用 来编译它lualatex
。
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path c, c';
c = fullcircle scaled 144;
c' = c scaled 2; c' := c' shifted (point 0 of c - point 4 of c');
numeric t, u;
(t, whatever) = c' intersectiontimes c' shifted - center c';
(u, whatever) = c intersectiontimes (center c -- point t of c');
path s;
s = subpath (0, u) of c -- subpath (t, 4) of c' -- cycle;
% leave this out if you do not want the shade in region s
for i=0 upto 50:
draw (left--right) scaled 200 rotated 135 shifted (4i, 0) withcolor 1/2[blue, white];
endfor
clip currentpicture to s;
draw c' shifted (point t of c' - center c') withcolor 15/16;
draw c withcolor 2/3 blue;
draw c' withcolor 2/3 blue;
draw center c -- center c' -- point t of c' -- cycle;
dotlabel.llft("$O$", center c);
dotlabel.lrt("$O'$", center c');
dotlabel.ulft("$P$", point t of c');
label.bot("$\sqrt2$", 1/2[center c, point 0 of c]);
label.bot("$2\sqrt2$", 1/2[center c', point 4 of c']);
endfig;
\end{mplibcode}
\end{document}
答案4
如果您的问题仅涉及阴影空间,而不涉及确切的尺寸、标签等,我有一个可能的解决方案。
你可以使用tikz
库来实现这一点。我的方法是让三角形完全充满图案,然后用\clip
白色填充三角形与圆圈相交的空间。
以下是代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
% Draw triangle completely filled with patterns
\draw[pattern=north west lines] (0,-1) -- (4.9, 0) -- (2.65, 2) -- (0,-1);
% Remove patterns inside left circle and draw left circle
\begin{scope}
\clip (0,-1) circle (2);
\draw[fill=white] (0,-1) -- (4.9, 0) -- (2.65, 2) -- (0,-1);
\end{scope}
\draw (0,-1) circle (2);
% Remove patterns inside right circle and draw right circle
\begin{scope}
\clip (4.9,0) circle (3);
\draw[fill=white] (0,-1) -- (4.9, 0) -- (2.65, 2) -- (0,-1);
\end{scope}
\draw (4.9,0) circle (3);
\end{tikzpicture}
\end{document}