# G01_SpaceColonization

## G01_SpaceColonization

Using OpenRNDR to make a Space Colonization Algorithms to make some leaf like, tree like and maybe even different types of natural shapes and formation. Using Jason Webb’s and the following papers (1, 2) as a baseline. This involves having a bunch of nodes, these are the points that have already grown, and attractors (places which the nodes are growing towards). Each attractor then has a field of influence, for each of those nodes we calculate the average direction acting on the node. Draw the next segment, place our new nodes, and then finally kill off the attractors if a node get’s to close to it (and repeat).

### The Algorithm

1. Place attractors
2. Associate the attractors with nearby nodes (within some attraction radius/field of influence). For now only take the NEAREST node
3. Iterate through the nodes and grow the network (segment length)
1. If two nodes would collide we do not add the new node (collision radius)
4. Kill the attractors (kill radius)
5. Prune any lone nodes (nodes which never became associated with an attractor) after a few counts

To do this we build a Spatial Index using a QuadTree. Luckily there was one already built in the OpenRNDR Extension Library, however it was not in the version of OpenRNDR I was building against, so I just copied it in to my util directory for use in this algorithm. The QuadTree gets built at the beginning of every iteration. When doing the searches for the

Each source node will inherit it’s color from it’s parent node (in this iteration of the algorithm)

For this iteration we will just draw a circle for every node.

### Progression

#### Using the QuadTree and Getting the Initial Algorithm Right

Random attractors with one seed node at the center

#### Attractors placed along circles

Attractors are placed along circles with a few starting nodes. Starting with 1 circle then adding more

#### Adding Rectangles, lines and randomizing the center locations

| | | | ——————————————————————————————————————————————— | ——————————————————————————————————————————————— |

#### Some different drawing styles

Bringing the segment lengths closer together

I made some improvements to the draw speed by using groupBy to group the nodes by their color and draw all of those nodes together. It still has issues drawing fast, but that seems to be due to some inefficiency in how the QuadTree look-ups are working.