Skip to content

Collision Trees

The rules describing how these images are created are simple to describe. Grow a tree of branching lines in the obvious way, but whenever multiple branches collide, cut off the branches that reached there last. These simple rules lead to a surprising variety of behaviors. I give some implementation details at the bottom.

All of the trees in this first group only vary in the number and angle of their branches at each branching point. For example, each such tree can be parameterized by a list of angles like [+PI/4, -PI/4], in addition to a parameter for tree depth. See if you can figure out how each of their behaviors arise, given that they all start from a single vertical line.

This tree breaks the pattern above by exponentially decaying the length of branches:

These are Fibonacci Trees. Try counting the leaves of the various dendrites sticking out the top of the first image:

These images have multiple groups of trees growing at different speeds, racing to fill the plane. Compare to my continuous simluation of the same dynamic.

Here is one that my sister printed out and colored in:

Some animations of growth:

The original idea for a self-colliding tree was conceived of by another member of the "Aesthetic Function Graphposting" Facebook group. My contribution was to improve the algorithm in the following ways so that I could further explore the parameter space:

  • Performance: All line segment are stored in a hash-table indexed by their middle coordinates rounded to a pair of integers. Since each segment is limited to a length of 1, the algorithm only needs to check a segment for intersection with nearby coordinates.
  • Generality: Allowing for multiple branches and branches at different angles, as well as the additional experiments above.
  • Collision Conditions: The above generailities mean that branches that collide don't always reach that point at the same time and therefore don't all die. This requires keeping track of distance from the root.
  • Float Errors: Care was taken to prevent unpredictable floating point errors when line segments start/end at "the same point".