Download Article Assets

Fractal Geometry

I thought it might be fun to make a patch that can process a Jitter geometry in self-similar fashon.

Self-similarity?

Open the patch fractals.maxpat.

Self-similarity means lots of things, but this is what I'm thinking about:

  • I'd like to implement a process that can take any triangulated geometry, and add new vertices to it following certain criteria.
  • I want this process to be repeatable, and the pattern that iIm expecting to see should be similar to itself at smaller and smaller scales.
  • I'd like this process, although potentially endless, to proceed in stepped fashon, like launching a new iteration at the press of a button.

Feedback Connections

Since I'd like our emergent pattern to repeat itself, we need the possibility to provide as input to the next iteration the result of the previous one. It smells like feedback to me!

But how can we connect jit.geom objects in such a way? We know that matrices containing vertices data can be transofmed into Jitter geometries using jit.geom.togeom, and that Jitter geometries can be transformed back into matrices with jit.geom.tomatrix or via script. So, that's it! We just need to convert our Jitter geometry to matrix and back, and use traditional Jitter objects to create the feedback loop.

The Process

My idea is quite simple:

  • for each triangle of the mesh, compute its area, normal vector, and centroid.
  • for each triangle, add a new vertex in correspondance of the centroid, but shifted along the normal vector by a user-defined amount scaled by the triangle's area.
  • for each edge of the triangle, compute the middle point.
  • connect the 3 original vertices and the new 4 ones like this:

then, take this geometry as the input for the next generation, and keep subdividing it.

That's not the only way to create fractal geometries, of course, but you can start experimenting from here!