aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/090-pde/images/rechteck.tex
blob: e7ba3c7479181910659b2fe275641b0256a6e473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
%
% rechteck.tex -- template for standalon tikz images
%
% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
%
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{times}
\usepackage{txfonts}
\usepackage{pgfplots}
\usepackage{csvsimple}
\usetikzlibrary{arrows,intersections,math}
\begin{document}
\def\skala{1}
\begin{tikzpicture}[>=latex,thick,scale=\skala]

\def\a{12}
\def\b{8}

\def\k{9}
\pgfmathparse{\k-1}
\xdef\kmax{\pgfmathresult}
\def\l{4}
\pgfmathparse{\l-1}
\xdef\lmax{\pgfmathresult}

\pgfmathparse{\a/\k}
\xdef\dx{\pgfmathresult}
\pgfmathparse{\b/\l}
\xdef\dy{\pgfmathresult}

\begin{scope}
\clip (0,0) rectangle (\a,\b);
\fill[color=red!20] (0,0) rectangle (\a,\b);

\foreach \kl in {0,2,...,\lmax}{
	\foreach \ki in {0,2,...,\kmax}{
		\fill[color=blue!20]
			({\ki*\dx},{\kl*\dy}) rectangle
			({(\ki+1)*\dx},{(\kl+1)*\dy});
	}
}

\foreach \kl in {1,3,...,\lmax}{
	\foreach \ki in {1,3,...,\kmax}{
		\fill[color=blue!20]
			({\ki*\dx},{\kl*\dy}) rectangle
			({(\ki+1)*\dx},{(\kl+1)*\dy});
	}
}

\end{scope}

\draw (0,0) rectangle (\a,\b);

\foreach \ki in {1,...,\kmax}{
	\draw[line width=0.2pt] ({\ki*\dx},0) -- ({\ki*\dx},\b);
}
\foreach \li in {1,...,\lmax}{
	\draw[line width=0.2pt] (0,{\li*\dy}) -- (\a,{\li*\dy});
}

\draw (\a,-0.1) -- (\a,0.1);
\draw ({\a/\k},-0.1) -- ({\a/\k},0.1);
\node at (\a,0) [below] {$\mathstrut a$};
\node at ({\a/\k},0) [below] {$\mathstrut a/k$};
\draw (-0.1,\b) -- (0.1,\b);
\draw (-0.1,{\b/\l}) -- (0.1,{\b/\l});
\node at (0,\b) [left] {$\mathstrut b$};
\node at (0,{\b/\l}) [left] {$\mathstrut b/l$};
	
\draw[->] (-0.1,0) -- ({\a+0.7},0) coordinate[label={$x$}];
\draw[->] (0,-0.1) -- (0,{\b+0.7}) coordinate[label={right:$y$}];

\node at ({\a/2},\b) [above] {$k=\k$};
\node at (\a,{\b/2}) [above,rotate=-90] {$l=\l$};

\end{tikzpicture}
\end{document}