[PD] Refactoring a PD patch

Mathieu Bouchard matju at artengine.ca
Sun Dec 23 01:00:58 CET 2007

On Tue, 11 Dec 2007, Mike McGonagle wrote:

> I was actually thinking about two different ways of doing it. One that 
> would start with the inputs (or any object that is a source of some 
> kind) and work down. The other way would be just the reverse. I was also 
> looking at some Graph Theory, and it might be useful to implement a 
> depth-first or a breath-first kind of algorithm.

I don't think that either breadth-first or depth-first will provide you 
with a satisfying result. Both are top-down traversals. I believe that 
it's better to do bottom-up: start with individual objects, try to group 
them in sections, then align things tightly within sections, but then find 
the width of sections to figure out how you can place them in the patch so 
that they don't overlap.

Another kind of solution that I've thought about, is an incremental 
improvement, inspired by laws of physics. Invent laws of tidyness that are 
embodied by forces that pull and push objects in certain ways. This is 
much more CPU-expensive but it's surely much faster than a human. This 
kind of solution is more flexible because it can balance things between 
contradictory rules, so it's easier to complexify that kind of 
algorithm (add new rules that you think of), than with the bottom-up 
or top-down ways. It's also better in other ways, but it's too long to 
explain here.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada

More information about the Pd-list mailing list