5

I'm trying to inscribe equilateral triangle. What am I doing wrong.

\documentclass{article}
\usepackage{tkz-euclide}

\begin{document} \begin{tikzpicture}[scale=1] \tkzDefPoint(0,0){A} \tkzDefPoint(4,0){B} \tkzDefTriangleequilateral \tkzGetPoint{C} \tkzDefCirclein \tkzGetPoint{O} \tkzGetLength{rIN} \tkzDrawPoints(A,B,C,O) \tkzDrawCircle[R,blue](O,\rIN pt) \tkzLabelPoints(A,B,C,O) \tkzDrawPolygon(A,B,C) \end{tikzpicture} \end{document}

wrongly inscribed circle

3 Answers3

4

I suspect some kind of bug when inscribing a circle into an equilateral triangle. It works perfectly with many other triangles, but when you approach too near 60°, it fails to do it. For example, with an angle of 59.9°:

\documentclass{article}
\usepackage{tkz-euclide}

\begin{document} \begin{tikzpicture}[scale=1]

    \coordinate (A) at (0,0);
    \coordinate (B) at (4,0);
    \coordinate (C) at (59.9:4);

    \tkzDefCircle[in](A,B,C)

    \tkzGetPoint{O} \tkzGetLength{rIN}
    \tkzDrawPoints(A,B,C,O)
    \tkzDrawCircle[R,blue](O,\rIN pt)
    \tkzLabelPoints(A,B,C,O)
    \tkzDrawPolygon(A,B,C)

\end{tikzpicture}

\end{document}

angle=59.9

But with an angle of 59.99°, it fails:

angle=59.99

So you're not doing anything wrong. If you want to draw it anyway with tkz-euclide, you can do it "by hand":

\documentclass{article}
\usepackage{tkz-euclide}

\begin{document} \begin{tikzpicture}[scale=1]

    \coordinate (A) at (0,0);
    \coordinate (B) at (4,0);
    \coordinate (C) at (60:4);

    \tkzDefBarycentricPoint(A=1,B=1,C=1) \tkzGetPoint{O}
    \tkzInterLL(A,O)(C,B) \tkzGetPoint{A'}
    \tkzDrawCircle[color=blue](O,A')


   \tkzDrawPoints(A,B,C,O)
    \tkzLabelPoints(A,B,C,O)
    \tkzDrawPolygon(A,B,C)

\end{tikzpicture}

\end{document}

SebGlav
  • 19,186
4

For a plain TikZ way.

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\def\R{2} % radius of circumcircle
\pgfmathsetmacro{\r}{\R/2} % radius of incircle
\path
(90:\R) coordinate (A) node[above]{$A$}
(210:\R) coordinate (B) node[below left]{$B$}
(-30:\R) coordinate (C) node[below right]{$C$};
\fill[red] (0,0) circle(1.5pt);
\draw[red] (0,0) circle(\r);
\draw (A)--(B)--(C)--cycle;
\end{tikzpicture}
\end{document}
Black Mild
  • 17,569
3

Solution with tangent approach.

\documentclass[margin=3mm]{standalone}

\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}[rotate=180] \tkzDefPoint(0, 0){CircleCenter} \tkzDrawCircleR,very thick

% Define 3 points on circle. Angles for equilateral triangle

\tkzDefPoint( 90:3){C}
\tkzDefPoint(210:3){A}
\tkzDefPoint(330:3){B}


% Tangents
\tkzDefLine[perpendicular=through C](CircleCenter,C)\tkzGetPoint{C2}
\tkzDefLine[perpendicular=through A](CircleCenter,A)\tkzGetPoint{A2}
\tkzDefLine[perpendicular=through B](CircleCenter,B)\tkzGetPoint{B2}


% Find the points by intersecting the tangents
\tkzInterLL(C,C2)(A,A2)\tkzGetPoint{CC}
\tkzInterLL(A,A2)(B,B2)\tkzGetPoint{AA}
\tkzInterLL(B,B2)(C,C2)\tkzGetPoint{BB}

% Draw triangle
\tkzDrawPolygon[very thick](AA,BB,CC)

% Draw points
\tkzDrawPoints[size=3pt](CircleCenter)
\tkzDrawPoints[size=3pt](AA,BB,CC)
\node at (CircleCenter)[below right]{O};
\node at (BB)[left]{B};
\node at (CC)[right]{C};
\node at (AA)[above]{A};

\end{tikzpicture}

\end{document} enter image description here