6 def drawusecka(expr p,q) = draw vertex(p); draw vertex(q); draw p--q; enddef;
8 A0 := origin; B0 := (4cm,1.5cm);
9 A1 := (0.5cm,1.5cm); B1 := (1cm,0);
10 A2 := (2cm,1.3cm); B2 := (3cm, -0.9cm);
11 A3 := (1cm,-1.3cm); B3 := (3.5cm,0);
12 z0 = whatever[A0,B0]; z0 = whatever[A1,B1];
13 z1 = whatever[A0,B0]; z1 = whatever[A2,B2];
14 z2 = whatever[A2,B2]; z2 = whatever[A3,B3];
16 for i:=0 upto 2: fill fullcircle scaled 7pt shifted z[i]; drawemptyvertex(z[i]); endfor
17 for i:=0 upto 3: drawusecka(A[i], B[i]); endfor
26 path p; p := from(.5[A,B],an+90,3cm)--from(.5[A,B],an-90,3cm);
27 fill p--reverse(p shifted (A-0.8[A,B]))--cycle withcolor 0.8white;
28 %fill p{dir (an+180)}..-0.35[A,B]..{dir an}cycle withcolor 0.8white;
29 draw p withpen boldpen;
31 pair C; C := point(0.9) of p;
32 drawarrow from(C,an+180,0.1cm)--from(C,an+180,1cm) withpen boldpen;
34 drawarrow from(C,an+180,0.1cm)--from(C,an+180,1cm) withpen boldpen;
35 label.rt(btex $p$ etex, point(0.15) of p);
37 draw A--B dashed evenly;
38 drawemptyvertex(A); drawemptyvertex(B);
39 label.llft(btex $a$ etex, A);
40 label.urt(btex $b$ etex, B);
41 label(btex $B_a$ etex, A+2(-0.1cm,0.5cm));
42 label(btex $B_b$ etex, B+2(-0.1cm,0.5cm));
45 figtag("voroneho_diagram");
49 A0 := origin; A1 := (-u,-u); A2 := (1.3u,-u); A3 := (1.50821u,0.7u); A4 := (0.6u,0.8u); A5 := (0.2u,1.9u); A6 := (-1.3u,1u);
50 def osa(expr a, b, an,l) = from(.5[a,b], angle(b-a)+an, l) enddef;
51 vardef prusecik_os(expr p,q,r) =
53 b = whatever[osa(p,q, 90,1cm), osa(p,q,-90,1cm)];
54 b = whatever[osa(q,r, 90,1cm), osa(q,r,-90,1cm)];
57 B[0] := prusecik_os(A0,A1,A2); B[1] := prusecik_os(A0,A1,A6); B[2] := prusecik_os(A0,A4,A6); B[3] := prusecik_os(A4,A5,A6);
58 B[4] := prusecik_os(A3,A4,A5); B[5] := prusecik_os(A0,A3,A4); B[6] := prusecik_os(A0,A2,A4);
59 draw osa(A1,A2,-90,2cm)--B[0]--B[1]--osa(A1,A6,90,1.3cm) withpen boldpen;
60 draw B[1]--B[2]--B[3]--osa(A6,A5,90,2cm) withpen boldpen;
61 draw B[3]--B[4]--osa(A3,A5,-90,2.7cm) withpen boldpen;
62 draw B[4]--B[5]--B[2] withpen boldpen;
63 draw B[5]--B[6]--osa(A2,A3,-90,1.3cm) withpen boldpen;
64 draw B[6]--B[0] withpen boldpen;
66 draw A0--A1--A2--A0--A6--A1 dashed evenly;
67 draw A6--A5--A4--A0 dashed evenly; draw A3--A2 dashed evenly;
68 draw A3--A5 dashed evenly; draw A6--A4--A3 dashed evenly;
70 for i:=0 upto 6: draw vertex(B[i]); endfor
71 for i:=0 upto 6: drawemptyvertex(A[i]); endfor
74 figtag("pasy_mnohouhelniku");
78 A0 := origin; A1 := (-u,-u); A2 := (1.3u,-u); A3 := (1.50821u,0.7u); A4 := (0.6u,0.8u); A5 := (0.2u,1.9u); A6 := (-1.3u,1u);
79 def osa(expr a, b, an,l) = from(.5[a,b], angle(b-a)+an, l) enddef;
80 vardef prusecik_os(expr p,q,r) =
82 b = whatever[osa(p,q, 90,1cm), osa(p,q,-90,1cm)];
83 b = whatever[osa(q,r, 90,1cm), osa(q,r,-90,1cm)];
86 def drawline(expr p) = draw ((-2.3u,p)--(2.5u,p)) cutbefore (D0--D1) cutafter (D2--D3) enddef;
87 B[0] := prusecik_os(A0,A1,A2); B[1] := prusecik_os(A0,A1,A6); B[2] := prusecik_os(A0,A4,A6); B[3] := prusecik_os(A4,A5,A6);
88 B[4] := prusecik_os(A3,A4,A5); B[5] := prusecik_os(A0,A3,A4); B[6] := prusecik_os(A0,A2,A4);
90 pair C; C := origin; for i:=0 upto 6: C := C + B[i]; endfor C := C/6;
92 D0 := C+(-2.25,2.25)*u; D1 := C+(-2.25,-2.25)*u; D2 := C+(2.25,-2.25)*u; D3 := C+(2.25,2.25)*u;
94 draw B[0]--B[1]--B[2]--B[3]--B[4]--B[5]--B[6]--B[0] withpen boldpen;
95 draw B[5]--B[2] withpen boldpen;
96 pair E; E := 0.6[B0,B4];
98 drawline(ypart(E)) cutbefore (B2--B5) cutafter (B4--B5) dashed evenly withpen bolderpen;
101 for i:=0 upto 6: drawline(ypart(B[i])) dashed evenly; endfor
102 for i:=0 upto 6: draw vertex(B[i]); endfor
105 figtag("upravy_stromu");
108 draw (0,0.1u)--(2.05u,-2.05u)--(-2.05u,-2.05u)--cycle;
109 pair A[]; A0 := from(origin,-90,0.1u); A1 := from(A0, -70, 0.5u); A2 := from(A1, -110, 0.5u); A3 := from(A2, -80, 0.5u); A4 := from(A3, -120, 0.45u);
110 path p; p := createpath(A0--A1--A2--A3--A4);
111 path q; q := (p scaled 0.93 shifted (-0.15u,-0.15u))--(-1.85u,-1.95u)--cycle; fill q withcolor 0.8white; draw q;
112 q := (p scaled 0.93 shifted (0.15u,-0.15u))--(1.85u,-1.95u)--cycle; fill q withcolor 0.8white; draw q;
113 p := createpath(A0--from(A0,-110,0.1u)--A1--A2--A3--A4); draw p withpen boldpen;
116 figtag("rychla_perzistence");
119 def drawtable(expr p, lab, sa, sb) =
120 draw centersquare xscaled 2u yscaled (2u/3) shifted (p+(0,u/3));
121 draw centersquare xscaled 2u yscaled (2u/3) shifted (p-(0,u/3));
122 label(sa, p+(0,u/3));
123 label(sb, p-(0,u/3));
124 label.bot(lab, p-(0,2u/3));
128 for i:=0 upto 2: A[i] := (0,2u) rotated 120i; endfor
129 drawtable(A1, btex $v$ etex, btex verze 2 etex, btex verze 1 etex);
130 drawtable(A2, btex $v'$ etex, btex verze 3 etex, "");
131 drawtable(A0, btex $u$ etex, btex verze 2 etex, btex verze 1 etex);
133 drawarrow from(A[2]+(0,u/3), 180, 7u/6)--from(A[1]+(0,u/3), 0, 7u/6);
134 drawarrow from(A[0]+(0,-u/3), 180, 7u/6)..{dir -90}from(A[1]+(-3u/4,2u/3), 90, u/6);
135 drawarrow from(A[0]+(0,u/3), 0, 7u/6)..{dir -90}from(A[2]+(3u/4,2u/3), 90, u/6);