so im working on a program that recursively draws trees, and im kinda stuck on my algorithm
basically my main draws the tree trunk
then i have a function that uses some input length n and a radian angle theta and draws polar lines. each time the n decreases and so does theta to give the tree a natural bending look.
any idea how to implement this so that i can draw two lines from ever finished line using recursion?
void line( point start, length n, angle theta ){
if (n==0) return;
point end = start + makevector(theta)*length;
drawline (start, end);
line (end, n-1, theta+delta);
line (end, n-1, theta-delta);
}
Note that you have to pass the beginning of each line too.