这是我的代码:
\begin{center}
\begin{tikzpicture}
\coordinate[label=above:$A$] (A) at (2,3.464);
\coordinate[label=right:$B$] (B) at (4,0);
\coordinate[label=left:$C$] (C) at (0,0);
\coordinate[label=$K$] (K) at (2,1.732);
\draw[ultra thick](A)--(B)--(C)--cycle;
\end{tikzpicture}
\end{center}
三角形 ABC 是等边三角形
我想要做的是画出三角形 ABC 的三条角平分线。然后我想根据角平分线的交点自动画出内心。最后需要一个自动公式来计算三个顶点 A、B、C 到内心的距离
答案1
这是一个起点:我使用的包tkz-euclide
基于tikz
但有自己的宏,使欧几里得几何更容易绘制。通过一些更改,您可以使此示例不仅适用于等边三角形,而且适用于每个三角形。本例中的所有距离和点都是内部计算的,tikz
仅基于在开始时定义的初始点 A 和 B 以及三角形 ABC 是等边的事实。
\documentclass{standalone}
\usepackage{tkz-euclide}
\tkzSetUpPoint[size=2,color=black,fill=white]
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/A,6/0/B}
\tkzDefPointBy[rotation=center A angle 60](B)\tkzGetPoint{C}
\tkzDrawPolygon(A,B,C)
\tkzDefLine[bisector](A,C,B)\tkzGetPoint{c}
\tkzDefLine[bisector](A,B,C)\tkzGetPoint{b}
\tkzDefLine[bisector](B,A,C)\tkzGetPoint{a}
\tkzDrawSegments(A,a B,b C,c)
\tkzLabelSegment[above,sloped,near start,yshift=-3pt](A,a){bisector}
\tkzLabelSegment[above left=,sloped,near end,yshift=-3pt](b,B){bisector}
\tkzLabelSegment[above left=,sloped,near start,yshift=-3pt,xshift=1cm](C,c){bisector}
\tkzInterLL(A,a)(B,b)\tkzGetPoint{D} % <-- find the incenter
\tkzDefPointBy[projection=onto B--C](D)\tkzGetPoint{Dbc}%<- find the projection of D on BC
\tkzDefPointBy[projection=onto A--C](D)\tkzGetPoint{Dac}
\tkzDefPointBy[projection=onto A--B](D)\tkzGetPoint{Dab}
\tkzCalcLength(D,Dab)\tkzGetLength{dab}
\tkzCalcLength(D,Dbc)\tkzGetLength{dbc}%<-- find the distance of D from BC
\tkzCalcLength(D,Dac)\tkzGetLength{dac}
\tkzDrawPoints(A,B,C,D,Dab,Dac,Dbc)
\tkzLabelPoints(A,B,D)\tkzLabelPoint[above](C){C}
\tkzLabelSegment[above,sloped](D,Dbc){\tiny$\dbc cm$}
\begin{scope}[xfp]
\tkzMarkAngle[size=0.5,mark=|](C,B,D)
\tkzMarkAngle[size=0.5,mark=|](D,B,A)
\end{scope}
\end{tikzpicture}
\end{document}
答案2
这是 Miltos 代码的变体。
我过去常常\tkzDefTriangle[equilateral]
直接获取三角形并\tkzDefTriangleCenter[in]
获取内心。
我删除了“范围”,因为这里不需要它
\documentclass{standalone}
\usepackage{tkz-euclide}
\tkzSetUpPoint[size=2,color=black,fill=white]
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/C,4/0/B}
\tkzDefTriangle[equilateral](C,B) \tkzGetPoint{A}
%\tkzDefPointBy[rotation=center A angle 60](B)\tkzGetPoint{C}
\tkzDefLine[bisector](A,C,B) \tkzGetPoint{c}
\tkzDefLine[bisector](A,B,C) \tkzGetPoint{b}
\tkzDefLine[bisector](B,A,C) \tkzGetPoint{a}
\tkzDrawSegments(A,a B,b C,c)
\tkzDefTriangleCenter[in](A,B,C) \tkzGetPoint{D}
% \tkzInterLL(A,a)(B,b)\tkzGetPoint{D} % <-- find the incenter
\tkzDefPointBy[projection=onto B--C](D)\tkzGetPoint{Dbc}%<- find the projection of D on BC
\tkzDefPointBy[projection=onto A--C](D)\tkzGetPoint{Dac}
\tkzDefPointBy[projection=onto A--B](D)\tkzGetPoint{Dab}
\tkzCalcLength(D,Dab)\tkzGetLength{dab}
\tkzDrawPolygon(A,B,C)
\tkzDrawPoints(A,B,C,D,Dab,Dac,Dbc)
\tkzLabelPoints(C,B,D)
\tkzLabelPoint[above](A){A}
\tkzLabelSegment[above,sloped](D,Dab){\tiny$\dab cm$}
\tkzMarkAngle[size=0.5,mark=|](D,B,C)
\tkzMarkAngle[size=0.5,mark=|](A,B,D)
\tkzLabelSegment[above,sloped,near start,yshift=-3pt](A,a){bisector}
\tkzLabelSegment[above left=,sloped,near end,yshift=-3pt](b,B){bisector}
\tkzLabelSegment[above left=,sloped,near start,yshift=-3pt,xshift=1cm](C,c){bisector}
\end{tikzpicture}
\end{document}