Summary Files Commits Branches @commit @diff @stats
path: root / src / teaching / upp-2025 / week06 / tex / rectangles_and_circle.tex
blob: 121f2d32ffea8aa0d03a62174e9dee13d4019f01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
% https://alfurka.github.io/quick-tikz/
\def \recA {(0,-2.5) rectangle ++(3,3)}
\def \recB {(-1,0) rectangle ++(3,1)}
\def \circleA {(-1,-1) circle [radius=2.5]}

\begin{tikzpicture}[background rectangle/.style={fill=white}, show background rectangle]
  % Axis
  \draw (-5,0) -- (5,0);
  \draw (0,-5) -- (0,5);
  \draw[step=1,gray,very thin] (-4.8,-4.8) grid (4.8,4.8);

  % Main shapes
  \draw[blue] \recA;
  \draw[red] \recB;
  \draw[brown] \circleA;

  % Intersection
  \begin{scope}
    \clip \recB;
    \draw[pattern=north west lines, even odd rule] \recA \circleA;
  \end{scope}
\end{tikzpicture}