A simple tree structure is declared in the Parallaxis program, through which start and end points of the lines are passed (`**' denotes the exponential operator). Only procedure MidPoint is shown, where the actual processing takes place. The tree levels are activated successively, and the midpoint displacement is carried out for each level (using function Gauss not shown here, which returns a gaussian distributed random value). While the leaves have not yet been reached, the data values low and high are passed to the child nodes. In this method, the left child receives the values low and x as the start and end points of its line segment, while the right child receives x and high.
Figure 14 Divide-and-conquer implemented with tree topology
CONFIGURATION tree [1..maxnode];
CONNECTION lchild : tree[i] <-> tree[2*i] :parent;
rchild : tree[i] <-> tree[2*i+1] :parent;
VAR low, high, x: tree OF REAL;
PROCEDURE MidPoint(delta: REAL; level: INTEGER);
BEGIN (* select level *)
IF 2**(level-1) <= ID(tree) <= 2**level-1 THEN
x := 0.5 * (low + high) + delta*Gauss;
IF level < maxlevel THEN
SEND.lchild (low,low); (* values for children *)
SEND.lchild (x,high);
SEND.rchild (x,low);
SEND.rchild (high,high);
END;
END;
END MidPoint;
Figure 15 Fractal curve generated by program
The computation time required for this program is log2 n steps for n leaf nodes (equal to the tree's height). Figure 15 shows a fractal curve generated by this program with 127 PEs, while Figure 16 shows the beginning of another fractal number sequence interpreted as fractal music.
Figure 16 Fractal music