Recursive draw functions produce fractal branching structures where each call draws one branch and spawns smaller sub-branches
A recursive function calls itself with reduced parameters until a base case stops recursion. In generative visuals this naturally produces self-similar tree/fractal structures: drawBranch(x, y, radius, level) draws one arc then calls drawBranch at child positions with level-1, stopping at level 0. Recursion level controls depth and exponential complexity — be cautious above level 8 or 9. Visual weight can encode depth: strokeWeight(level * 2) makes parent branches thicker. A common pitfall is forgetting the base case, which causes a stack overflow. Another is expecting depth > ~12 to be real-time — call count doubles per level.
Examples
simple example of a recursive function — M_5_1_01: drawBranch(0,0,startRadius,recursionLevel) -> arc + two recursive calls at half radius. Keys 1-9 set recursionLevel interactively.
Assessment
Trace the call tree for drawBranch(0,0,200,3): how many total calls are made? Modify the function to add a random angle offset at each split so the result is no longer perfectly symmetric.