prologues := 1; defaultfont := "ptmr8r"; % Times Roman beginfig(1); % pictures containing the labels of the individual boxes picture stage.p[]; % center, north/south/west/east point of the corresponding box pair stage.c[], stage.n[], stage.s[], stage.w[], stage.e[]; string lbl; picture p; mw := 0; mh := 0; % maximal text width & height, seen so far stages := 0; % corners of our box x0 = x3 = -x1 = -x2 = maxwidth/2; y0 = y1 = -y2 = -y3 = maxheight/2; % configure all boxes for lbl = "analysis", "design", "implementation", "testing", "more testing", "maintenance": stages := stages + 1; stage.p[stages] := p := thelabel(lbl, origin); % measure this label width := xpart(lrcorner p - llcorner p); if width > mw: mw := width; fi; height := ypart(urcorner p - lrcorner p); if height > mh: mh := height; fi; % position the corresponding box if stages = 1: stage.c[stages] = origin; else: stage.c[stages] - stage.c[stages-1] = (maxwidth*4/5, -maxheight*3/2); fi; % compute the connecting points of our box stage.n[stages] = 2/3[z0,z1] + stage.c[stages]; stage.w[stages] = 1/2[z1,z2] + stage.c[stages]; stage.e[stages] = 1/2[z0,z3] + stage.c[stages]; stage.s[stages] = 2/3[z2,z3] + stage.c[stages]; endfor; % construct our box maxwidth = mw * 5/4; maxheight = mh * 3; path box; box = z0 -- z1 -- z2 -- z3 -- cycle; % draw everything for i = 1 upto stages: draw box shifted stage.c[i]; label(stage.p[i], stage.c[i]); if i > 1: drawarrow stage.e[i-1]{right} .. stage.n[i]{down}; drawarrow stage.w[i]{left} .. stage.s[i-1]{up}; fi; endfor; endfig; end.