input lib figname("7-geom"); figtag("male_obaly"); beginfig(1); pickup boldpen; labeloffset:=1cm; pair c,pos; c := (0,0); pos := c; drawemptyvertex(c); label.bot(btex $n=1$ etex, pos); c := (2cm,0); pos := pos + c; pair A[]; A[0] := (-0.3cm, -0.2cm)+c; A[1] := (0.2cm, 0.3cm)+c; draw A[0]--A[1]; drawemptyvertex(A[0]); drawemptyvertex(A[1]); label.bot(btex $n=2$ etex, pos); pos := pos + c; A[2] := (+0.3cm, -0.4cm)+c; for i := 0 upto 2: A[i] := A[i] shifted c; endfor draw A[0]--A[1]--A[2]--cycle; for i := 0 upto 2: drawemptyvertex(A[i]); endfor label.bot(btex $n=3$ etex, pos); pos := pos + c; A[3] := (A[0]+A[1]+A[2])/3; for i := 0 upto 3: A[i] := A[i] shifted c; endfor draw A[0]--A[1]--A[2]--cycle; for i := 0 upto 2: drawemptyvertex(A[i]); endfor draw vertex(A[3]); c := (1cm,0); pos := pos + c/2; A[3] := A[1]+(0.3cm,-0.2cm); for i := 0 upto 3: A[i] := A[i] shifted c; endfor draw A[0]--A[1]--A[3]--A[2]--cycle; for i := 0 upto 3: drawemptyvertex(A[i]); endfor label.bot(btex $n=4$ etex, pos); endfig; figtag("pridani_bodu"); beginfig(2); pair A[],B[],C,shift; shift := (4.5cm,0); A[0] := (-1.7cm,1.1cm); A[1] := (-1.2cm,1.2cm); A[2] := (-0.4cm,1cm); A[3] := (0.2cm,0.2cm); A[4] := (0.4cm,-0.7cm); A[5] := (-0.8cm,-1.3cm); A[6] := (-1.4cm,-1.4cm); B[0] := (-1.1cm, 0.7cm); B[1] := (-0.6cm, 0.1cm); B[2] := (-1.3cm, -0.6cm); C := (1cm, 0.1cm); % krok 1 pickup boldpen; draw A[0] for i := 1 upto 6: --A[i] endfor; for i := 1 upto 5: drawemptyvertex(A[i]); endfor for i := 0 upto 2: draw vertex(B[i]); endfor draw vertex(C); drawarrow (C+(0.5cm,0)--C+(1.5cm,0)) shifted (0, -0.1cm) withpen normalpen; for i:=0 upto 6: A[i] := A[i] shifted shift; endfor for i:=0 upto 2: B[i] := B[i] shifted shift; endfor C := C shifted shift; % krok 2 draw A[0] for i := 1 upto 6: --A[i] endfor; draw A[4]{dir 70}..C; draw A[4]{dir 45}..C; draw C--A[2] dashed evenly withpen normalpen; draw C--A[3] dashed evenly withpen normalpen; for i := 1 upto 5: drawemptyvertex(A[i]); endfor for i := 0 upto 2: draw vertex(B[i]); endfor drawemptyvertex(C); drawarrow (C+(0.5cm,0)--C+(1.5cm,0)) shifted (0,-0.1cm) withpen normalpen; for i:=0 upto 6: A[i] := A[i] shifted shift; endfor for i:=0 upto 2: B[i] := B[i] shifted shift; endfor C := C shifted shift; % krok 3 draw for i := 0 upto 2: A[i]-- endfor C for i := 4 upto 6: --A[i] endfor; for i := 1 upto 2: drawemptyvertex(A[i]); endfor for i := 4 upto 5: drawemptyvertex(A[i]); endfor for i := 0 upto 2: draw vertex(B[i]); endfor draw vertex(A[3]); drawemptyvertex(C); endfig; figtag("obalky"); beginfig(3); labeloffset := 0.2cm; pickup boldpen; pair A[],B[]; A[0] := (-7cm, 0cm); A[1] := (-6.2cm, 0.9cm); A[2] := (-4.6cm,1.5cm); A[3] := (-2.4cm,1.8cm); A[4] := (-0.8cm,1.5cm); A[5] := (0.4cm,0.6cm); A[6] := (0.8cm,-0.10cm); A[7] := (-1.6cm,-1.9cm); A[8] := (-4cm,-2.1cm); A[9] := (-6cm, -1.5cm); A[10] := (-7cm, 0cm); B[0] := (-2.2cm, 0.7cm); B[1] := (-1.2cm, 0.1cm); B[2] := (-2.6cm, -0.6cm); B[3] := (-3.6cm, -0.4cm); B[4] := (-3cm, 0.6cm); B[5] := (-2.6cm, 1cm); B[6] := (-1cm, -1.2cm); B[7] := (-6.5cm, 0.2cm); B[8] := (-5cm, 0.8cm); B[9] := (-6cm, -0.6cm); B[10] := (-5cm, -1.2cm); draw createpath(for i := 0 upto 5: A[i]-- endfor A[6]); draw (for i := 6 upto 9: A[i]-- endfor A[10]) dashed evenly; for i := 0 upto 9: drawemptyvertex(A[i]); endfor for i := 0 upto 10: draw vertex(B[i]); endfor label(btex \font\myfont=csr10 \myfont horní obálka etex, ((-7cm+0.8cm)/2,2.2cm)); label(btex \font\myfont=csr10 \myfont dolní obálka etex, ((-7cm+0.8cm)/2,-2.5cm)); label.lft(btex $L$ etex, A[0]); label.rt(btex $P$ etex, A[6]); endfig; figtag("determinant"); beginfig(4); labeloffset := 0.1cm; pair A[], shift; shift := (4cm,1cm); % det(M) > 0 A[0] := (-2cm, 0); A[1] := (0,-1cm); A[2] := (1.5cm, 0cm); A[3] := A[0] + A[2] - A[1]; fill A[0]--A[1]--A[2]--A[3]--cycle withcolor 0.8white; draw A[0]--A[1]--A[2]--A[3]--cycle dashed evenly; drawarrow A[0]--0.96[A[0],A[1]] withpen boldpen; drawarrow A[1]--0.96[A[1],A[2]] withpen boldpen; for i:=0 upto 2: draw vertex(A[i]); endfor label.lft(btex $h_{k-1}$ etex, A[0]); label.bot(btex $h_k$ etex, A[1]); label.llft(btex $\vec u$ etex, 0.5[A[0],A[1]]); label.lrt(btex $\vec v$ etex, 0.5[A[1],A[2]]); label.rt(btex $b$ etex, A[2]); label(btex $\det(M) > 0$ etex, 0.5[A[0],A[2]]); % det(M) = 0 A[0] := (-1cm, -0.5cm) + shift; A[1] := (0, -1cm) + shift; A[2] := (1cm, -1.5cm) + shift; drawarrow A[0]--0.96[A[0],A[1]] withpen boldpen; drawarrow A[1]--0.96[A[1],A[2]] withpen boldpen; for i:=0 upto 2: draw vertex(A[i]); endfor label.lft(btex $h_{k-1}$ etex, A[0]); label.llft(btex $h_k$ etex, A[1]); label.llft(btex $\vec u$ etex, 0.5[A[0],A[1]]); label.llft(btex $\vec v$ etex, 0.5[A[1],A[2]]); label.bot(btex $b$ etex, A[2]); label(btex $\det(M) = 0$ etex, origin) shifted (0,0.3cm) rotated -28 shifted 0.5[A[0], A[2]]; % det(M) < 0 shift := (7.5cm, 1.25cm); A[0] := (-1cm, -0.5cm) + shift; A[1] := (1.5cm, -1cm) + shift; A[2] := (2cm, -2.5cm) + shift; A[3] := A[0] + A[2] - A[1]; fill A[0]--A[1]--A[2]--A[3]--cycle withcolor 0.8white; draw A[0]--A[1]--A[2]--A[3]--cycle dashed evenly; drawarrow A[0]--0.96[A[0],A[1]] withpen boldpen; drawarrow A[1]--0.96[A[1],A[2]] withpen boldpen; for i:=0 upto 2: draw vertex(A[i]); endfor label.lft(btex $h_{k-1}$ etex, A[0]); label.urt(btex $h_k$ etex, A[1]); label.top(btex $\vec u$ etex, 0.5[A[0],A[1]]); label.rt(btex $\vec v$ etex, 0.5[A[1],A[2]]); label.rt(btex $b$ etex, A[2]); label(btex $\det(M) < 0$ etex, 0.5[A[0],A[2]]); endfig; figtag("rybi_motivace"); beginfig(5); u := 0.3cm; def draw_fish(expr pos,size,rot) = draw ((-1.3u*size,0){dir 60}..{right}(u*size,-u*size/4)) rotated rot shifted pos; draw ((-1.3u*size,0){dir -50}..{right}(u*size,u*size/4)) rotated rot shifted pos; draw ((u*size,-u*size/4)--(u*size,u*size/4)) rotated rot shifted pos; draw (-1u*size,u*size/15) rotated rot shifted pos withpen pencircle scaled (u/8); for i:=1 upto 3: draw (dirs((u*size,-u*size/4+i*u*size/8), 180, u*size/6)) rotated rot shifted pos; endfor enddef; pair A[],B[]; A[0] := (-7cm, 0cm); A[1] := (-6.2cm, 0.9cm); A[2] := (-4.6cm,1.5cm); A[3] := (-2.4cm,1.8cm); A[4] := (-0.8cm,1.5cm); A[5] := (0.4cm,0.6cm); A[6] := (0.8cm,-0.10cm); A[7] := (-1.6cm,-1.9cm); A[8] := (-4cm,-2.1cm); A[9] := (-6cm, -1.5cm); A[10] := (-7cm, 0cm); B[0] := (-2.2cm, 0.7cm); B[1] := (-1.2cm, 0.1cm); B[2] := (-2.6cm, -0.6cm); B[3] := (-3.6cm, -0.4cm); B[4] := (-3cm, 0.6cm); B[5] := (-2.6cm, 1cm); B[6] := (-1cm, -1.2cm); B[7] := (-6.5cm, 0.2cm); B[8] := (-5cm, 0.8cm); B[9] := (-6cm, -0.6cm); B[10] := (-5cm, -1.2cm); for i:=0 upto 9: draw_fish(A[i], 1, 0); endfor; for i:=0 upto 10: draw_fish(B[i], 1, 0); endfor; draw createpath(for i:=0 upto 9: A[i]-- endfor cycle) scaled 1.13 shifted (0.4cm,0) withpen boldpen; endfig; figtag("provazkovy_algoritmus"); beginfig(6); pickup boldpen; pair A[],B[],u; u := (-3cm, 0); for i := 0 upto 3: A[i] := u rotated (-30*i) yscaled 0.7; endfor; A[2] := A[2] + (0,0.1cm); draw for i:=0 upto 2: A[i]-- endfor A[3]; drawarrow ((u/2) for i:=1 upto 3: ..u/2 rotated (-30*i) endfor) yscaled 0.7 withpen normalpen; B[0] := (-2cm,0.5cm); B[1] := (-1cm,1.5cm); B[2] := (-0.5cm,0.2cm); for i:=0 upto 2: draw vertex(B[i]); endfor path ub; ub := (-20cm,3cm)--(20cm,3cm); numeric ang[]; ang[0] = 90; ang[1] = angle(A[1]-A[0]); ang[2] = angle(A[2]-A[1]); ang[3] = angle(A[3]-A[2]); for i:=0 upto 2: draw reverse(dirs(A[i],ang[i],6cm) cutafter ub) withpen normalpen dashed evenly; l := 1cm + (i-1)*0.2cm; drawarrow from(A[i],ang[i],l)..from(A[i],(ang[i]+ang[i+1])/2,l)..from(A[i],ang[i+1],l) withpen normalpen; endfor for i:=0 upto 3: drawemptyvertex(A[i]); endfor; endfig; figtag("naslednik_pres_konvexni_obal"); beginfig(7); pair A[], C; label.lrt(btex $Q_i$ etex, (1.5cm,-0.8cm)); pickup boldpen; C := (-4cm,-0.3cm); for i:=0 upto 6: A[i] := (2cm,0) rotated (360*i/7+5) yscaled 0.7; draw vertex(A[i]); endfor; draw for i:=0 upto 6: A[i]-- endfor cycle withpen normalpen; draw C--A[2] dashed evenly; draw dirs(C, -140, 0.5cm); drawemptyvertex(A[2]); drawemptyvertex(C); drawdblarrow (fullcircle scaled 2cm rotated (360*2/7-5) yscaled 0.7) cutbefore (origin--(3cm,0) rotated (360*2/7+25)) withpen normalpen; %drawarrow C+(0,0.5cm){dir 60}..A[2]+(0,0.5cm) withpen normalpen; %drawarrow 0.6A[5]{dir 170}..(0.6A[3] rotated -15) withpen normalpen; %drawarrow 0.7A[6]{dir 60}..(0.5A[1] rotated 30) withpen normalpen; endfig; end