我想画一个三角形圆,将其内接于一个圆上,使得顶点将圆分成三个长度分别为 3、4 和 5 的圆弧。我尝试使用 Geogebra。
\documentclass[12pt]{standalone}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-0.5,-0.5) rectangle (4.5,4.298548095909735);
\draw(2.,2.) circle (2.cm);
\draw (0.64845913365678,3.4742242999639563)-- (0.5257757000360437,0.64845913365678);
\draw (0.5257757000360437,0.64845913365678)-- (3.907580874488035,1.3990547385264929);
\draw (3.907580874488035,1.3990547385264929)-- (0.64845913365678,3.4742242999639563);
\draw (-0.4,2.1844051666973288) node[anchor=north west] {3};
\draw (2.0939306358381504,0) node[anchor=north west] {4};
\draw (3,4.2) node[anchor=north west] {5};
\draw [fill=black] (2.,2.) circle (1.5pt);
\draw[color=black] (2,1.6) node {$I$};
\draw [fill=black] (0.64845913365678,3.4742242999639563) circle (1.5pt);
\draw[color=black] (0.6,3.8) node {$A$};
\draw [fill=black] (0.5257757000360437,0.64845913365678) circle (1.5pt);
\draw[color=black] (0.49,0.2) node {$B$};
\draw [fill=black] (3.907580874488035,1.3990547385264929) circle (1.5pt);
\draw[color=black] (4.15,1.377692733182069) node {$C$};
\end{tikzpicture}
\end{document}
我怎样才能使用 tikz(或 pstricks)和漂亮的代码来绘制该图片?
答案1
定义一个 3+4+5=12 度的圆:
\documentclass[pstricks]{standalone}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(-3,-3)(3,3)
\degrees[12]
\pspolygon[showpoints](2;1)(2;4)(2;8)
\pscircle[showpoints](0,0){2}
\uput[1](2;1){A}\uput[4](2;4){B}\uput[8](2;8){C}
\rput(1.7;2.5){3}\rput(1.5;6){4}\rput(1.25;11){5}
\end{pspicture}
\end{document}
答案2
您可以用接受路径上距离的标记来装饰圆圈。然后您可以根据需要旋转或标记。
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro\myradi{12/2/pi}
\draw[decoration={markings,
mark=at position 3cm with \coordinate (c3);,
mark=at position 7cm with \coordinate (c4);,
mark=at position 12cm with\coordinate(c5);% Redundant
}, postaction={decorate}]
circle [radius=\myradi cm];
\draw (c3) -- (c4) --(c5) --cycle;
\end{tikzpicture}
\end{document}
答案3
这是另一个变体(通过 TikZ),具有随机的起始角度(每次编译都会产生不同的结果):
\documentclass[tikz,margin=2mm]{standalone}
\usetikzlibrary{calc,positioning}
\pgfmathsetseed{\pdfuniformdeviate 10000000}
\begin{document}
\begin{tikzpicture}
% constants
\pgfmathsetmacro\unit{360/(3+4+5)}
\pgfmathsetmacro\radius{2cm}
\pgfmathsetmacro\labeldist{3mm}
% random starting angle
\pgfmathsetmacro\angleinit{rnd*360}
% center
\fill circle(2pt) coordinate (I);
\node at ($(I) + (\angleinit:3mm)$) {I};
% circle
\draw circle(\radius pt);
% triangle
\draw ({\unit*0+\angleinit}:\radius pt) coordinate (A)
-- ({\unit*(3)+\angleinit}:\radius pt) coordinate (B)
-- ({\unit*(3+4)+\angleinit}:\radius pt) coordinate (C)
-- cycle;
% The vertices and their names
\foreach \point in {A,B,C}{
\fill (\point) circle (2pt);
\node at ($(I)!\radius pt+\labeldist pt!(\point)$) {\point};
}
% the relative angular distances
\node at ($(I)!\radius pt+\labeldist pt!($(A)!.5!(B)$)$) {3};
\node at ($(I)!\radius pt+\labeldist pt!($(B)!.5!(C)$)$) {4};
\node at ($(I)!\radius pt+\labeldist pt!($(C)!.5!(A)$)$) {5};
\end{tikzpicture}
\end{document}
编辑:
新版本的标签采用斜体格式,并包含 IA、IB 和 IC 段。
\documentclass[tikz,margin=2mm]{standalone}
\usetikzlibrary{calc,positioning}
\pgfmathsetseed{\pdfuniformdeviate 10000000}
\begin{document}
\begin{tikzpicture}
% constants
\pgfmathsetmacro\unit{360/(3+4+5)}
\pgfmathsetmacro\radius{2cm}
\pgfmathsetmacro\labeldist{3mm}
% random starting angle
\pgfmathsetmacro\angleinit{rnd*360}
% center
\fill circle(2pt) coordinate (I);
\node at ($(I) + (\angleinit+50:3mm)$) {$I$};
% circle
\draw circle(\radius pt);
% triangle
\draw ({\unit*0+\angleinit}:\radius pt) coordinate (A)
-- ({\unit*(3)+\angleinit}:\radius pt) coordinate (B)
-- ({\unit*(3+4)+\angleinit}:\radius pt) coordinate (C)
-- cycle;
% vertices, labels and segments
\foreach \point in {A,B,C}{
\fill (\point) circle (2pt);
\node at ($(I)!\radius pt+\labeldist pt!(\point)$) {$\point$};
\draw (I) -- (\point);
}
% relative angular distances
\node at ($(I)!\radius pt+\labeldist pt!($(A)!.5!(B)$)$) {3};
\node at ($(I)!\radius pt+\labeldist pt!($(B)!.5!(C)$)$) {4};
\node at ($(I)!\radius pt+\labeldist pt!($(C)!.5!(A)$)$) {5};
\end{tikzpicture}
\end{document}
最后编辑:
具有不同多边形的示例:
\documentclass[tikz,margin=2mm]{standalone}
\usetikzlibrary{calc,positioning}
\pgfmathsetseed{\pdfuniformdeviate 10000000}
\begin{document}
\foreach \p in {{A/1,B/2,C/4,D/5},{A/2,B/3,C/4,D/6,E/9}}{
\begin{tikzpicture}
\pgfmathsetmacro\r{2cm} \pgfmathsetmacro\ld{3mm}
\foreach \l/\v[evaluate=\v as \s using \s + \v,remember=\s as \s (initially 0),
remember=\l as \ls,remember=\v as \lv] in \p{}
\pgfmathsetmacro\unit{360/\s} \pgfmathsetmacro\ai{rnd*360}
\fill circle(2pt) coordinate (I); \draw circle(\r pt);
\draw (\ai:\r pt)
\foreach \l/\v[evaluate=\v as \s using \psum + \v, remember=\s as \psum (initially 0)]
in \p {-- ({\unit*\psum+\ai}:\r pt) coordinate (\l)} -- cycle;
\foreach \l/\v in \p {
\draw (I) -- (\l); \fill (\l) circle (2pt);
\node at ($(I)!\r pt+\ld pt!(\l)$) {$\l$};
}
\node[circle,inner sep=1pt,fill=white] at ($(I) + (\ai:5mm)$) {$I$};
\foreach \l/\v[remember=\l as \pl (initially \ls),remember=\v as \pv (initially \lv)]
in \p {\node at ($(I)!\r pt+\ld pt!($(\pl)!.5!(\l)$)$) {\pv};}
\end{tikzpicture}
}
\end{document}
答案4
这是 Asymptote 中的一个解决方案。
unitsize(1cm);
real L1 = 3.0;
real L2 = 4.0;
real L3 = 5.0;
real diameter = (L1 + L2 + L3) / pi;
path circle = scale(diameter/2)*unitcircle;
pair A = arcpoint(circle,0.0);
pair B = arcpoint(circle,L1);
pair C = arcpoint(circle,L1 + L2);
draw(circle, blue);
draw(A--B--C--cycle, red);
dot(Label("$A$"), A, dir(A));
dot(Label("$B$"), B, dir(B));
dot(Label("$C$"), C, dir(C));
pair L1mid = arcpoint(circle,L1/2.0);
pair L2mid = arcpoint(circle,L1+L2/2.0);
pair L3mid = arcpoint(circle,L1+L2+L3/2.0);
label(string(L1), L1mid, dir(L1mid));
label(string(L2), L2mid, dir(L2mid));
label(string(L3), L3mid, dir(L3mid));