In this session we cover recursive functions which are functions that can call themselves
In this session, we cover recursive functions, which is a strategy in programming where you define a function that can call itself. Recursion is a great strategy for creating very efficient algorithms that solve problems by breaking them down into smaller parts. We can use this strategy within our Python scripts to create advanced generative models that use strategies such as growth, aggregation, and subdivision to create complex design solutions controlled by a relatively small number of input parameters.
In this demo we set up our basic branching logic by creating a new function called grow(). This function takes a starting point and a parameter as an input, and based on that parameter creates either one or two new points and lines connecting the starting point to the new point(s).
For a further discussion of recursive algorithms and how they can be applied to develop generative models based on branching and subdivision, you can look at the chapter on Recursive Systems in the Generative Design publication on Medium:
https://medium.com/generative-design/recursive-systems-5b1f813b2b8b