Recursion and fractals

MPDA’22

December 9, 2021

Recursion and fractals

What is recursivity?

According to wikipedia, recursive is something that involves the repeated application of a rule, definition, or procedure to successive results.

🤔 🤔 🤔

Here’s an example of recursion in python

numbers = [3,5,1,55,2,8]
totalSum = 0
for num in numbers:
    totalSum += num

totalSum is used to save the accumulated result.

And another with vectors!

vectors = [rg.Vector3d(3,4,6), rg.Vector3d(-1,-6,4), rg.Vector3d(4,4,-5)]

addedVector = rg.Vector3d()

for v in vectors:
    addedVector += v

Examples of recursive behaviour are fractals:

Koch Snowflake:

Koch Snowflake variation:

Sierpinski Triangle

Sierpinski Carpet

References

Generic resources

  1. Generic python
  2. Codility Code Challenges
  3. Rhino Developer Docs
  4. RhinoCommon API
  5. Python for Non-Programmers

Rhino/GH resources