4

I can't to color all area of the inscribed angle. When I color, appears only the triangle (not a curvilineo triangle)

\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}

enter image description here

Manuel
  • 27,118
benedito
  • 4,600

3 Answers3

4

You can simplify your code:

\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}

enter image description here

The first \filldraw fills and draws the sector. Notice also that defining coordinates allows you to not having to manually specify positions.

Gonzalo Medina
  • 505,128
3
\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}

arc

John Kormylo
  • 79,712
  • 3
  • 50
  • 120
2

Here's a Metapost version for comparison, with the numbers at the top, and using named paths and the plain syntax features point x of p and subpath(x,y) of p instead of calculating all the individual coordinates.

enter image description here

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.
Thruston
  • 42,268