# TikZ: How to extend the curve beyond the points

This example shows to draw some extra curve after the points by trial and error method.

Is there a specific tikz command to do it?

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
%
\begin{tikzpicture}
%
\coordinate (n_3) at (1,1);
\coordinate (h_1) at (1.5,3);
%dots
\fill[blue] (n_3) circle (2pt);
\fill[blue] (h_1) circle (2pt);
%Left curve
\draw (n_3) to [bend right=5](h_1);
\draw (n_3) -- ++(-0.2,-0.5);
\draw (h_1) -- ++(0.1,0.5);
%
\end{tikzpicture}
%
\end{document}


Blue dots are used to draw the curve. Now how to extend the curve after the blue dots?

-

Using shorten > = <negative length> and shorten < = <negative length> will extend the curve with curved line segments. If the distances are short, and the curvature is small, this might be all you need, however, as Altermundus pointed out, if your curvature is large, the line will not pass through the defined points any more.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\begin{document}
%
\begin{tikzpicture}
%
\coordinate (n_3) at (1,1);
\coordinate (h_1) at (3,1.5);
%dots
\fill[blue] (n_3) circle (2pt);
\fill[blue] (h_1) circle (2pt);
%Left curve
\draw [shorten >=-0.4cm,shorten <=-0.4cm] (n_3) to [bend right=5](h_1);
%
\end{tikzpicture}
%
\end{document}

-
Thank you... Jake – sandu Jun 5 '12 at 6:20
Bravo!! I was wrong because without [border=5mm] the picture is wrong. I think the bounding box is wrong. – Alain Matthes Jun 5 '12 at 6:32
@Altermundus: Yes, shorten doesn't affect the bounding box. I'm not sure if this is a bug or a feature... – Jake Jun 5 '12 at 6:36
@Jake The problem with the bounding box in this case is more important than the problem here : tex.stackexchange.com/questions/58292/… because the dimensions are sometimes larger. – Alain Matthes Jun 5 '12 at 7:04
@Jake The method doesn't work if you use [bend right=70] the points are not on the curve. I have also a problem in this case because I need to change the nodes. – Alain Matthes Jun 5 '12 at 7:20

Update

With [bend right=70] I need to adapt the nodes used at the end but the result is correct

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\coordinate (n_3) at (1,1);
\coordinate (h_1) at (1.5,3);

\fill[blue] (n_3) circle (2pt);
\fill[blue] (h_1) circle (2pt);

\draw (n_3) to [bend right=70]
node[pos=0,sloped,minimum width=.8cm] (n_3) {}
node[pos=1,sloped,minimum width=.8cm] (h_1) {}
(h_1) ;
\draw (n_3.center) --  (n_3.west);
\draw (h_1.center) --  (h_1.west);
\end{tikzpicture}

\end{document}


Actually with shorten and [bend right=70] we get

In other cases, with simple curves, I prefer Jake's answer but my first try with shorten was not efficient because I kept \documentclass{standalone} so I searched another way.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\coordinate (n_3) at (1,1);
\coordinate (h_1) at (1.5,3);

\fill[blue] (n_3) circle (2pt);
\fill[blue] (h_1) circle (2pt);

\draw (n_3) to [bend right=5]
node[pos=0,sloped,minimum width=.8cm] (n_3) {}
node[pos=1,sloped,minimum width=.8cm] (h_1) {}
(h_1) ;
\draw (n_3.center) --  (n_3.west);
\draw (h_1.center) --  (h_1.east);
\end{tikzpicture}

\end{document}


-

Here is another solution:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\begin{document}
%
\begin{tikzpicture}
%
\coordinate (n_3) at (1,2);
\coordinate (h_1) at (3,1.5);
%dots
\fill[blue] (n_3) circle (2pt);
\fill[blue] (h_1) circle (2pt);
%Left curve
\path  (n_3) to [bend right=10]coordinate[pos=1.5](end) coordinate[pos=-0.5](begin)(h_1)--(end);
\draw (begin) -- (n_3) to [bend right=10] (h_1) -- (end);
\end{tikzpicture}
%
\end{document}


-
sorry, the same as Altermundus! – rpapa Jun 5 '12 at 6:46
no, not exactly and I tried first this method but I had a problem. The method does not work with a big value [bend right=50] – Alain Matthes Jun 5 '12 at 7:21