(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
int num_left = 0; /* How many left twigs */
pair[] left_nodes = []; /* start, end of left twigs */
int num_right = 0; /* How many right twigs */
pair[] right_nodes = []; /* start, end of right twigs */
/* pens for left and right */
pen l = rgb(1, 0, 0);
pen r = rgb(0, 0, 1);
/* draw left's twigs */
for(int i = 0; i < num_left; ++i) {
begin = left_nodes[2 * i];
end = left_nodes[2 * i + 1];
draw(begin -- end, l);
}
/* draw right's twigs */
for(int i = 0; i < num_right; ++i) {
begin = right_nodes[2 * i];
end = right_nodes[2 * i + 1];
draw(begin -- end, r);
}
/* draw nodes */
for(pair node : left_nodes) {
dot(node, rgb(0, 0, 0) + linewidth(6));
}
for(pair node : right_nodes) {
dot(node, rgb(0, 0, 0) + linewidth(6));
}