Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
107 lines (84 sloc) 1.72 KB
define point {
number x, y;
}
define line {
point start, end, c;
constraints {
(start + end) / 2 = c;
}
draw { &draw_line; }
}
define hline extends line {
number y, len;
constraints {
y = start.y;
y = end.y;
len = end.x - start.x;
}
}
define vline extends line {
number x, len;
constraints {
x = start.x;
x = end.x;
len = end.y - start.y;
}
}
define box {
point n, s, e, w, ne, se, nw, sw, c;
hline top, bottom;
vline left, right;
number ht, wd;
constraints {
nw = top.start;
ne = top.end;
sw = bottom.start;
se = bottom.end;
n = (nw + ne)/2;
s = (sw + se)/2;
w = (nw + sw)/2;
e = (ne + se)/2;
c = (n + s )/2;
top.start = left.start;
top.end = right.start;
bottom.start = left.end;
bottom.end = right.end;
ht = left.len;
wd = top.len;
}
}
define square extends box {
constraints { ht = wd; }
}
define ellipse extends box {
draw { &draw_ellipse; }
}
define circle extends ellipse {
constraints { ht = wd; }
}
box F, add, mul, c32, c59, C;
number hspace, vspace, boxht, boxwd;
line i, j, k1, k2, l, m;
point kk;
constraints {
i.start = F.e; i.end=add.nw;
j.start = add.e; j.end=c32.w;
l.start = c59.e; l.end=mul.sw;
m.start = mul.e; m.end=C.w;
boxht = 2; boxwd = boxht*2;
F.ht = boxht; F.wd = boxwd;
F.nw = (0, 0);
add = F + ( hspace, vspace);
c32 = add + ( hspace, 0);
mul = add + ( 0, vspace);
C = mul + ( hspace, 0);
c59 = mul + (-hspace, vspace);
kk.x = add.sw.x - (hspace-boxwd) * 2/3;
kk.y = (add.sw.y + mul.nw.y)/2;
k1.start = kk;
k1.end = add.sw;
k2.start = kk;
k2.end = mul.nw;
hspace = 1 + boxwd;
vspace = 1 + boxht;
}