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

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

做个备忘先,转换于 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}
分享到: 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

返回列表 回复 发帖