# Family of curved lines with perpendicular curved lines

I'm trying to draw the below image:

The only approach I have is to draw multiple lines of the sort

  \draw[->] (0,0) to[out=60,in=-150] (1,1);
\draw (1,1) to[out=30,in=180] (2,1.3);


I've realized that it'll be extremely difficult to draw this diagram through this approach. I could use commands of the sort:

\draw (0.1,1) .. controls (0.2,3.5) .. (0.8,4);


But I believe this will be similarly difficult. Is there a better way? Many thanks.

• There is theoretically a better way, but I am unsure whether it is useful for you. You would need the differential equation for the horizontal lines, and from that, you can calculate what is called the orthogonal trajectories. This is the set of curves which is perpendicular to each curve in your original set of curves. Then use e.g. gnuplot or tikz to draw both curve sets. – T. Pluess Sep 30 '18 at 10:54

From your description I take you want to have a cartoon. This is rather easy to accomplish.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\tikzset{mark steps/.style={postaction={decorate,decoration={markings,
mark=between positions 0 and 1 step 0.1
with  {\coordinate(X-#1-\pgfkeysvalueof{/pgf/decoration/mark
info/sequence number});}}}}
}
% https://tex.stackexchange.com/a/39282/121799
\tikzset{->-/.style={decoration={
markings,
mark=at position .5 with {\arrow{latex}}},postaction={decorate}}}

\begin{document}
\begin{tikzpicture}
\draw[mark steps=left] (0,0) to[out=-90,in=45] ++(-1,-1.8) to[out=-135,in=90]
++(-1,-1.8)  coordinate (X-left-end);
\draw[mark steps=right] (4,-1) to[out=-90,in=45] ++(-1,-1.8) to[out=-135,in=90]
++(-1,-1.8)  coordinate (X-right-end);
\foreach \X in {1,...,10}
{\draw[->-] (X-left-\X) to[out=20,in=150] (X-right-\X);}
\draw[->-,postaction={decorate,decoration={markings,
mark=at position 0.7 with {\coordinate (X);}}}] (X-left-end) to[out=20,in=150] (X-right-end);
\draw[very thick,shorten >=-3pt,shorten <=-3pt] (X) to[out=90,in=-135] ++(1,1.8)
to[out=45,in=-90]
++(1,1.8);
\end{tikzpicture}
\end{document}


Of course, if you want more than a cartoon, then you might want to define a function that parametrizes the family of curves.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.markings}

% https://tex.stackexchange.com/a/39282/121799
\tikzset{->-/.style={decoration={
markings,
mark=at position .5 with {\arrow{latex}}},postaction={decorate}}}

\begin{document}
\begin{tikzpicture}[declare function={f(\x,\y)=0.5*sin(deg(\y))-0.15*\x*\x;}]
\tdplotsetmaincoords{60}{20}
\begin{scope}[tdplot_main_coords]
\draw  plot[domain=0:2*pi,variable=\y]   (-2,\y,{f(-2,\y)});
\draw plot[domain=0:2*pi,variable=\y]   (2,\y,{f(2,\y)});
\foreach \Y in {0,...,10}
{\draw[->-] plot[domain=-2:2,variable=\x]
(\x,{0.2*\Y*pi},{f(\x,{0.2*\Y*pi})});}
\draw[very thick] plot[domain=-0.2:{2*pi+0.2},variable=\y] (1,\y,{f(1,\y)});
\end{scope}
\end{tikzpicture}
\end{document}


This will then allow you to produce the mandatory animation.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.markings}

% https://tex.stackexchange.com/a/39282/121799
\tikzset{->-/.style={decoration={
markings,
mark=at position .5 with {\arrow{latex}}},postaction={decorate}}}

\begin{document}
\foreach \X in {0,10,...,350}
{\begin{tikzpicture}[declare function={f(\x,\y)=0.5*sin(deg(\y))-0.15*\x*\x;}]
\tdplotsetmaincoords{70+10*sin(\X)}{\X}
\path[clip] (-6,-4) rectangle (6,4);
\begin{scope}[tdplot_main_coords]
\draw  plot[domain=0:2*pi,variable=\y]   (-2,\y,{f(-2,\y)});
\draw plot[domain=0:2*pi,variable=\y]   (2,\y,{f(2,\y)});
\foreach \Y in {0,...,10}
{\draw[->-] plot[domain=-2:2,variable=\x]
(\x,{0.2*\Y*pi},{f(\x,{0.2*\Y*pi})});}
\draw[very thick] plot[domain=-0.2:{2*pi+0.2},variable=\y] (1,\y,{f(1,\y)});
\end{scope}
\end{tikzpicture}}
\end{document}


• this is extremely useful, thank you very much! – Ali Khan Sep 30 '18 at 16:27
• @AliKhan I added a version which is really a family of curves. This will allow you to plot whatever family of curves you want. (BTW, if this answer solves your problem, you may want to consider accepting it by clicking the check mark left of it.) – user121799 Sep 30 '18 at 17:43