# How exactly do “in=angle” and “out=angle” translate to the path in TIKZ

I would like to know what exactly do the parameters in and out map to the path used.

Specifically, say I draw a path with

\begin{tikzpicture}
\draw (0,0) to [in=30, out=40] (5,0);
\end{tikzpicture}


How could I draw the same path using controls, if possible.

In the manual I only managed to find that using in and out in the to specification translates to using a special path, but I couldn't find exactly which path and I am not sufficiently versed in TeX to read the sources.

-

The controls may be expressed as points relative to the start and end points, and this may be done in polar form. The first control has angle of out and the second angle of in. Now in the abscence of other options the length of the controls are equal to 0.3915 times the distance between the start and end points. Thus in your case the distance is 5 and the control length is 1.9675:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\draw[blue] (0,0) to [in=30, out=40] (5,0);
\draw[red,dashed] (0,0) .. controls +(40:1.9675) and +(30:1.9575) .. (5,0);
\end{tikzpicture}

\end{document}


The number 0.3915 may be found in the file tikztopathslibrary.code.tex. The manual states that it is chosen so one gets an approximate quarter circle when the directions are at right angles. If a different value of looseness is specified, this is used to scale this factor.

-