hexahedria

Daniel Johnson's personal fragment of the web

Subdivision

This is an experiment I started working on many months ago, but didn’t actually finish until recently. It was based on some doodles I used to make, where I would draw a bunch of lines, continuing each until it intersected with others. It creates a bunch of lines randomly, and then extends them until they intersect, coloring the regions between the lines.

Whenever a line is spawned, I compute all of the possible intersections of the lines with existing lines on screen. That makes it easier to animate later: I can just check each time a line passes a precomputed intersection point, and if the other line has already passed through the point, I stop the extension of this line. Otherwise, I continue.

To display the regions, I first generate a graph of all vertices and their connections with each other. I then sort the edges around each vertex by angle. This allows me to start at some edge and take the next edge on each vertex, thus walking along the inside of one polygon. If the polygon is closed, I color it based on the lines of the polygon. If it is open (i.e. if one of the vertices is the end of an extending or dying line segment) then I color it black.

I actually have two layered canvas elements in this experiment. The upper canvas draws the lines in white, and the lower canvas draws the colors. This allows the colors to smoothly fade while the lines do not.

This experiment is pretty interesting to watch. I think it looks a bit like stained glass, and the timing of the line disappearances and reappearances makes an interesting temporal pattern.

© . All rights reserved. | Top