I am trying to construct a tangent line to the dashed curve but TeX is telling me that No shape named intersection-2 is known.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, intersections, arrows}
\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45]
\coordinate (P1) at (2, -1);
\coordinate (P2) at (6, -1);
\coordinate (E) at (4, -1);
\draw (E) -- ++(150:6cm) node[pos =.5, scale = .7,
fill = white, inner sep = 0cm] {402,000 km} coordinate (M);
\draw[name path = line1, dashed] (3, -2) .. controls (5.8, -1.25) and
(5, 0) .. (M);
\draw (P1) -- (P2);
\draw[-latex] (5, -1) arc (0:150:1cm) node[above = 1pt, scale = .75]
at (4.25, 0) {$$150^{\circ}$$};
\path[name path = aux] (M) circle [radius = 1bp];
\draw[name intersections = {of = line1 and aux}, -latex, red, thick] (M)
-- ($(intersection-1)!.75cm!(intersection-2)$);
\end{tikzpicture}
\end{document}

The line line1 should intersect the circle aux but apparently it is only intersecting once. What can I do to fix this?

-

You can make the aux circle visible by adding draw to the options. Then you'll see that there is indeed no second intersection, because the point is right at the end of the curve.

You can draw the tangent line in this case by replacing intersection-2 with the tangent point M itself:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, intersections, arrows}
\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45]
\coordinate (P1) at (2, -1);
\coordinate (P2) at (6, -1);
\coordinate (E) at (4, -1);
\draw (E) -- ++(150:6cm) node[pos =.5, scale = .7,
fill = white, inner sep = 0cm] {402,000 km} coordinate (M);
\draw[name path = line1, dashed] (3, -2) .. controls (5.8, -1.25) and
(5, 0) .. (M);
\draw (P1) -- (P2);
\draw[-latex] (5, -1) arc (0:150:1cm) node[above = 1pt, scale = .75]
at (4.25, 0) {$$150^{\circ}$$};
\path[draw, name path = aux] (M) circle [radius = 1bp];
\draw[name intersections = {of = line1 and aux}, -latex, red, thick] (M)
-- ($(intersection-1)!.75cm!(M)$);
\end{tikzpicture}
\end{document}
-
I thought about doing something like that but wasn't sure about it. –  dustin Jun 26 '13 at 2:15
Using ($(intersection-1)!.75cm!(intersection-2)$) would give you a slightly more accurate approximation of the tangent direction, but for slight curves like this one, it really makes no difference. –  Jake Jun 26 '13 at 2:16