<?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.turtle" module="jit" category="Jitter Utilities">
	<digest>
		2-d turtle graphics interpreter
	</digest>
	<description>
		The <o>jit.turtle</o> object emulates simple LOGO-style graphics. It interprets single char values in its inlet as ASCII letters that describe turtle graphics commands. A valid ASCII input will generate appropriate drawing commands for use with either the Max <o>lcd</o> object or the <o>jit.lcd</o> object.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Jitter
		</metadata>
		<metadata name="tag">
			Jitter Utilities
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="matrix">
			<digest>
				in
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="matrix">
			<digest>
				in
			</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>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg id="0" name="OBJARG_NAME" type="OBJARG_TYPE" optional="0">
			<digest>
				TEXT_HERE
			</digest>
			<description>
				TEXT_HERE
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist />
			<digest>
				Send ASCII character commands to the turtle
			</digest>
			<description>
				ASCII character commands for the turtle
				<br />
				Valid numbers are 35 (<i>#</i>), 33 (<i>!</i>), 70 (<i>F</i>), 102 (<i>f</i>), 91 (<i>[</i>), 93 (<i>]</i>), 43 (<i>+</i>), 45 (<i>-</i>), and 124 (<i>|</i>).
			</description>
		</method>
		<method name="reset">
			<arglist />
			<digest>
				Reset the turtle position to its origin
			</digest>
			<description>
				Resets the turtle to the position specified by the <at>origin</at> attribute. If the <at>clearmode</at> attribute is set, the <m>clear</m> message will be sent out the right outlet.
			</description>
		</method>
	</methodlist>
	<jittermethodlist>
		<jittermethod name="exportattrs" />
		<jittermethod name="exportsummary" />
		<jittermethod name="getattributes" />
		<jittermethod name="getstate" />
		<jittermethod name="importattrs" />
		<jittermethod name="summary" />
	</jittermethodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="angle" get="1" set="1" type="int" size="1">
			<digest>
				Number of degrees in each turn the turtle makes
			</digest>
			<description>
				The number of degrees in each turn the turtle makes (default = 30)
			</description>
		</attribute>
		<attribute name="clearmode" get="1" set="1" type="int" size="1">
			<digest>
				Clear on reset flag
			</digest>
			<description>
				Clear on reset flag (default = 1) When the flag is set, a <m>clear</m> message is sent in response to a <m>reset</m> command.
			</description>
		</attribute>
		<attribute name="origin" get="1" set="1" type="int" size="2">
			<digest>
				Coordinates of starting point after reset
			</digest>
			<description>
				The point in Cartesian coordinates for the turtle to begin drawing from after a <m>reset</m> (default = 80 120)
			</description>
		</attribute>
		<attribute name="scale" get="1" set="1" type="int" size="1">
			<digest>
				Step size
			</digest>
			<description>
				The size of a step (in pixels) that the turtle takes with each forward movement (default = 10)
			</description>
		</attribute>
	</attributelist>
	<jitterattributelist />
	<!--EXAMPLE-->
	<examplelist>
		<example img="jit.turtle.png" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="jit.lcd">
			QuickDraw wrapper
		</seealso>
		<seealso name="jit.linden">
			Lindenmayer string expansion (L-systems)
		</seealso>
	</seealsolist>
	<discussion>
		<p>
			The <o>jit.turtle</o> object supports branching (via the <i>[</i> and <i>]</i> symbols) up to a maximum stack size of 1024 nested branches. While interesting in itself, it is most useful when used with automatic string generators (either Max patches or objects such as <o>jit.linden</o>). ASCII codes which don't make any sense to the <o>jit.turtle</o> object are ignored. Symbols which the user wishes to bypass can be filtered out by placing a <o>select</o> or <o>route</o> object with the appropriate ASCII numbers between the source of the commands and the <o>jit.turtle</o> object.
		</p>
		<p>
			While the <o>jit.turtle</o> object doesn't use Jitter matrices to store and generate data, it uses the Jitter attribute system to set and query its internal state (<at>origin</at>, <at>angle</at>, <at>scale</at>, and <at>clearmode</at> are all Jitter attributes).
		</p>
		<p>
			Turtle graphics packages are fairly ubiquitous and some have conflicting syntaxes. The turtle syntax used in the object is optimized for the visualization of Lindenmayer Systems (or L-systems), which tend to use the same group of commands.
		</p>
		<p>
			If you were never subjected to turtle graphics in school (or elsewhere), here is the basic idea:
		</p>
		<p>
			You are a turtle. As if that weren't bad enough, you are also inhibited by only being able to turn and go forward in discrete amounts (you can also turn around). However, to make up for this your creator has given you two very cool genetic advantages over the average reptile:
		</p>
		<p>
			1) you have a limitless supply of ink which secretes from your tail (which is usually referred to as the PEN). By dragging your tail along the floor as you move and turn you can therefore tell the entire world (or, at least, anyone who looks) all about how much it sucks to be a turtle.
		</p>
		<p>
			2) you can make quantum jumps back and forth to geographical positions and bearings where you've been before (though, to be fair, you don't really know anything about those positions until you get there). This is called BRANCHING, and it lets you, a mere turtle, draw some incredibly complex images.
		</p>
		<p>
			The <o>jit.turtle</o> object has the following basic instruction set which it recognizes as ASCII characters sent to its inlet:
		</p>
		<p>
			<i>F</i>: Move forward a discrete amount with your tail down (drawing a line).
		</p>
		<p>
			<i>f</i>: Move forward a discrete amount with your tail up (changing your position without drawing).
		</p>
		<p>
			<i>+</i>: Turn right.
		</p>
		<p>
			<i>-</i>: Turn left.
		</p>
		<p>
			<i>|</i>: Turn around.
		</p>
		<p>
			<i>#</i>: Press harder with your tail, creating a thicker line.
		</p>
		<p>
			<i>!</i>: Press lighter with your tail, creating a thinner line.
		</p>
		<p>
			<i>[</i>: Start a branch.
		</p>
		<p>
			<i>]</i>: End a branch.
		</p>
		<p>
			Using the commands to start or end a branch lets you remember a position and angle and then magically return to it later.
		</p>
		<p>
			The turtle's starting position can be changed by the <at>origin</at> attribute. The number of steps (in pixels) that the turtle moves with each forward command can be set with the <at>scale</at> attribute. The number of degrees in each turn is set by the <at>angle</at> attribute.
		</p>
	</discussion>
</c74object>
