<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="jit.linden" module="jit" category="Jitter Math">
	<digest>
		Lindenmayer string expansion (L-systems)
	</digest>
	<description>
		The <o>jit.linden</o> object interprets an incoming 1-dim, 1-plane char matrix as a Lindenmayer System (L-system).
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Jitter
		</metadata>
		<metadata name="tag">
			Jitter Math
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="matrix">
			<digest>
				in
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="matrix">
			<digest>
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="matrix">
			<digest>
				out
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="matrix">
			<digest>
				dumpout
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--MOP-->
	<mop matrixinputcount="1" matrixoutputcount="1">
		<matrixoutput name="out" planelink="1" typelink="1" dimlink="1" minplanecount="1" maxplanecount="1" mindimcount="1" maxdimcount="32">
			<types>
				char
			</types>
		</matrixoutput>
	</mop>
	<!--MESSAGES-->
	<jittermethodlist>
		<jittermethod name="bang" />
		<jittermethod name="clear" />
		<jittermethod name="exportattrs" />
		<jittermethod name="exportsummary" />
		<jittermethod name="getattributes" />
		<jittermethod name="getstate" />
		<jittermethod name="jit_matrix" />
		<jittermethod name="importattrs" />
		<jittermethod name="outputmatrix" />
		<jittermethod name="summary" />
	</jittermethodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="boundmode" get="1" set="1" type="int" size="1">
			<digest>
				Starting cell for production matching
			</digest>
			<description>
				The starting cell for production matching (0 or 1) (default = 1)
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="enumvals" get="1" set="1" type="atom" size="2">
					<enumlist>
						<enum name="Start at Cell 0">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Start at Cell 1">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Boundary Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="ignore" get="1" set="1" type="symbol" size="128">
			<digest>
				A list of single characters to ignore during context matching (default = none)
			</digest>
			<description>
				Characters to ignore during context matching
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Ignore Symbols" />
			</attributelist>
		</attribute>
		<attribute name="leftbranch" get="1" set="1" type="int" size="1">
			<digest>
				Left branch character in the Lindenmayer string
			</digest>
			<description>
				The character value to be interpreted as the start of a branch in the Lindenmayer string (default = 91 (ascii '['))
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Left Branch Character" />
			</attributelist>
		</attribute>
		<attribute name="production" get="1" set="1" type="symbol" size="200">
			<digest>
				Production rules of the L-system
			</digest>
			<description>
				A list of symbols in the format <m>left_context strict_predecessor right_context successor_string ...</m> that defines the production rules of the L-system (default = none)
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Production Rules" />
			</attributelist>
		</attribute>
		<attribute name="rightbranch" get="1" set="1" type="int" size="1">
			<digest>
				Right branch character in the Lindenmayer string
			</digest>
			<description>
				The character value to be interpreted as the start of a branch in the Lindenmayer string (default = 93 (ascii ']'))
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Right Branch Character" />
			</attributelist>
		</attribute>
		<attribute name="wildcard" get="1" set="1" type="int" size="1">
			<digest>
				Wildcard character in the Lindenmayer string
			</digest>
			<description>
				The character value to be interpreted as a wildcard in the Lindenmayer string (default = 42 (ascii '*'))
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Wildcard Character" />
			</attributelist>
		</attribute>
	</attributelist>
	<jitterattributelist>
		<jitterattribute name="outputmode" />
		<jitterattribute name="adapt" />
		<jitterattribute name="out_name" />
		<jitterattribute name="type" />
		<jitterattribute name="dim" />
		<jitterattribute name="planecount" />
	</jitterattributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="jit.linden.png" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="jit.conway" />
		<seealso name="jit.turtle" />
	</seealsolist>
	<discussion>
		<p>
			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 <b>productions</b>), 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 <b>axiom</b> (starting string) is very small.
		</p>
		<p>
			The <o>jit.linden</o> object treats the incoming matrix as ASCII, and certain values are reserved to indicate wildcards (<m>*</m> by default) and branching (<m>[</m> and <m>]</m> by default). These can be set by the <at>wildcard</at>, <at>leftbranch</at>, and <at>rightbranch</at> attributes.
		</p>
		<p>
			The arguments to the <at>ignore</at> and <at>production</at> attributes should be lists of ASCII characters, e.g.:
		</p>
		<p>
			<m>ignore F C A</m> tells the <o>jit.linden</o> object to ignore the ASCII characters <m>F</m>, <m>C</m>, and <m>A</m> when checking context during a production match.
		</p>
		<p>
			typically ignored symbols are characters which describe geo-spatial information (e.g. turtle graphics) and aren't included in the grammar of the production.
		</p>
		<p>
			<m>production * F * +F[F]</m> tells the object to take every instance of the ASCII character <m>F</m> found in the input matrix and replace it with the string <m>+F[F]</m>. The output string is lengthened as a result, so that the first four generations of an L-system with an axiom of <m>F</m> (as a starting point) would look like this:
		</p>
		<p>
		</p>
		<p>
			+F[F]
		</p>
		<p>
			++F[F][+F[F]]
		</p>
		<p>
			+++F[F][+F[F]][++F[F][+F[F]]]
		</p>
		<p>
			More complex models can be created by adding multiple productions, or by introducing context matching into the L-system grammar. For example:
		</p>
		<p>
			The message <m>production G F * +F</m> instructs the <o>jit.linden</o> object to replace values of <m>F</m> with <m>+F</m> only if the character preceding the <m>F</m> is a <m>G</m>. Otherwise, the <m>F</m> is simply echoed to the output string unchanged. If you were to give jit.linden the message:
		</p>
		<p>
			<m>production G F * +F * G * G-</m> 
		</p>
		<p>
			multiple productions are defined. <m>F</m> is replaced as in the example above, but the character <m>G</m> is now replaced by <m>G-</m> as well. Up to 50 productions in the format [left_context] [strict_predecessor] [right_context] [successor_string] can be sent to <o>jit.linden</o>. 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.
		</p>
		<p>
			Typically, the output of the <o>jit.linden</o> object will then be interpreted by an object which scans the string and interprets the symbols as commands. The <o>jit.turtle</o> object interprets L-systems as turtle graphics, so that characters such as <m>F</m>, <m>+</m>, and <m>-</m> acquire special meaning. You could easily use a <o>jit.iter</o> object (or a holding <o>jit.matrix</o> object polled by <m>getcell</m> messages) to access the Lindenmayer string in Max. You can then use the <o>select</o> 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.
		</p>
	</discussion>
</c74object>
