0

I am trying to fill the area marked gray below.

enter image description here

I found some examples with circles doing this kind a thing using clip. But I could not find the way to do that with arcs.

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{tkz-euclide}
\usepackage{tikz}
\usetikzlibrary{quotes,angles,shapes,backgrounds}
\def \firstarc{(4,0) arc (0:90:4cm)}
\def \secondarc{(8,0) arc (0:30:8cm)}
\begin{document}
\begin{tikzpicture}
    \coordinate (A) at (0,0);
    \coordinate (B) at (8,0);
    \coordinate (C) at (8,4);
    \coordinate (D) at (0,4);

    \draw \firstarc;
    \draw \secondarc;

    \draw (A)--(B)--(C)--(D)--(A);
\end{tikzpicture}
\end{document}

4 Answers 4

3

All of the answers here are good as they provide the actual area, and do not cheat by filling the background white. (Albeit this would be easier and in most cases an adequate solution.)

However, the solutions does not work when the height and the width of the rectangle changes, as all the solutions hardcode in the 30 degree angle. I am sure you can shorten this code by using the intersection library, and there exists pure tikz solutions; this is my solution.

The result looks like everybody else's attempt. Note that these images are transparent.

enter image description here

However, as mentioned one can also change the dimensions

enter image description here

enter image description here

Code

\documentclass[a4paper,12pt,margin=0.1mm]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all} % load all objects not neccecary in TexLive2020
\begin{document}
  \begin{tikzpicture}
    \def\width{8} \def\height{3}

    \tkzDefPoints{0/0/A, \width/0/B, \width/\height/C, 0/\height/D}
    \tkzClipPolygon(A,B,C,D)

    % Different waus to define the point E
    % \tkzDefPointBy[rotation= center A angle 90](D) \tkzGetPoint{E}
     \tkzDefPoint(0.5*\width, 0){E}
    % \tkzDefPoint(\height, 0){E}

    \tkzCalcLength[cm](A,E) \tkzGetLength{rAE} % \rAE gives the length

    \tkzInterLC(C,D)(A,B) \tkzGetPoints{J1}{J2}
    \tkzFindSlopeAngle(A,J2)\tkzGetAngle{JAB} % Might have to switch with J1 here

    \tkzDrawCircle(A,B); \tkzDrawCircle(A,E)

    \fill[blue] (E) arc (0:90:\rAE cm) -- (D) -- (\JAB:\width cm) 
                    arc (\JAB:0:\width cm);
    \tkzDrawPolygon[red](A,B,C,D)
  \end{tikzpicture}
\end{document}
4

As you are already using polar coordinates for the arcs.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{tkz-euclide}
\usepackage{tikz}
\usetikzlibrary{quotes,angles,shapes,backgrounds}
\def \firstarc{(4,0) arc (0:90:4cm)}
\def \secondarc{(8,0) arc (0:30:8cm)}
\begin{document}
\begin{tikzpicture}
    \coordinate (A) at (0,0);
    \coordinate (B) at (8,0);
    \coordinate (C) at (8,4);
    \coordinate (D) at (0,4);

    \draw \firstarc;
    \draw \secondarc;

    \draw[red] (A)--(B)--(C)--(D)-- cycle;
    \fill[blue] (B) -- (4,0) arc (0:90:4cm) -- (30:8cm) arc (30:0:8cm);
\end{tikzpicture}
\end{document}
3

Simplified version of @BambOo answer (+1):

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}
\draw[red]  (0,0) rectangle (8,4);
\fill[blue] (4,0) arc (0:90:4cm) -- (30:8cm) arc (30:0:8cm);
    \end{tikzpicture}
\end{document}

Result is the same:

enter image description here

2

Hope this help!

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{tkz-euclide}
\usepackage{tikz}
\usetikzlibrary{quotes,angles,shapes,backgrounds}
\def \firstarc{(4,0) arc (0:90:4cm)}
\def \secondarc{(8,0) arc (0:30:8cm)}
\begin{document}
\begin{tikzpicture}
    \coordinate (A) at (0,0);
    \coordinate (B) at (8,0);
    \coordinate (C) at (8,4);
    \coordinate (D) at (0,4);

    \draw \firstarc;
    \draw \secondarc;

    \draw (A)--(B)--(C)--(D)--(A);
    \fill[fill=gray](30:8cm)--(0,4) arc (90:0:4cm)--(8,0) arc (0:30:8cm)--cycle;
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .