colidescope

/live/ working-with-recursion

Welcome! You are not currently logged in. You can Log in or Sign up for an account.

Working with recursion

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.


+Demo: Programming the branching logic

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).

⚠️ You need a member account to access this content.

+Downloads:

⚠️
⚠️
You need a member account to access this content.
04-01-02-end.gh
Starting file

+Demo: Making the growth recursive

⚠️ You need a member account to access this content.

+Downloads:

⚠️
⚠️
You need a member account to access this content.
04-01-03-end.gh

+Demo: Getting parameters from Discover

⚠️ You need a member account to access this content.

+Downloads:

⚠️
⚠️
You need a member account to access this content.
04-01-04-end.gh

+Demo: Depth-first vs. breadth-first recursion

⚠️ You need a member account to access this content.

+Downloads:

⚠️
⚠️
You need a member account to access this content.
04-01-05-end.gh

+Demo: Optimizing for growth

⚠️ You need a member account to access this content.

+Downloads:

⚠️
⚠️
You need a member account to access this content.
04-01-06-end.gh

+Demo: Pruning the tree with a constraint

⚠️ You need a member account to access this content.

+Downloads:

⚠️
⚠️
You need a member account to access this content.
04-01-07.3dm
⚠️
⚠️
You need a member account to access this content.
04-01-07-end.gh

+Addtional resources

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