|
做个备忘先,转换于 LaTeX_工作室
TikZ 绘制三角形的内心和外心 - 内接圆外接圆 https://www.latexstudio.net/index/details/index/mid/923.html
- \documentclass{ctexart}
- \usepackage{tikz}
- \usetikzlibrary{intersections, calc, through}
- \usepackage[active,tightpage]{preview}
- \PreviewEnvironment{tikzpicture}
- \setlength\PreviewBorder{10pt}%
- \begin{document}
- \begin{tikzpicture}[scale=1.2]
- \begin{scope}%查找 △OAB 的外心
- \draw [help lines] (0,0) grid (4.5,3.5);%画一个(0,0)到(4.5,3.5)的辅助网格线
- %设置三角形的三个顶点
- \coordinate (O) at (0,0) node [below] at (O) {O};
- \coordinate (A) at (4,0) node [below] at (A) {A};
- \coordinate (B) at (3,3) node [above right] at (B) {B};
- \draw (O)--(A)--(B)--cycle;
- %两侧和相交处的垂直等分线百分比(=外心)
- \draw ($(O)!.5!(A)!1cm!90:(O)$)--($(O)!.5!(A)!4cm!90:(A)$) [name path=line 1, red];
- \draw ($(A)!.5!(B)!1cm!90:(A)$)--($(A)!.5!(B)!4cm!90:(B)$) [name path=line 2, green];
- \draw ($(B)!.5!(O)!1cm!90:(B)$)--($(B)!.5!(O)!4cm!90:(O)$) [name path=line 3, blue];
- \fill [name intersections={of=line 1 and line 2}] (intersection-1) circle (2pt) node (P) [label=left:外心] {};
- \draw ($(O)!.5!(A)!5pt!(A)$) |- ($(O)!.5!(A)!5pt!90:(A)$);%直角标记
- %在每个点上添加一个黑色圆圈
- \foreach \P in {O,A,B} \fill (\P) circle (2pt);
- %外圈(半径是OP距离)
- \node [draw, circle through=(O)] at (P) {};
- \end{scope}
- %
- \begin{scope}[yshift=5.3cm]%寻找△OAB内心
- \draw [help lines] (0,0) grid (4.5,3.5);%画一个(0,0)到(4.5,3.5)的辅助网格线
- %设置三角形的三个顶点,画出来三角形
- \coordinate (O) at (0,0) node [below] at (O) {O};
- \coordinate (A) at (4,0) node [below] at (A) {A};
- \coordinate (B) at (3,3) node [above right] at (B) {B};
- \draw (O)--(A)--(B)--cycle;
- %在每侧设置固定长度的点
- \coordinate (s) at ($(O)!1cm!(A)$);
- \coordinate (t) at ($(O)!1cm!(B)$);
- \coordinate (u) at ($(A)!1cm!(O)$);
- \coordinate (v) at ($(A)!1cm!(B)$);
- \coordinate (w) at ($(B)!1cm!(O)$);
- \coordinate (z) at ($(B)!1cm!(A)$);
- %内角平分线百分比
- \draw (O)--($5*(s)!.5!(t)$) [name path=line O, red];
- \draw (A)--($(u)!.5!(v)!-4!(A)$) [name path=line A, green];
- \draw (B)--($(z)!.5!(w)!-4!(B)$) [name path=line B, blue];
- %百分比角的二等分线的交点(=内心)
- \fill [name intersections={of=line O and line B}] (intersection-1) circle (2pt) node (P) [label=left:内心] {};
- %在每个点上添加一个黑色圆圈
- \foreach \P in {O,A,B} \fill (\P) circle (2pt);
- %内部中心圆(半径是从P到OA绘制的垂直线的长度)
- \draw let \p1=($(O)!(P)!(A)-(P)$), \n1={veclen(\x1,\y1)} in circle [at=(P), radius=\n1];
- \end{scope}
- \end{tikzpicture}
- \end{document}
复制代码 |
|