[Tex/LaTex] Drawing a circle through 3 non-collinear points

tikz-pgf

Does circle through works with 3 points:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,through}
\begin{document}
    \begin{tikzpicture}
    \coordinate (A) at (1,1);
    \coordinate (B) at (2,2);
    \coordinate (C) at (3,1.5);

    \node[draw,line width=2pt] [circle through={(A)(B)(C)}] {};

    \foreach \i in {A,B,C} {
        \node[circle,minimum size=1pt,fill=red] at(\i) {};
    }
    \end{tikzpicture}
\end{document}

I want to draw a circle through A,B and C.

enter image description here

Best Answer

The tkz-euclide package has a macro to do this. The manual is written in French.

  1. First, we define the circle with the macro \tkzDefCircle.
  2. This macro returns two values that are the center recovered with the macro \tkzGetPoint{O}
  3. and the radius that is recovered with the macro \tkzGetLength{rayon}.

Once this is done, we draw the circle with the macro \tkzDrawCircle[R](O,\rayon pt)

cercle circonscrit

\documentclass[tikz,border=5mm]{standalone}
%\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,through}
\begin{document}
    \begin{tikzpicture}
    \coordinate (A) at (1,1);
    \coordinate (B) at (2,2);
    \coordinate (C) at (3,1.5);

%    \node[draw,line width=2pt] [circle through={(A)(B)(C)}] {};

\tkzDefCircle[circum](A,B,C)
\tkzGetPoint{O} \tkzGetLength{rayon}
\tkzDrawCircle[R](O,\rayon pt)

    \foreach \i in {A,B,C} {
        \node[circle,minimum size=1pt,fill=red] at(\i) {};
    }
    \end{tikzpicture}
\end{document}