我无法给内接角的所有区域上色。当我上色时,只出现三角形(不是曲线三角形)
\begin{center}
\begin{tikzpicture}[scale=0.7]
\draw[fill=gray!40] (0,0) --(2.5,4.3)--(7.5,4.3)--(0,0);
\draw[ultra thick]
(0,0)--(10,0)
(0,0)--(2.5,4.3)
(0,0)--(7.5,4.3);
\draw[ultra thick] (10,0) arc [radius=5, start angle=0, end angle=180];
\node at (-0.3,0) {\textbf{A}};
\node at (10.3,0) {\textbf{D}};
\node at (5,0) {$\bullet$};
\node at (5,-0.3) {\textbf{O}};
\node at (0,0) {$\bullet$};
\node at (10,0) {$\bullet$};
\node at (2.5,4.3) {$\bullet$};
\node at (2.5,4.7) {\textbf{B}};
\node at (7.5,4.7) {\textbf{C}};
\node at (7.5,4.3) {$\bullet$};
\end{tikzpicture}
\end{center}
答案1
您可以简化您的代码:
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=0.7,line join=round]
\coordinate (O) at (5,0);
\filldraw[fill=gray!40,ultra thick]
(0,0) coordinate (A) --
++(60:5) coordinate (B)
arc[radius=5,start angle=120,end angle=60] coordinate (C) --
cycle;
\draw[ultra thick]
(10,0) coordinate (D) arc [radius=5, start angle=0, end angle=180] -- cycle;
\foreach \Coord/\Angle in {A/180,B/120,C/60,O/270,D/0}
{
\node[label={[inner sep=0pt]\Angle:\textbf{\Coord}}] at (\Coord) {$\bullet$};
}
\end{tikzpicture}
\end{document}
第一个\filldraw
填充并绘制扇区。还请注意,定义坐标使您不必手动指定位置。
答案2
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=0.7]
\pgfmathparse{atan(4.3/2.5)}%
\let\angle=\pgfmathresult
\draw[fill=gray!40] (0,0) --(2.5,4.3) arc[radius=5, start angle={180-\angle}, end angle=\angle] --(0,0);
\draw[ultra thick]
(0,0)--(10,0)
(0,0)--(2.5,4.3)
(0,0)--(7.5,4.3);
\draw[ultra thick] (10,0) arc [radius=5, start angle=0, end angle=180];
\node at (-0.3,0) {\textbf{A}};
\node at (10.3,0) {\textbf{D}};
\node at (5,0) {$\bullet$};
\node at (5,-0.3) {\textbf{O}};
\node at (0,0) {$\bullet$};
\node at (10,0) {$\bullet$};
\node at (2.5,4.3) {$\bullet$};
\node at (2.5,4.7) {\textbf{B}};
\node at (7.5,4.7) {\textbf{C}};
\node at (7.5,4.3) {$\bullet$};
\end{tikzpicture}
\end{document}
答案3
这是一个用于比较的 Metapost 版本,其中数字位于顶部,并使用命名路径和简单的语法功能point x of p
,而subpath(x,y) of p
不是计算所有单独的坐标。
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
theta = 60; % how many degrees of arc from B to C?
radius = 4cm;
path semicircle, sector;
semicircle = reverse halfcircle scaled 2 radius -- cycle;
sector = point 0 of semicircle -- subpath (2-theta/90,2+theta/90) of semicircle -- cycle;
fill sector withcolor .75 white;
draw sector;
draw semicircle;
dotlabel.bot(btex $O$ etex, origin);
dotlabel.lft(btex $A$ etex, point 0 of semicircle);
dotlabel.rt (btex $D$ etex, point 4 of semicircle);
dotlabel.ulft(btex $B$ etex, point +1 of sector);
dotlabel.urt (btex $C$ etex, point -1 of sector);
endfig;
end.