# Draw a circle with a fixed but unknown radius

I want to draw a circle centered at a point O and passing through a second point A. This is easy if we have an explicit formula for the distance |OA|. In many cases, these two points are given as the intersections of some other objects and hence the distance between them is given implicitly (or very complicated). Could we still draw the circle using tikz using the location of the two points O and A?

• In section 74 Through Library of the pgfmanual you will find the answer. – user121799 May 3 at 20:18
• E.g. \documentclass[tikz,border=3.14mm]{standalone} \usetikzlibrary{through,intersections} \begin{document} \begin{tikzpicture} \draw[name path=upper] (0,0) coordinate(L1) to [bend right] (2,0) coordinate(R1); \draw[name path=lower] (0,-0.5) coordinate(L2) to [bend left] (2,-0.5) coordinate(R2); \draw[name intersections={of=upper and lower,name=i}] node[draw,circle through={(i-2)}] at (i-1){}; \end{tikzpicture} \end{document} has a circle with center at one intersection and running through the other intersection. – user121799 May 3 at 20:31

There are many options, out of which I list two.

1. There is a library specifically for that: through. It will produce circular nodes with the specified center whose border runs through the point.
2. With calc you can just compute the distance and use it for the radius. This may be useful if you want just the path, not the node.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{through,intersections,calc}
\begin{document}
\begin{tikzpicture}[font=\sffamily,circle defined by/.style args={center #1 and
point #2}{insert path={let \p1=($(#2)-(#1)$),\n1={veclen(\x1,\y1)} in
\begin{scope}[local bounding box=through]
\draw[name path=upper] (0,0) coordinate(L1) to [bend right] (2,0) coordinate(R1);
\draw[name path=lower] (0,-0.5) coordinate(L2) to [bend left] (2,-0.5) coordinate(R2);
\draw[name intersections={of=upper and lower,name=i}]
node[draw,circle through={(i-2)}] at (i-1){};
\end{scope}
\node[above] at (through.north){option 1: through};
\begin{scope}[local bounding box=calc,xshift=3cm]
\draw[name path=upper] (0,0) coordinate(L1) to [bend right] (2,0) coordinate(R1);
\draw[name path=lower] (0,-0.5) coordinate(L2) to [bend left] (2,-0.5) coordinate(R2);
\draw[name intersections={of=upper and lower,name=j},
circle defined by=center j-1 and point j-2];
\end{scope}
\node[above] at (calc.north){option 2: calc};
\end{tikzpicture}
\end{document} 