如何在两条路径之间绘制向内的箭头,如下图所示?
答案1
这是一个使用选项hobby
对于“波浪形”曲线,intersections
库用于确定曲线上的适当点,decorations.markings
库用于将箭头放置在曲线之间线段的中间;这些线段对应于从圆心延伸出的线的部分:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby,intersections,decorations.markings}
\begin{document}
\begin{tikzpicture}[
decoration={
markings,
mark= at position 0.5 with {\arrow{latex}}
},
line width=1pt
]
\draw[name path=circle]
(0,0) circle [radius=3cm];
\begin{pgfinterruptboundingbox}
\draw[name path=curve,orange!70!black]
(4,1) to[closed, curve through={
(3,4) .. (2,4) .. (0,5) .. (-4,0) .. (1,-5) .. (0,-3) .. (2,-5) .. (4,-3) .. (2,0)}] cycle;
\end{pgfinterruptboundingbox}
\foreach \Angulo in {0,10,...,360}
{
\path[overlay,name path=line-\Angulo] (0,0) -- (\Angulo:10cm);
\path[overlay,name intersections={of=circle and line-\Angulo,name=i}]
(0,0) -- (\Angulo:10cm);
\path[overlay,name intersections={of=curve and line-\Angulo,name=j}]
(0,0) -- (\Angulo:10cm);
\draw[blue!70!black,postaction=decorate] (j-1) -- (i-1);
}
\end{tikzpicture}
\end{document}
答案2
这应该能给你一些想法。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\foreach \x in {1,...,10}{
\draw (4,0) arc(0:360:4cm) node[coordinate,pos=0.\x] (a-\x) {};
\draw[thick, red]
(3,2) arc(0:360:4cm) node[coordinate,pos=0.\x] (b-\x) {};
\draw[decoration={markings, mark=at position 0.5 with
{\arrow{latex}}},
postaction={decorate}] (b-\x) -- (a-\x);
}
\end{tikzpicture}
\end{document}
这是一条更加弯曲的线hobby
。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby,decorations.markings}
\begin{document}
\begin{tikzpicture}
\foreach \x in {1,...,10}{
\draw (4,0) arc(0:360:4cm) node[coordinate,pos=0.\x] (a-\x) {};
\draw[thick, red,decoration={markings, mark=at position 0.\x with
{\node[fill,circle,inner sep=2pt,pos=0.\x] (b-\x) {};}},
postaction={decorate}]
(4,1) to[closed, curve through={(3,4) .. (1,3) ..
(-2,5)..(-5,0)..(-3,-5)..(0,-3)..(2,-5)..(3,-3)}] cycle;
\draw[decoration={markings, mark=at position 0.5 with
{\arrow{latex}}},
postaction={decorate}] (a-\x) -- (b-\x);
}
\end{tikzpicture}
\end{document}