Recursion    Example Index: |  1  |  2  |  3  |

02: RecuSquare

RecuSquare Definition    download .ghx

Start with a square (actually, any polygon will do). This is the initial motif --- the input to the recursion. The recursive function must transform the motif as a copy and call itself on the copy. In this sample, the transformation is specified as a parameter t. The new motif's vertices are parametric points on the original motifs edges with parameter t.
In a computer recursions must stop (though this is not true in mathematics!). They either stop by design or by overflow of some data structure, typically the recursion stack, in the programming language. In this sample, depth is the control and therefore is an argument to the recursive function. Each subsequent call to the function reduces the depth argument by one.      ... more on Design Patterns CA


RecuSquare Manipulations