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 \recA {(-4,-1) rectangle ++(6,3)}
\def \lineA {(4,5) -- (-5,-4)}
\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] \lineA;
% Intersection
\begin{scope}
\clip \recA;
\draw[pattern=north west lines] \lineA -- (-5,5) -- cycle;
\end{scope}
\end{tikzpicture}
|