我正在尝试画等边三角形。我做错了什么。
\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[scale=1]
\tkzDefPoint(0,0){A}
\tkzDefPoint(4,0){B}
\tkzDefTriangle[equilateral](A,B)
\tkzGetPoint{C}
\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}
答案1
我怀疑在将圆内接于等边三角形时存在某种错误。它与许多其他三角形配合得很好,但当你接近 60° 时,它就无法做到这一点。例如,角度为 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}
但当角度达到 59.99° 时,它就失败了:
所以你没有做错什么。如果你想用 来绘制它tkz-euclide
,你可以“手工”绘制:
\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}
答案2
采用简单的 TikZ 方式。
\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}
答案3
用方法解决tangent
问题。
\documentclass[margin=3mm]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[rotate=180]
\tkzDefPoint(0, 0){CircleCenter}
\tkzDrawCircle[R,very thick](CircleCenter,3cm)
% 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}