Lindenmayer string expansion (L-systems)
The jit.linden object interprets an incoming 1-dim, 1-plane char matrix as a Lindenmayer System (L-system).
Named after Aristid Lindenmayer (1925-1989), L-systems work on an interpreted grammar model wherein a syntax is defined for replacing individual elements of the incoming string with a replacement string. These models (called production rules, or just productions ), can be context-dependent. L-systems can also support multiple modes of branching (only one dimension of branching is supported here, though branches can be nested). Generally speaking, L-systems get larger (not smaller) through successive productions (or generations of the grammar); the size of the Jitter matrix used by the object determines the maximum length of the string, so a large matrix is advisable, even if the axiom (starting string) is very small.
The jit.linden object treats the incoming matrix as ASCII, and certain values are reserved to indicate wildcards ( * by default) and branching ( [ and ] by default). These can be set by the wildcard , leftbranch , and rightbranch attributes.
The arguments to the ignore and production attributes should be lists of ASCII characters, e.g.:
ignore F C A tells the jit.linden object to ignore the ASCII characters F , C , and A when checking context during a production match.
typically ignored symbols are characters which describe geo-spatial information (e.g. turtle graphics) and aren't included in the grammar of the production.
production * F * +F[F] tells the object to take every instance of the ASCII character F found in the input matrix and replace it with the string +F[F] . The output string is lengthened as a result, so that the first four generations of an L-system with an axiom of F (as a starting point) would look like this:
More complex models can be created by adding multiple productions, or by introducing context matching into the L-system grammar. For example:
The message production G F * +F instructs the jit.linden object to replace values of F with +F only if the character preceding the F is a G . Otherwise, the F is simply echoed to the output string unchanged. If you were to give jit.linden the message:
production G F * +F * G * G-
multiple productions are defined. F is replaced as in the example above, but the character G is now replaced by G- as well. Up to 50 productions in the format [left_context] [strict_predecessor] [right_context] [successor_string] can be sent to jit.linden . The predecessor symbol and the left and right contexts must be single characters (though this is not necessarily true for all L-system interpreters). The successor (or replacement string) can be as long as you like.
Typically, the output of the jit.linden object will then be interpreted by an object which scans the string and interprets the symbols as commands. The jit.turtle object interprets L-systems as turtle graphics, so that characters such as F , + , and - acquire special meaning. You could easily use a jit.iter object (or a holding jit.matrix object polled by getcell messages) to access the Lindenmayer string in Max. You can then use the select object against certain ASCII values and use those values to generate any kind of graphical or sonic data you like. The example patches in the Jitter distribution called 'Lindenmayer Examples' give examples of generating 2-D graphics with L-systems within Max/Jitter.
|boundmode||int||The starting cell for production matching (0 or 1) (default = 1)|
|ignore||symbol||A list of single characters to ignore during context matching (default = none)|
|leftbranch||int||The character value to be interpreted as the start of a branch in the Lindenmayer string (default = 91 (ascii '['))|
|production||symbol||A list of symbols in the formatthat defines the production rules of the L-system (default = none)|
|rightbranch||int||The character value to be interpreted as the start of a branch in the Lindenmayer string (default = 93 (ascii ']'))|
|wildcard||int||The character value to be interpreted as a wildcard in the Lindenmayer string (default = 42 (ascii '*'))|