Commit 983e1af4 authored by Martin Mareš's avatar Martin Mareš
Browse files

Merge branch 'jiri-skrobanek/persistence'

parents 3ca32732 a3f57bd0
PICS=point-localization fat-nodes path-copying
TOP=..
include ../Makerules
DefaultHead=TeXHead;
real factor = 0.4;
object Node(string l, pair p){
label(l,p*factor);
return draw("", ellipse, p*factor, xmargin=3mm,FillDraw(white,black));
}
void Version(string l, pair p){
draw(box(factor*(p-(0.5cm,0.5cm)),factor*(p+(0.5cm,0.5cm))), black+linewidth(0.2mm));
label(l,p*factor);
}
void Container(pair p){
draw(box(factor*(p-(0.6cm,0.6cm)),factor*(p+(2.6cm,0.6cm))), black+linewidth(0.2mm));
}
object a = Node("A", (-3cm,0cm));
object b = Node("B", (-3cm,-3cm));
object c = Node("C", (-3cm,-6cm));
object d = Node("D", (-3cm,3cm));
Container((0cm,0cm));
Version("1",(0cm,0cm));
Version("2",(1cm,0cm));
Version("4",(2cm,0cm));
Container((5cm,0cm));
Version("5",(5cm,0cm));
Container((0cm,-3cm));
Version("2",(0cm,-3cm));
Version("3",(1cm,-3cm));
Container((0cm,-6cm));
Version("3",(0cm,-6cm));
Version("5",(1cm,-6cm));
Container((0cm,3cm));
Version("4",(0cm,3cm));
pair left(object p){
return point(p,dir(-120));
}
pair right(object p){
return point(p,dir(0));
}
pair top(object p){
return point(p,dir(90));
}
pair bottom(object p){
return point(p,dir(-90));
}
draw(right(a)--(factor*-0.6cm,0cm), Arrow);
draw(right(b)--(factor*-0.6cm,factor*-3cm), Arrow);
draw(right(c)--(factor*-0.6cm,factor*-6cm), Arrow);
draw(right(d)--(factor*-0.6cm,factor*3cm), Arrow);
draw((factor*2.6cm,0cm)--(factor*4.4cm,0cm), Arrow);
draw(arc((-4cm,-3cm)*factor, r=3cm*factor, angle1=270, angle2=90),dotted, arrow=Arrow(TeXHead));
draw(bottom(d)--top(a),dotted,arrow=Arrow(TeXHead));
draw(top(b)--bottom(a),dotted,arrow=Arrow(TeXHead));
draw((factor*1cm,factor*-0.5cm)--(factor*1cm,factor*-2.4cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
draw((factor*2cm,factor*-0.5cm)--(factor*2cm,factor*-2.4cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
draw((factor*1cm,factor*-3.5cm)--(factor*1cm,factor*-5.4cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
draw((factor*2cm,factor*0.5cm)--(factor*2cm,factor*2.4cm),arrow=Arrow(TeXHead),L=Label("r", position=MidPoint));
draw((factor*5cm,factor*0.5cm)--(factor*5cm,factor*3cm)--(factor*2.6cm,factor*3cm),arrow=Arrow(TeXHead),L=Label("r", position=MidPoint));
draw((factor*5cm,factor*-0.5cm)--(factor*5cm,factor*-6cm)--(factor*2.6cm,factor*-6cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
\ No newline at end of file
DefaultHead=TeXHead;
real factor = 0.4;
object OldNode(string l, pair p){
label(l,p*factor);
return draw("", ellipse, p*factor, xmargin=3mm,FillDraw(white,black));
}
object NewNode(string l, pair p){
label(l,p*factor);
return draw("", ellipse, p*factor, xmargin=3mm,FillDraw(white,black+linewidth(0.5mm)));
}
object a = OldNode("A",(0cm,0cm));
object b = OldNode("B",(-4cm,-5cm));
object c = OldNode("C",(4cm,-5cm));
object d = OldNode("D",(-2cm,-10cm));
object e = OldNode("E",(2cm,-10cm));
object f = OldNode("F",(6cm,-10cm));
object a2 = NewNode("A",(-5cm,0cm));
object b2 = NewNode("B",(-7cm,-5cm));
object g = NewNode("G",(-9cm,-10cm));
pair left(object p){
return point(p,dir(-120));
}
pair right(object p){
return point(p,dir(-60));
}
pair top(object p){
return point(p,dir(90));
}
draw(left(a)--top(b),black,Arrow());
draw(right(a)--top(c),black,Arrow());
draw(left(a2)--top(b2),dashed,Arrow());
draw(right(a2)--top(c),dashed,Arrow());
draw(right(b)--top(d),black,Arrow());
draw(left(b2)--top(g),dashed,Arrow());
draw(right(b2)--top(d),dashed,Arrow());
draw(left(c)--top(e),black,Arrow());
draw(right(c)--top(f),black,Arrow());
This diff is collapsed.
import ads;
real miny = -2;
real maxy = 5;
void vertical(real x)
{
draw((x,miny) -- (x,maxy), dashed);
}
vertical(-3);
vertical(-2.5);
vertical(-1);
vertical(-0.2);
vertical(0.2);
vertical(1);
vertical(2);
vertical(3);
vertical(5);
vertical(6);
vertical(9);
draw((3.9,1.9) -- (4.1,2.1));
draw((4.1,1.9) -- (3.9,2.1));
draw((4,miny) -- (4,maxy), dotted);
pair a = (-0.2,-1);
pair b = (-1,0);
pair c = (0.2,1);
pair d = (1,0);
pair e = (5,3);
pair f = (2,4);
pair g = (-3,2);
pair h = (-2.5,-0.5);
pair i = (3,-0.5);
pair j = (9,0.5);
pair k = (6,1);
pair[] ps = {a,b,c,d,e,f,g,h,i,j,k};
for(int i = 0; i < ps.length; ++i)
{
fill(circle(ps[i],0.05));
}
draw(a -- b -- c -- d -- a);
draw(a -- h -- b);
draw(g -- c);
draw(h -- g -- f -- c);
draw(c -- f -- e -- i -- d -- c);
draw(i -- k -- j -- e -- i);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment