免費論壇 繁體 | 簡體
Sclub交友聊天~加入聊天室當版主
分享
返回列表 发帖

TikZ 绘制三角形的内心和外心 - 内接圆外接圆(转载)

做个备忘先,转换于 LaTeX_工作室

TikZ 绘制三角形的内心和外心 - 内接圆外接圆 https://www.latexstudio.net/index/details/index/mid/923.html


  1. \documentclass{ctexart}
  2. \usepackage{tikz}
  3. \usetikzlibrary{intersections, calc, through}
  4. \usepackage[active,tightpage]{preview}
  5. \PreviewEnvironment{tikzpicture}
  6. \setlength\PreviewBorder{10pt}%
  7. \begin{document}
  8. \begin{tikzpicture}[scale=1.2]
  9. \begin{scope}%查找 △OAB 的外心
  10. \draw [help lines] (0,0) grid (4.5,3.5);%画一个(0,0)到(4.5,3.5)的辅助网格线
  11. %设置三角形的三个顶点
  12. \coordinate (O) at (0,0) node [below] at (O) {O};
  13. \coordinate (A) at (4,0) node [below] at (A) {A};
  14. \coordinate (B) at (3,3) node [above right] at (B) {B};
  15. \draw (O)--(A)--(B)--cycle;
  16. %两侧和相交处的垂直等分线百分比(=外心)
  17. \draw ($(O)!.5!(A)!1cm!90:(O)$)--($(O)!.5!(A)!4cm!90:(A)$) [name path=line 1, red];
  18. \draw ($(A)!.5!(B)!1cm!90:(A)$)--($(A)!.5!(B)!4cm!90:(B)$) [name path=line 2, green];
  19. \draw ($(B)!.5!(O)!1cm!90:(B)$)--($(B)!.5!(O)!4cm!90:(O)$) [name path=line 3, blue];
  20. \fill [name intersections={of=line 1 and line 2}] (intersection-1) circle (2pt) node (P) [label=left:外心] {};
  21. \draw ($(O)!.5!(A)!5pt!(A)$) |- ($(O)!.5!(A)!5pt!90:(A)$);%直角标记
  22. %在每个点上添加一个黑色圆圈
  23. \foreach \P in {O,A,B} \fill (\P) circle (2pt);
  24. %外圈(半径是OP距离)
  25. \node [draw, circle through=(O)] at (P) {};
  26. \end{scope}
  27. %
  28. \begin{scope}[yshift=5.3cm]%寻找△OAB内心
  29. \draw [help lines] (0,0) grid (4.5,3.5);%画一个(0,0)到(4.5,3.5)的辅助网格线
  30. %设置三角形的三个顶点,画出来三角形
  31. \coordinate (O) at (0,0) node [below] at (O) {O};
  32. \coordinate (A) at (4,0) node [below] at (A) {A};
  33. \coordinate (B) at (3,3) node [above right] at (B) {B};
  34. \draw (O)--(A)--(B)--cycle;
  35. %在每侧设置固定长度的点
  36. \coordinate (s) at ($(O)!1cm!(A)$);
  37. \coordinate (t) at ($(O)!1cm!(B)$);
  38. \coordinate (u) at ($(A)!1cm!(O)$);
  39. \coordinate (v) at ($(A)!1cm!(B)$);
  40. \coordinate (w) at ($(B)!1cm!(O)$);
  41. \coordinate (z) at ($(B)!1cm!(A)$);
  42. %内角平分线百分比
  43. \draw (O)--($5*(s)!.5!(t)$) [name path=line O, red];
  44. \draw (A)--($(u)!.5!(v)!-4!(A)$) [name path=line A, green];
  45. \draw (B)--($(z)!.5!(w)!-4!(B)$) [name path=line B, blue];
  46. %百分比角的二等分线的交点(=内心)
  47. \fill [name intersections={of=line O and line B}] (intersection-1) circle (2pt) node (P) [label=left:内心] {};
  48. %在每个点上添加一个黑色圆圈
  49. \foreach \P in {O,A,B} \fill (\P) circle (2pt);
  50. %内部中心圆(半径是从P到OA绘制的垂直线的长度)
  51. \draw let \p1=($(O)!(P)!(A)-(P)$), \n1={veclen(\x1,\y1)} in circle [at=(P), radius=\n1];
  52. \end{scope}
  53. \end{tikzpicture}
  54. \end{document}
复制代码
分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友

回复 1# isee

还是用tkz-euclide方便
\tkzCircumCenter(A,B,C)\tkzGetPoint{O}%定义三角形ABC的外心O
\tkzInCenter(A,B,C)\tkzGetPoint{I}%定义三角形ABC的内心I

TOP

昨晚看这帖没回,就等楼上来说这个

TOP

回复 3# kuing


最新版里tkz-euclide的文档已经变成英文的了,不过精简了很多,可能就是提纲一类的,而且我发现有些命令还没了,比如tkzTangent这个过点作圆的切线的,不知道变成什么新的了还是取消了。

TOP

作图都是围绕TiKZ宏包搞的吗? 每次微调很烦.

TOP

返回列表 回复 发帖