这是一个示例文档和我从中获得的输出。
\documentclass[convert={size=480}]{standalone}
\usepackage{tikz}
\tikzset{ little circle/.style = { fill = black,
shape = circle,
minimum size = 1.5mm,
inner sep = 0mm,
outer sep = 0mm},
concentric circles/.style = {draw = gray!90, very thick}}
\begin{document}
\begin{tikzpicture}
\def\concentriccircles{\foreach \r in {1.5, ..., 19} {circle (\r mm)};}
\foreach \name/\x/\y in {A/8/30, B/16/-24, C/-30/8} {
\node [little circle] (\name) at (\x mm, \y mm) {};
}
\node [little circle] (P) at (barycentric cs:A=1,B=1,C=1) {};
\foreach \name/\origin/\destination in {H/A/B, J/B/C, K/C/A} {
\path (\origin) -- (\destination) coordinate [midway] (\name);
\path (P) -- (\name) node [pos = 1.6, little circle] (\name 2) {};
}
\draw [concentric circles] (P) \concentriccircles;
\foreach \x/\y/\v/\c in {A/B/H/green, B/C/J/red, C/A/K/blue} {
\begin{scope}
\clip (\x) .. controls (P) .. (\y) -- (\v 2) -- (\x); % (*)
\draw [concentric circles, draw = \c] (P) \concentriccircles;
\end{scope}
}
\begin{scope}[very thick]
\foreach \x/\y/\c in {A/B/red, B/C/blue, C/A/green} {
\draw [\c] (\x) .. controls (P) .. (\y);
}
\end{scope}
\begin{scope}[very thick, red]
\path [use as bounding box];
\clip (A) circle [radius = 25mm];
\draw (A) .. controls (P) .. (B);
\end{scope}
\end{tikzpicture}
\end{document}
我不明白为什么剪辑区域不包括三角形(A, B, H2)
((B, C, J2)
和(C, A, K2)
)。您可以看到它确实如此,因为 A 和 B(B 和 C,C 和 A)之间的线以外的同心圆仍然是灰色的。
编辑
draw
如果您将选项添加到\clip
命令中,它看起来会是这样的(*)
。
答案1
如果你用节点构建一条路径,TikZ 会把这条路径切成几段以避免节点的内容。
要构建封闭的剪切路径,请使用坐标而不是节点...或者使用,,,\x.center
等。\y.center
\v 2.center
\documentclass[convert={size=480}]{standalone}
\usepackage{tikz}
\tikzset{ little circle/.style = { fill = black,
shape = circle,
minimum size = 1.5mm,
inner sep = 0mm,
outer sep = 0mm},
concentric circles/.style = {draw = gray!90, very thick}}
\begin{document}
\begin{tikzpicture}
\def\concentriccircles{\foreach \r in {1.5, ..., 19} {circle (\r mm)};}
\foreach \name/\x/\y in {A/8/30, B/16/-24, C/-30/8} {
\node [little circle] (\name) at (\x mm, \y mm) {};
}
\node [little circle] (P) at (barycentric cs:A=1,B=1,C=1) {};
\foreach \name/\origin/\destination in {H/A/B, J/B/C, K/C/A} {
\path (\origin) -- (\destination) coordinate [midway] (\name);
\path (P) -- (\name) node [pos = 1.6, little circle] (\name 2) {};
}
\draw [concentric circles] (P) \concentriccircles;
\foreach \x/\y/\v/\c in {A/B/H/green, B/C/J/red, C/A/K/blue} {
\begin{scope}
\clip (\x.center) .. controls (P.center) .. (\y.center)
-- (\v 2.center) -- cycle; % (*)
\draw [concentric circles, draw = \c] (P) \concentriccircles;
\end{scope}
}
\begin{scope}[very thick]
\foreach \x/\y/\c in {A/B/red, B/C/blue, C/A/green} {
\draw [\c] (\x) .. controls (P) .. (\y);
}
\end{scope}
\begin{scope}[very thick, red]
\path [use as bounding box];
\clip (A) circle [radius = 25mm];
\draw (A) .. controls (P) .. (B);
\end{scope}
\end{tikzpicture}
\end{document}