Summary Files Commits Branches @commit @diff @stats
path: root / src / teaching / upp-2025 / week06 / tex / triangle_and_circle.tex
blob: cf275fba1eb9392a30debb8f283448f70b865526 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
% https://alfurka.github.io/quick-tikz/
\def \triangleA {(-3.5,-2) -- (-0.5,3) -- (3,2) -- cycle}
\def \circleA {(1,-0.5) circle [radius=2]}

\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] \triangleA;
  \draw[red] \circleA;

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