added 233 characters in body
Source Link
Gonzalo Medina
  • 473.2k
  • 60
  • 1556
  • 1737

One option using the intersections library:

enter image description hereenter image description here

#The code:

\documentclass[border=5pt]{standalone} 
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{intersections,arrows.meta}

\newcommand\DrawArrows[5][0\NewDocumentCommand\DrawArrows{O{0.5]5}mmO{-latex}mm}{
\def\Step{#1}
\pgfmathsetmacro{\Second}{#4+\Step#5+\Step}
\foreach \Value [count=\xi] in {#4#5,\Second,...,#5#6}
  {
  \path[overlay,name path=line\xi] 
    (\Value,100) -- (\Value,-100);
  \path[name intersections={of=#2 and line\xi,by={1\xi}}];
  \path[name intersections={of=#3 and line\xi,by={2\xi}}];
  \ifdim#4pt<\Value\ifdim#5pt<\Value pt\relax
    \ifdim\Value pt<#5pt\relaxpt<#6pt\relax
    \draw[-latex]\draw[#4]
      (1\xi) -- (2\xi); 
  \fi\fi
  }
}

\begin{document}

\begin{tikzpicture}
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows{curve1}{curve2}{0}{7}  
\begin{scope}[xshift=8cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.25]{curve1}{curve2}[Stealth-Stealth,cyan]{0}{7}  
\end{scope}
\begin{scope}[yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[1]{curve2}{curve1}[ultra thick,orange,-{1Triangle[length=10pt]}]{60}{7}  
\end{scope}
\begin{scope}[xshift=8cm,yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.125]{curve2}{curve1}{2}{5}  
\end{scope}
\end{tikzpicture}

\end{document}

#Explanation The main command is \DrawArrows. You draw the two paths and name them <name1>, <name2>, and then you use

\DrawArrows{<name1>}{<name2>}{<start x-coordinate>}{<end x-coordinate>}

An optional first argument allows to control the step used for (the density of) the arrows and a second optional argument gives control over the arrow attributes (tip, color, line width, etc.).

One option using the intersections library:

enter image description here

#The code:

\documentclass[border=5pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{intersections}

\newcommand\DrawArrows[5][0.5]{
\def\Step{#1}
\pgfmathsetmacro{\Second}{#4+\Step}
\foreach \Value [count=\xi] in {#4,\Second,...,#5}
{
  \path[overlay,name path=line\xi] 
    (\Value,100) -- (\Value,-100);
  \path[name intersections={of=#2 and line\xi,by={1\xi}}];
  \path[name intersections={of=#3 and line\xi,by={2\xi}}];
  \ifdim#4pt<\Value pt\relax
    \ifdim\Value pt<#5pt\relax
    \draw[-latex]
      (1\xi) -- (2\xi); 
  \fi\fi
}
}

\begin{document}

\begin{tikzpicture}
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows{curve1}{curve2}{0}{7}  
\begin{scope}[xshift=8cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.25]{curve1}{curve2}{0}{7}  
\end{scope}
\begin{scope}[yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[1]{curve2}{curve1}{1}{6}  
\end{scope}
\begin{scope}[xshift=8cm,yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.125]{curve2}{curve1}{2}{5}  
\end{scope}
\end{tikzpicture}

\end{document}

#Explanation The main command is \DrawArrows. You draw the two paths and name them <name1>, <name2>, and then you use

\DrawArrows{<name1>}{<name2>}{<start x-coordinate>}{<end x-coordinate>}

An optional argument allows to control the step used for (the density of) the arrows.

One option using the intersections library:

enter image description here

#The code:

\documentclass[border=5pt]{standalone} 
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{intersections,arrows.meta}

\NewDocumentCommand\DrawArrows{O{0.5}mmO{-latex}mm}{
\def\Step{#1}
\pgfmathsetmacro{\Second}{#5+\Step}
\foreach \Value [count=\xi] in {#5,\Second,...,#6}
  {
  \path[overlay,name path=line\xi] 
    (\Value,100) -- (\Value,-100);
  \path[name intersections={of=#2 and line\xi,by={1\xi}}];
  \path[name intersections={of=#3 and line\xi,by={2\xi}}];
  \ifdim#5pt<\Value pt\relax
    \ifdim\Value pt<#6pt\relax
    \draw[#4]
      (1\xi) -- (2\xi); 
  \fi\fi
  }
}

\begin{document}

\begin{tikzpicture}
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows{curve1}{curve2}{0}{7}  
\begin{scope}[xshift=8cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.25]{curve1}{curve2}[Stealth-Stealth,cyan]{0}{7}  
\end{scope}
\begin{scope}[yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[1]{curve2}{curve1}[ultra thick,orange,-{Triangle[length=10pt]}]{0}{7}  
\end{scope}
\begin{scope}[xshift=8cm,yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.125]{curve2}{curve1}{2}{5}  
\end{scope}
\end{tikzpicture}

\end{document}

#Explanation The main command is \DrawArrows. You draw the two paths and name them <name1>, <name2>, and then you use

\DrawArrows{<name1>}{<name2>}{<start x-coordinate>}{<end x-coordinate>}

An optional first argument allows to control the step used for (the density of) the arrows and a second optional argument gives control over the arrow attributes (tip, color, line width, etc.).

added 605 characters in body
Source Link
Gonzalo Medina
  • 473.2k
  • 60
  • 1556
  • 1737

One option using the intersections library:

[![enter image description here][1]][1]enter image description here

The#The code:

\documentclass[border=5pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{intersections}

\newcommand\DrawArrows[5][0.5]{
\def\Step{#1}
\pgfmathsetmacro{\Second}{#4+\Step}
\foreach \Value [count=\xi] in {#4,\Step\Second,...,#5}
{
  \path[overlay,name path=line\xi] 
    (\Value,100) -- (\Value,-100);
  \path[name intersections={of=#2 and line\xi,by={1\xi}}];
  \path[name intersections={of=#3 and line\xi,by={2\xi}}];
  \ifdim#4pt<\Value pt\relax
    \ifdim\Value pt<#5pt\relax
    \draw[-latex]
      (1\xi) -- (2\xi); 
  \fi\fi
}
}

\begin{document}

\begin{tikzpicture}
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows{curve1}{curve2}{0}{7}  
\begin{scope}[xshift=8cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.25]{curve1}{curve2}{0}{7}  
\end{scope}
\begin{scope}[yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[1]{curve2}{curve1}{1}{6}  
\end{scope}
\begin{scope}[xshift=8cm,yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.125]{curve2}{curve1}{2}{5}  
\end{scope}
\end{tikzpicture}

\end{document}

The#Explanation The main command is \DrawArrows. You draw the two paths and name them <name1>, <name2>, and then you use

\DrawArrows{<name1>}{<name2>}{<start x-coordinate>}{<end x-coordinate>}

An optional argument allows to control the step used for (the density of) the arrows. [1]: http://i.stack.imgur.com/FazPC.png

One option using the intersections library:

[![enter image description here][1]][1]

The code:

\documentclass[border=5pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{intersections}

\newcommand\DrawArrows[5][0.5]{
\def\Step{#1}
\foreach \Value [count=\xi] in {#4,\Step,...,#5}
{
\path[overlay,name path=line\xi] 
  (\Value,100) -- (\Value,-100);
\path[name intersections={of=#2 and line\xi,by={1\xi}}];
\path[name intersections={of=#3 and line\xi,by={2\xi}}];
\ifdim#4pt<\Value pt\relax
  \ifdim\Value pt<#5pt\relax
\draw[-latex]
  (1\xi) -- (2\xi); 
\fi\fi
}
}

\begin{document}

\begin{tikzpicture}
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows{curve1}{curve2}{0}{7}  
\begin{scope}[xshift=8cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.25]{curve1}{curve2}{0}{7}  
\end{scope}
\end{tikzpicture}

\end{document}

The main command is \DrawArrows. You draw the two paths and name them <name1>, <name2>, and then you use

\DrawArrows{<name1>}{<name2>}{<start x-coordinate>}{<end x-coordinate>}

An optional argument allows to control the step used for (the density of) the arrows. [1]: http://i.stack.imgur.com/FazPC.png

One option using the intersections library:

enter image description here

#The code:

\documentclass[border=5pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{intersections}

\newcommand\DrawArrows[5][0.5]{
\def\Step{#1}
\pgfmathsetmacro{\Second}{#4+\Step}
\foreach \Value [count=\xi] in {#4,\Second,...,#5}
{
  \path[overlay,name path=line\xi] 
    (\Value,100) -- (\Value,-100);
  \path[name intersections={of=#2 and line\xi,by={1\xi}}];
  \path[name intersections={of=#3 and line\xi,by={2\xi}}];
  \ifdim#4pt<\Value pt\relax
    \ifdim\Value pt<#5pt\relax
    \draw[-latex]
      (1\xi) -- (2\xi); 
  \fi\fi
}
}

\begin{document}

\begin{tikzpicture}
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows{curve1}{curve2}{0}{7}  
\begin{scope}[xshift=8cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.25]{curve1}{curve2}{0}{7}  
\end{scope}
\begin{scope}[yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[1]{curve2}{curve1}{1}{6}  
\end{scope}
\begin{scope}[xshift=8cm,yshift=-5cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.125]{curve2}{curve1}{2}{5}  
\end{scope}
\end{tikzpicture}

\end{document}

#Explanation The main command is \DrawArrows. You draw the two paths and name them <name1>, <name2>, and then you use

\DrawArrows{<name1>}{<name2>}{<start x-coordinate>}{<end x-coordinate>}

An optional argument allows to control the step used for (the density of) the arrows.

Source Link
Gonzalo Medina
  • 473.2k
  • 60
  • 1556
  • 1737

One option using the intersections library:

[![enter image description here][1]][1]

The code:

\documentclass[border=5pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{intersections}

\newcommand\DrawArrows[5][0.5]{
\def\Step{#1}
\foreach \Value [count=\xi] in {#4,\Step,...,#5}
{
\path[overlay,name path=line\xi] 
  (\Value,100) -- (\Value,-100);
\path[name intersections={of=#2 and line\xi,by={1\xi}}];
\path[name intersections={of=#3 and line\xi,by={2\xi}}];
\ifdim#4pt<\Value pt\relax
  \ifdim\Value pt<#5pt\relax
\draw[-latex]
  (1\xi) -- (2\xi); 
\fi\fi
}
}

\begin{document}

\begin{tikzpicture}
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows{curve1}{curve2}{0}{7}  
\begin{scope}[xshift=8cm]
\draw[name path=curve1,ultra thick]
  (0,0) .. controls ++(1,5) and ++(0,3) .. (7,2);
\draw[name path=curve2,ultra thick]
  (0,0) -- (7,2);
\DrawArrows[0.25]{curve1}{curve2}{0}{7}  
\end{scope}
\end{tikzpicture}

\end{document}

The main command is \DrawArrows. You draw the two paths and name them <name1>, <name2>, and then you use

\DrawArrows{<name1>}{<name2>}{<start x-coordinate>}{<end x-coordinate>}

An optional argument allows to control the step used for (the density of) the arrows. [1]: http://i.stack.imgur.com/FazPC.png