用一个计数器,每执行一次 mark,就增加 1,坐标点随之改变。
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{intersections,through,calc}
\newcounter{intercnt}
\begin{document}
\begin{tikzpicture}
\draw[->] (0,0) -- (8,0)node[right]{$X$};
\draw[->] (0,0) -- (0,3) node[right]{$Y$};
\draw [line width=1pt,name path=l] plot [domain=-0.16:3.6, samples=20] ({2*\x-0.2*(sin(atan(cos(\x r))))},{sin(\x r)+0.2*(cos(atan(cos(\x r))))});
\setcounter{intercnt}{0} % 初始化
\path [decorate, decoration={markings,
mark=between positions 0 and 1 step 1/5 with{
\stepcounter{intercnt} % 加 1
\edef\pointA{A-\arabic{intercnt}}
\edef\pointB{B-\arabic{intercnt}}
\draw[name path=v] (0,-5pt)--(0,26pt);
\draw [name intersections={of=v and l, by={\pointA}}][very thick,blue,fill=black] (\pointA) circle(2pt);
\draw [shift={(0,0)},teal!30,line width=0.5pt,name path=c](0,0)circle(0.6);
\draw [name intersections={of=v and c, by={\pointB}}][very thick,green,fill=black] (\pointB) circle(2pt);
}
}] {plot [domain=0:3.14, samples=10] ({2*\x-0.2*(sin(atan(cos(\x r))))},{sin(\x r)+0.2*(cos(atan(cos(\x r))))})};
\foreach \i in {1,...,\arabic{intercnt}}
{\node at (A-\i) {$A_\i$}; \node at (B-\i) {$B_\i$};};
\end{tikzpicture}
\end{document}
问 如何在path命令下生成的一系列交点,再次调取这些点(坐标)?