8

I have the code for a triangle, and I have located the center of the circle that can be inscribed in it. I want to draw the inscribed circle without using the formula for the radius of the inscribed circle in a triangle. How do I get TikZ to calculate this radius and to draw the circle?

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{tikzpicture}

\path (0,1) coordinate (A) (3.5,1.5) coordinate (B) (-1.5,-0.75) coordinate (C);
\draw (A) -- (B) -- (C) -- cycle;

%The angle bisector at A is drawn.
\coordinate (a_path_for_angle_bisector_at_A) at ($(A)!2cm!(B)$);
\coordinate (another_path_for_angle_bisector_at_A) at ($(A)!2cm!(C)$);
\coordinate (midpoint_on_line_segment_to_locate_angle_bisector_at_A) at ($(a_path_for_angle_bisector_at_A)!0.5!(another_path_for_angle_bisector_at_A)$);
\path[name path=a_path_to_locate_center_of_circle] (A) -- ($(A)!1cm!(midpoint_on_line_segment_to_locate_angle_bisector_at_A)$);

%The angle bisector at C is drawn.
\coordinate (a_path_for_angle_bisector_at_C) at ($(C)!2cm!(A)$);
\coordinate (another_path_for_angle_bisector_at_C) at ($(C)!2cm!(B)$);
\coordinate (midpoint_on_line_segment_to_locate_angle_bisector_at_C) at ($(a_path_for_angle_bisector_at_C)!0.5!(another_path_for_angle_bisector_at_C)$);
\path[name path=another_path_to_locate_center_of_circle] (C) -- ($(C)!3cm!(midpoint_on_line_segment_to_locate_angle_bisector_at_C)$);

%The center of the circle inscribed in the triangle is located.
\coordinate[name intersections={of=a_path_to_locate_center_of_circle and another_path_to_locate_center_of_circle, by={O}}];
\draw[fill] (O) circle (1.5pt);


\end{tikzpicture}

\end{document}
2
  • what is the formula even though we won't use it?
    – percusse
    Oct 15, 2015 at 19:35
  • @percusse a, b, and c denote the lengths of the legs of the triangle, and s denotes the semiperimeter of the triangle. The radius of the circle that is inscribed in the triangle is \sqrt{s(s-a)(s-b)(s-c)}/s. Quite fascinating!
    – user74973
    Oct 15, 2015 at 20:14

2 Answers 2

14

You can do it using

\draw 
  let 
  \p1=( $ ( $ (A)!(O)!(B) $ )-(O) $ )
  in
  (O) circle ({veclen(\x1,\y1)});

(the radius is the length of the segment from O to the projection of O over one of the sides).

The complete code:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}

\begin{tikzpicture}

\path (0,1) coordinate (A) (3.5,1.5) coordinate (B) (-1.5,-0.75) coordinate (C);
\draw (A) -- (B) -- (C) -- cycle;

%The angle bisector at A is drawn.
\coordinate (a_path_for_angle_bisector_at_A) at ($(A)!2cm!(B)$);
\coordinate (another_path_for_angle_bisector_at_A) at ($(A)!2cm!(C)$);
\coordinate (midpoint_on_line_segment_to_locate_angle_bisector_at_A) at ($(a_path_for_angle_bisector_at_A)!0.5!(another_path_for_angle_bisector_at_A)$);
\path[name path=a_path_to_locate_center_of_circle] (A) -- ($(A)!1cm!(midpoint_on_line_segment_to_locate_angle_bisector_at_A)$);

%The angle bisector at C is drawn.
\coordinate (a_path_for_angle_bisector_at_C) at ($(C)!2cm!(A)$);
\coordinate (another_path_for_angle_bisector_at_C) at ($(C)!2cm!(B)$);
\coordinate (midpoint_on_line_segment_to_locate_angle_bisector_at_C) at ($(a_path_for_angle_bisector_at_C)!0.5!(another_path_for_angle_bisector_at_C)$);
\path[name path=another_path_to_locate_center_of_circle] (C) -- ($(C)!3cm!(midpoint_on_line_segment_to_locate_angle_bisector_at_C)$);

%The center of the circle inscribed in the triangle is located.
\coordinate[name intersections={of=a_path_to_locate_center_of_circle and another_path_to_locate_center_of_circle, by={O}}];
\draw[fill] (O) circle (1.5pt);

\draw 
  let 
  \p1=( $ ( $ (A)!(O)!(B) $ )-(O) $ )
  in
  (O) circle ({veclen(\x1,\y1)});

\end{tikzpicture}

\end{document}

enter image description here

0
5

Here is a tkz-euclide variant.

\documentclass{amsart}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
  \begin{tikzpicture}
     \tkzDefPoint(0,1){A}
     \tkzDefPoint(3.5,1.5){B}
     \tkzDefPoint(-1.5,-0.75){C}
     \tkzDrawPolygon(A,B,C)

     \tkzDefCircle[in](A,B,C)
     \tkzGetPoint{O} \tkzGetLength{rIN}         
     \tkzDrawPoints(A,B,C,O)
     \tkzDrawCircle[R,color=red](O,\rIN pt)         
     \tkzLabelPoints[below](B,C)
     \tkzLabelPoints[above left=0mm and -2mm](A,O)
  \end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .