4

I want to draw the next picture:

Enter image description here

But, I cannot shade the two regions (a) and (b). How can I do it?

\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2]
  \coordinate[label=below:$A$] (A) at (-2,0);
  \coordinate[label=below:$B$] (B) at (0,0);
  \coordinate[label=right:$C$] (C) at (0,2);
  \coordinate[label=right:$E$] (E) at (0,1);
     \coordinate[label=below:$F$] (F) at (-1,0);
 \draw[ultra thick] (A)--(B)--(C);
 \draw[ultra thick] (C) arc[start angle=90, end angle=180, radius=2];
\draw[ultra thick] (B)  arc[start angle=270, end angle=90, radius=1];
\draw[ultra thick] (A)  arc[start angle=180, end angle=0, radius=1];
\node at (0.2,0.5) {$r$};
\node at (-0.5,-0.2) {$r$};
\node at (-2,0) {$\bullet$};
\node at (0,0) {$\bullet$};
\node at (0,2) {$\bullet$};
\node at (0,1) {$\bullet$};
\node at (-1,0) {$\bullet$};
\node at (-0.5,0.5) {$a$};
\node at (-1.2,1.2) {$b$};
\end{tikzpicture}
\end{center}
\end{document}

Enter image description here

3 Answers 3

13

Unsurprisingly the area can be filled with fill. To this end you need to combine the three arcs to one (and change the order compared to your code).

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=2]
  \coordinate[label=below:$A$] (A) at (-2,0);
  \coordinate[label=below:$B$] (B) at (0,0);
  \coordinate[label=right:$C$] (C) at (0,2);
  \coordinate[label=right:$E$] (E) at (0,1);
     \coordinate[label=below:$F$] (F) at (-1,0);
 \draw[ultra thick] (A)--(B)--(C);
 \draw[ultra thick,fill=blue!20] (C) arc[start angle=90, end angle=180, radius=2]
  arc[start angle=180, end angle=0, radius=1]
  arc[start angle=270, end angle=90, radius=1];
\node at (0.2,0.5) {$r$};
\node at (-0.5,-0.2) {$r$};
\node at (-2,0) {$\bullet$};
\node at (0,0) {$\bullet$};
\node at (0,2) {$\bullet$};
\node at (0,1) {$\bullet$};
\node at (-1,0) {$\bullet$};
\node at (-0.5,0.5) {$a$};
\node at (-1.2,1.2) {$b$};
\end{tikzpicture}
\end{document}

enter image description here

There are many off-topic changes possible such as

 \path foreach \X in {A,B,C,E,F} {(\X) node{$\bullet$}};

instead of placing the bullets manually at explicit coordinates (if you insist on bullets vs. filled circles, that is). However, discussing all these optional changes is not really to the point.

ADDENDUM: This spells out the off-topic suggestions

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=2]
 \draw[ultra thick,fill=blue!20,
    every coordinate node/.append style={fill=black,inner sep=1.5pt,circle}] 
    (0,2) coordinate[label=right:$C$]  (C) 
  arc[start angle=90, end angle=180, radius=2]
    coordinate[label=below:$A$] (A) 
  arc[start angle=180, end angle=0, radius=1]
    coordinate[label=below:$B$] (B) 
  arc[start angle=270, end angle=90, radius=1]
  (A.center) -- coordinate[label=below:$F$] (F) 
    node[pos=0.75,below=1.5ex]{$r$} (B)
  --  node[pos=0.25,right=1.5ex]{$r$}  
  coordinate[label=right:$E$] (E) (C.center);
 \node at (135:{sqrt(1/2)}) {$a$};
 \node at (135:{1.8}) {$b$};
\end{tikzpicture}
\end{document}

enter image description here

2
  • 2
    I was just considering trying to answer the question, before thinking, nah man, Schrödinger's gonna do that before I even finish compiling.
    – steve
    May 19, 2020 at 22:50
  • 7
    @steve Only fast cats can catch mice. ;-)
    – user194703
    May 19, 2020 at 22:53
9

Here is a solution with tkz-euclide. The problem is: How to fill a certain area, here between arcs of circles. You have of course the excellent answer from Schrödinger's cat. Of course you can use it with tkz-euclide but using the code directly with Tikz. With only tkz-euclide you have to use clip, which is also possible with TikZ. In order to avoid side effects on the plots I used a scope environment to limit the action of clip. As Schrödinger's cat rightly noticed, the order of the actions is important. I will have to use fill first, then draw the arcs and finally the points.

I've complicated the code a bit by determining certain points like I,J,K,a and b in order to automatically place a and b.

\documentclass{standalone} 
\usepackage{tkz-euclide}

\begin{document} 
\begin{tikzpicture}
\tkzDefPoints{0/0/A,8/0/B,8/8/C,0/8/D}
\tkzDefMidPoint(A,B) \tkzGetPoint{F}
\tkzDefMidPoint(B,C) \tkzGetPoint{E}
\tkzDefMidPoint(D,B) \tkzGetPoint{I}
\tkzDefMidPoint(I,B) \tkzGetPoint{a}
\tkzInterLC(B,I)(B,C) \tkzGetSecondPoint{K}
\tkzDefMidPoint(I,K) \tkzGetPoint{b}
\begin{scope}
  \tkzFillSector[fill=blue!10](B,C)(A)
  \tkzDrawSemiCircle[diameter,fill=white](A,B)
  \tkzDrawSemiCircle[diameter,fill=white](B,C)
  \tkzClipCircle(E,B)
  \tkzClipCircle(F,B)
  \tkzFillCircle[fill=blue!10](B,A)
\end{scope}
\tkzDrawSemiCircle[thick](F,B)
\tkzDrawSemiCircle[thick](E,C)
\tkzDrawArc[thick](B,C)(A)
\tkzDrawSegments[thick](A,B B,C)
\tkzDrawPoints(A,B,C,E,F)
\tkzLabelPoints[centered](a,b)
\tkzLabelPoints(A,B,C,E,F)
\end{tikzpicture}
\end{document}

enter image description here

1

Compile with Asymptote.

unitsize(1cm);
size(300);
defaultpen(linewidth(.7bp));
pair A=(0,0),B=(3,0),C=(3,3);
path arcAB=reverse(arc((A+B)/2,abs(A-B)/2,0,180)),
     arcBC=reverse(arc((C+B)/2,abs(C-B)/2,90,270)),
     arcAC=arc(B,abs(C-B),90,180);
filldraw(arcAB--arcBC--arcAC--cycle,pink);
draw(A--B--C);
draw(Label("$r$",Center,UnFill),(A+B)/2{dir(-20)}..{dir(20)}B,dotted);
draw(Label("$r$",Center,UnFill),B{dir(70)}..{dir(110)}(B+C)/2,dotted);
dot((A+B)/2^^(B+C)/2);
label("$b$",B+2.7dir(135),UnFill);
label("$a$",B+dir(135),UnFill);
label("$A$",A,dir(-90));
label("$B$",B,dir(-45));
label("$C$",C,dir(0));
shipout(bbox(2mm,invisible));

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.