<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>New Textiles 2012 &#187; Lecture Notes</title>
	<atom:link href="http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;cat=4" rel="self" type="application/rss+xml" />
	<link>http://newtextiles.media.mit.edu/2012</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Fri, 25 May 2012 04:00:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Voronoi Diagram Tutorial</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=1906</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=1906#comments</comments>
		<pubDate>Wed, 14 Mar 2012 16:25:20 +0000</pubDate>
		<dc:creator>jacobsj</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=1906</guid>
		<description><![CDATA[A voronoi diagram is a planar graph that has unique properties.The diagram consists of the partitioning of a plane with  points into convex polygons such that each polygon contains exactly generating point and every point in a given polygon is closer to its generating point than to any other. Voronoi diagrams are very efficient ways [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/example_voronoi.png"><img class="aligncenter size-full wp-image-1907" src="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/example_voronoi.png" alt="" width="410" height="414" /></a></p>
<p>A voronoi diagram is a planar graph that has unique properties.The diagram consists of the partitioning of a plane with  points into convex polygons such that each polygon contains exactly generating point and every point in a given polygon is closer to its generating point than to any other.</p>
<p>Voronoi diagrams are very efficient ways of creating a subdivision of space and have many uses in a variety of fields including robotics, chemistry, engineering and computer science. They are also encountered in many natural structures.</p>
<p>Most importantly though, they  look cool and can be used to make beautiful patterns!</p>
<p>You can use <a href="http://processing.org/">Processing</a> to generate and control voronoi diagrams, and export the resulting structures as vector files. Follow these steps:</p>
<ol>
<li>Download and install processing, available <a href="http://processing.org/download/">here</a></li>
<li>Download the voronoi example code here: <a href="http://jenniferj.net//voronoi_examples/final_code%20_examples.zip">final_code_examples.zip</a></li>
<li>Unzip the file, and copy all of the directories in &#8220;sketches&#8221; to your Processing directory that was automatically created when you installed processing. This directory is usually located in your Documents folder.</li>
<li>Copy the directory in the libraries folder into the Processing/libraries folder. If the libraries folder does not exist, manually create it first. This is where you will place external libraries in the future that add additional functionality to your code.</li>
</ol>
<p>The code contains 5 separate sketches that illustrate varying approaches to creating ordered / unordered sets of points to generate voronoi diagrams. Each sketch consists of the same basic structure:</p>
<ul>
<li>A setup function that contains all of the code</li>
<li>A method  that intializes the Voronoi generator (setupVoronoi())</li>
<li>A recording method that allows you to save your file as a vector pdf (beginRaw())</li>
<li>A rendering method that draws the voronoi diagram (drawVoronoi())</li>
<li>Each sketch also contains a voronoi_generator.pde file that consists of the code that renders the voronoi diagram itself. <strong>YOU DO NOT NEED TO MODIFY THIS CODE.</strong></li>
</ul>
<p>The specifics of the different sketches are outlined below:</p>
<ul>
<li>random.pde: Generate a random set of points to create your diagram</li>
<li>grid_voronoi.pde: Use a loop to generate a regular grid of points</li>
<li>simple_circle.pde:  Use a loop to generate points that describe a circle</li>
<li>simple_spiral.pde: Use a loop to increment the radius of your circle, resulting in a spiral of points</li>
<li>simple_spiral_circle.pde: Generate a combination of multiple spirals and circles</li>
</ul>
<p>Experiment with modifying any of these sketches to get a wide variety of patterns and effects!</p>
<p>Once you execute your code, it will save a pdf of your design to the corresponding sketch folder in your Processing directory. At this point, you will need to modify your design a bit in adobe illustrator to prep it for the laser cutter.</p>
<p>These steps are as follows:</p>
<p>1. Open the pdf in illustrator</p>
<p>2. Go to File-&gt;Document Setup and switch the units of your file to inches or centimeters, whichever you prefer</p>
<p><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_1.jpg"><img class="aligncenter size-full wp-image-1914" src="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_1.jpg" alt="" width="604" height="238" /></a></p>
<p><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_1.jpg"></a>3. Click on the artboard selector in the tools and check the size of your artboard. Make sure it is the correct dimensions, and resize it if necessary. If you resize the artboard, select the black arrow, click on your diagram and resize it to fit the artboard.</p>
<p>4.Select your whole diagram and set the stroke color to black and the fill to none. Set the stroke weight to the desired width of your lines. Remember that if you select a weight that is too thin for your material, the laser will burn the pattern away. Between 3 and 8 pt is a good range. Select the white arrow and select and delete the two large triangle artifacts in the middle of your diagram. If not deleted, these will add undesirable lines to your diagram when you merge all the paths.</p>
<p><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_2.jpg"><img class="size-full wp-image-1915 alignnone" src="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_2.jpg" alt="" width="383" height="380" /></a></p>
<p style="text-align: left">4. Right click on your diagram and select &#8220;Release Clipping Mask&#8221;.</p>
<p>5. Open the pathfinder toolbox by going to Window-&gt;Pathfinder. Ensure that your fill is set to none and select your whole diagram again and then select the divide option on the pathfinder box.</p>
<p><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_3.png"><img class="size-full wp-image-1916 alignnone" src="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_3.png" alt="" width="217" height="115" /></a></p>
<p>6. Ungroup your object by selecting it and going to Object-&gt;Ungroup. Select your diagram again and select all of the shapes outside of the clipping mask and delete them. You may have to use the white arrow to select one initially, but you should be able to select large numbers of them simultaneously of them by drawing a box around them with the black arrow and hitting delete.</p>
<p><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_4.jpg"><img class="size-full wp-image-1917 alignnone" src="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_4.jpg" alt="" width="223" height="244" /></a></p>
<p style="text-align: left">7. Select all of the remaining objects in your cleaned up diagram and go to Object-&gt;Expand. Select &#8220;stroke&#8221; and hit ok.</p>
<p style="text-align: left"><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_5.jpg"><img class="size-full wp-image-1918 alignnone" src="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_5.jpg" alt="" width="380" height="251" /></a></p>
<p style="text-align: left">8. Lastly,  Select the whole diagram, go back to your pathfinder window and select &#8220;Unite&#8221;. This will merge all of your paths into one. Save your file as a pdf and you&#8217;re ready to cut!</p>
<p style="text-align: left"><a href="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_6.png"><img class="size-full wp-image-1919 alignnone" src="http://newtextiles.media.mit.edu/2012/wp-content/uploads/2012/03/aidemo_6.png" alt="" width="249" height="126" /></a></p>
<p>Slides from the tutorial are here: <a href="http://jenniferj.net//voronoi_examples/presentation.pdf">presentation.pdf</a></p>
<p>Some external links that may be of some use/Inspiration:</p>
<p><strong><a href="http://www.shiffman.net/teaching/nature/">http://www.shiffman.net/teaching/nature/</a><br />
<a href="http://www.shiffman.net/teaching/nature/week7/">http://www.shiffman.net/teaching/nature/week7/</a></p>
<p><a href="http://blog.blprnt.com/blog/blprnt/7-days-of-source-day-3-tree-growth">http://blog.blprnt.com/blog/blprnt/7-days-of-source-day-3-tree-growth</a></p>
<p><a href="http://processing.org/reference/">http://processing.org/reference/</a></p>
<p><a href="http://mcleodbutterflies.com/families/">http://mcleodbutterflies.com/families/</a></strong></p>
<p>Sine wave code:<a href="http://jenniferj.net//voronoi_examples/sinwave_voronoi.zip"> sinwave_voronoi.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=1906</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manipulate a Drawn Shape Code</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=1903</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=1903#comments</comments>
		<pubDate>Wed, 14 Mar 2012 14:49:33 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Laser Cut Lace]]></category>
		<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=1903</guid>
		<description><![CDATA[Code that you can use to manipulate a vector image. The image must be in the .svg format (here it&#8217;s called shape.svg) and should be in the same folder as the code. import processing.pdf.*; PShape s; void setup() { s = loadShape("shape.svg"); size(500, 500); //set the size of the window (&#038; the pdf document) smooth(); [...]]]></description>
			<content:encoded><![CDATA[<p>Code that you can use to manipulate a vector image.  The image must be in the .svg format (here it&#8217;s called shape.svg) and should be in the same folder as the code.</p>
<p><code><br />
import processing.pdf.*;</p>
<p>PShape s;</p>
<p>void setup() {<br />
  s = loadShape("shape.svg");<br />
  size(500, 500); //set the size of the window (&#038; the pdf document)<br />
  smooth();<br />
  noLoop();<br />
}</p>
<p>void draw() {<br />
    //set the background color to be white<br />
    background(255);</p>
<p>    //this code randomly scales, rotates, and translates the shape<br />
    for (int i=0; i<code><</code>10;i++)<br />
    {<br />
      pushMatrix();  //remember the current position and rotation<br />
      int randomSize=(int)random(100);<br />
      translate(random(width), random(height));  //move to a random position<br />
      rotate(random(radians(360))); //rotate a random angle<br />
      shape(s, 0, 0, randomSize, randomSize);  //draw the shape at a random size<br />
      popMatrix();  //return to the original position and rotation<br />
    }</p>
<p>    //this code creates a five pointed circular pattern from the shape<br />
    translate(width/2, height/2);<br />
    for (int i=0;i<code><</code>5;i++)<br />
    {<br />
      pushMatrix();  //remember the current position and rotation<br />
      translate (10,10);  //move 10 pixels away from the current position in the x and y directions<br />
      shape(s, 0, 0, 20,20);  //draw the shape, size = 20 pixels<br />
      popMatrix();   //return to the original position and rotation</p>
<p>      pushMatrix();  //remember the current position and rotation<br />
      translate (20,50); //move 20 pixels in x and 50 pixels in y<br />
      shape(s, 0, 0, 20,20);  //draw the shape, size = 20 pixels<br />
      popMatrix();  //return to the original position and rotation</p>
<p>      rotate(radians(72));<br />
    }<br />
}</p>
<p>void keyPressed() {<br />
  //if the 'q' key is pressed, finish drawing the PDF &#038; quit<br />
  if (key == 'q') {<br />
    String fileName= "drawing"+millis()+".pdf"; //create a unique name for your file<br />
    beginRecord(PDF, fileName);<br />
    draw();<br />
    endRecord();<br />
    exit();<br />
  }<br />
  //if any other key is pressed, draw a new pattern<br />
  else {<br />
    redraw();<br />
  }<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=1903</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Graph Code</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=1759</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=1759#comments</comments>
		<pubDate>Tue, 13 Mar 2012 16:45:00 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Laser Cut Lace]]></category>
		<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=1759</guid>
		<description><![CDATA[Simple Graphing Calculator Code import processing.pdf.*; void setup() { //set the size of the window (&#038; the pdf document) size(640, 500); smooth(); noLoop(); stroke(100,100,50); //use a yellow-green color } void draw() { float Y, previousY; int x; Y=0; previousY=Y; background(255); for (x=0;x]]></description>
			<content:encoded><![CDATA[<p>Simple Graphing Calculator Code<span id="more-1759"></span><br />
<code><br />
import processing.pdf.*;</p>
<p>void setup() {<br />
  //set the size of the window (&#038; the pdf document)<br />
  size(640, 500);<br />
  smooth();<br />
  noLoop();<br />
  stroke(100,100,50); //use a yellow-green color<br />
}</p>
<p>void draw() {<br />
 float Y, previousY;<br />
 int x;<br />
 Y=0;<br />
 previousY=Y;<br />
 background(255);<br />
 for (x=0;x<code><</code>width;x++)<br />
 {<br />
   previousY=Y;<br />
   //play with this equation<br />
   Y=(sin(radians(x))*x/5)+200;<br />
   line(x-1, height-previousY, x, height - Y);<br />
 }<br />
 //close the box<br />
 line(x, height-previousY, x, height);<br />
 line(x, height, 0, height);<br />
}</p>
<p>void keyPressed() {<br />
  //if the 'q' key is pressed, generate a PDF &#038; quit<br />
  if (key == 'q') {<br />
    String fileName= "graph"+millis()+".pdf"; //create a unique name for your file<br />
    beginRecord(PDF, fileName);<br />
    draw();<br />
    endRecord();<br />
    exit();<br />
  }<br />
  else<br />
  {<br />
    redraw();<br />
  }<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=1759</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LSystem Code</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=1750</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=1750#comments</comments>
		<pubDate>Tue, 13 Mar 2012 16:44:44 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Laser Cut Lace]]></category>
		<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=1750</guid>
		<description><![CDATA[General L System Code: /* F = forward + = left turn by angle - = right turn by angle [ = remember current state ] = return to last remembered state generate a pattern using LSystem, which takes 3 parameters a STARTING STRING, a RULE, and an ANLGE: myLSystem = new LSystem(STARTING STRING, RULE, [...]]]></description>
			<content:encoded><![CDATA[<p>General L System Code:<br />
<span id="more-1750"></span><br />
<code></p>
<p>/*<br />
  F = forward<br />
  + = left turn by angle<br />
  - = right turn by angle<br />
  [ = remember current state<br />
  ] = return to last remembered state</p>
<p>  generate a pattern using LSystem, which takes 3 parameters<br />
  a STARTING STRING, a RULE, and an ANLGE:<br />
  myLSystem = new LSystem(STARTING STRING, RULE, ANLGE);</p>
<p>  here's an example, starting with starting string = F, rule= F+F--F+F, angle=60:<br />
  myLSystem = new LSystem("F", "F+F--F+F", 60);<br />
*/</p>
<p>import processing.pdf.*;</p>
<p>LSystem myLSystem;<br />
float scaleFactor=.5;<br />
int iterations =3;<br />
int startingSize=200;<br />
int i;</p>
<p>void setup() {<br />
  size(500, 500); //set the size of the window (&#038; the pdf document)<br />
  smooth();<br />
  noLoop(); //only draw the design once<br />
  stroke(100,100,50); //use a yellow-green color</p>
<p>  //scales the pattern down as iterations increase<br />
  scaleFactor = 1/pow(3,iterations);<br />
}</p>
<p>void draw() {<br />
  //define the design<br />
  //myLSystem = new LSystem(STARTING STRING, RULE, ANLGE);<br />
  myLSystem = new LSystem("F", "F+F--F+F", 60);  //Koch curve<br />
  //myLSystem = new LSystem("F-F-F-F-F-F", "F+F--F+F", 60);  //Koch snowflake<br />
  //myLSystem = new LSystem("F+F+F+F", "F+F-F-F+F", 90);  //square variation on Koch<br />
  //myLSystem = new LSystem("F", "F+[F]--[F]+", 30); //tree<br />
  //myLSystem = new LSystem("F-F-F-F-F", "FF+F+F+F+F+F", 72); //pentagonal pattern<br />
  //myLSystem = new LSystem("F", "F+[F]--[F]+", 30); //tree<br />
  //generate the design<br />
  myLSystem.applyRuleToAxiom(iterations,startingSize,scaleFactor);<br />
  //set a white background<br />
  background(255);<br />
  //move to an appropriate location on the page<br />
  translate(width/2, height/2);<br />
  //draw the design to the screen<br />
  myLSystem.render();<br />
}</p>
<p>void keyPressed() {<br />
  //if the 'q' key is pressed, generate a PDF &#038; quit<br />
  if (key == 'q') {<br />
    String fileName= "LSystem"+millis()+".pdf"; //create a unique name for your file<br />
    beginRecord(PDF, fileName);<br />
    draw();<br />
    endRecord();<br />
    exit();<br />
  }<br />
  else<br />
  {<br />
    redraw();<br />
  }<br />
}</p>
<p>class LSystem<br />
{<br />
  int steps = 0;<br />
  int randomness;</p>
<p>  String axiom;<br />
  String rule;<br />
  String production;<br />
  float drawLength;<br />
  float theta;<br />
  float scaleFactor;<br />
  int x=0;</p>
<p>  int generations;</p>
<p>  //default system is a koch curve<br />
  LSystem() {<br />
    axiom = "F";<br />
    rule = "F+F--F+F";<br />
    theta = radians(60.0);<br />
    reset();<br />
  }</p>
<p>  LSystem (String axiomIn, String ruleIn, float thetaIn) {<br />
    axiom = axiomIn;<br />
    rule = ruleIn;<br />
    theta = radians(thetaIn);<br />
    reset();<br />
  }</p>
<p>  void reset() {<br />
    production = axiom;<br />
    generations = 0;<br />
  }</p>
<p>  int getAge() {<br />
    return generations;<br />
  }</p>
<p>  //turns the final rule into a drawing on the screen<br />
  void render() {</p>
<p>    steps = production.length();</p>
<p>    for (int i = 0; i < steps; i++) {<br />
      char step = production.charAt(i);<br />
      if (step == 'F') {<br />
        line(0, 0, 0, -drawLength);<br />
        translate(0, -drawLength);<br />
      }<br />
      else if (step == 'L') {<br />
        line(0, 0, 0, -(drawLength*2));<br />
        translate(0, -(drawLength*2));<br />
      }<br />
      else if (step == '+') {<br />
        rotate(theta);<br />
      }<br />
      else if (step == '-') {<br />
        rotate(-theta);<br />
      }<br />
      else if (step == '[') {<br />
        pushMatrix();<br />
      }<br />
      else if (step == ']') {<br />
        popMatrix();<br />
      }<br />
    }<br />
  }</p>
<p>  void applyRuleToAxiom(int gen, int startLength, float scaleFactor) {<br />
    drawLength=startLength*scaleFactor;<br />
    while (getAge() < gen) {<br />
      production = iterate(production, rule);<br />
    }<br />
    print (axiom);<br />
    print (" --> ");<br />
    println(production);<br />
  }</p>
<p>  String iterate(String prod_, String rule_) {<br />
    generations++;<br />
    String newProduction = prod_;<br />
    newProduction = newProduction.replaceAll("F", rule_);<br />
    return newProduction;<br />
  }<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=1750</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Tree Code</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=1768</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=1768#comments</comments>
		<pubDate>Tue, 13 Mar 2012 16:44:26 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Laser Cut Lace]]></category>
		<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=1768</guid>
		<description><![CDATA[A tree generator that includes randomness. import processing.pdf.*; float theta; int trunkWidth,trunkHeight; //variables to play with int initialTrunkWidth =50; int initialTrunkHeight=100; int minBranchLength=18; int minBranchWidth=3; int branchAngle = 30; int randomNessAngle=15; void setup() { size(640, 500); //set the size of the window (&#038; the pdf document) smooth(); noLoop(); //set the name of the pdf document [...]]]></description>
			<content:encoded><![CDATA[<p>A tree generator that includes randomness.<span id="more-1768"></span></p>
<p><code><br />
import processing.pdf.*;</p>
<p>float theta;<br />
int trunkWidth,trunkHeight;</p>
<p>//variables to play with<br />
int initialTrunkWidth =50;<br />
int initialTrunkHeight=100;<br />
int minBranchLength=18;<br />
int minBranchWidth=3;<br />
int branchAngle = 30;<br />
int randomNessAngle=15;</p>
<p>void setup() {<br />
  size(640, 500); //set the size of the window (&#038; the pdf document)<br />
  smooth();<br />
  noLoop();<br />
  //set the name of the pdf document<br />
  trunkWidth=initialTrunkWidth;<br />
  trunkHeight=initialTrunkHeight;<br />
  keyPressed();<br />
}</p>
<p>void draw() {<br />
    //set the background color to be white<br />
    background(255);<br />
    //set the foreground color to be deep blue<br />
    stroke(50,50,100);<br />
    //start the tree from the bottom of the screen<br />
    translate(width/2,height);<br />
    // Draw the trunk<br />
    strokeWeight(trunkWidth);<br />
    line(0,0,0,-90);<br />
    // Move to the end of that line<br />
    translate(0,-90);<br />
    // Start the recursive branching!<br />
    branch(trunkHeight,trunkWidth);<br />
}</p>
<p>void keyPressed() {<br />
  //if the 'q' key is pressed, finish drawing the PDF &#038; quit<br />
  if (key == 'q') {<br />
    String fileName= "tree"+millis()+".pdf"; //create a unique name for your file<br />
    beginRecord(PDF, fileName);<br />
    draw();<br />
    endRecord();<br />
    exit();<br />
  }<br />
  //if any other key is pressed, draw a new tree<br />
  else {<br />
    redraw();<br />
  }<br />
}</p>
<p>void branch(float h, int w) {<br />
  //each branch will be between .7 &#038; .9 * the size of the previous one<br />
  h = h*random(.7,.9);<br />
  //the width of each branch decreases at each iteration<br />
  w=int(w/1.4);</p>
<p>  float a = random (branchAngle-randomNessAngle, branchAngle+randomNessAngle);<br />
  theta = radians(a);<br />
  // All recursive functions must have an exit condition!!!!<br />
  // Here, ours is defined by the max branch lengths &#038; widths<br />
  if (h > minBranchLength &#038; w > minBranchWidth) {</p>
<p>    //right branch<br />
    pushMatrix();    // Save the current state of transformation (i.e. where are we now)<br />
    rotate(theta);   // Rotate by theta<br />
    strokeWeight(w);    //set the width of the branch<br />
    line(0, 0, 0, -h);  // draw the branch<br />
    translate(0, -h); // move to the end of the branch<br />
    branch(h,w);       // Ok, now call myself to draw two new branches!!<br />
    popMatrix();     // Whenever we get back here, we "pop" in order to restore the previous matrix state</p>
<p>    // Repeat the same thing, only branch off to the "left" this time!<br />
    pushMatrix();<br />
    rotate(-theta);<br />
    strokeWeight(w);<br />
    line(0, 0, 0, -h);<br />
    translate(0, -h);<br />
    branch(h,w);<br />
    popMatrix();<br />
  }<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=1768</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nonwovens, Flims, and Composites</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=1498</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=1498#comments</comments>
		<pubDate>Tue, 06 Mar 2012 17:08:09 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>
		<category><![CDATA[Nonwoven]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=1498</guid>
		<description><![CDATA[Nonwoven: An assembly of textile fibers held together by mechanical interlocking in a random web or mat, by fusing of the fibers (in the case of thermoplastic fibers), or by bonding with a cemeting medium such as starch, glue, casein, rubber, latex or one of the cellulose derivatives or synthetic resins. Initially the fibers may [...]]]></description>
			<content:encoded><![CDATA[<p>Nonwoven: An assembly of textile fibers held together by mechanical interlocking <span id="more-1498"></span>in a random web or mat, by fusing of the fibers (in the case of thermoplastic fibers), or by bonding with a cemeting medium such as starch, glue, casein, rubber, latex or one of the cellulose derivatives or synthetic resins.  Initially the fibers may be oriented in one direction or may be deposited in a rondom manner.  This web or sheet of fibers is bonded together b one of the methods described above.</p>
<p>- <em>Dictionary of Fiber and Textile Technology</em>. Hoechst, 1990, p 102</p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=1498</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shape Memory Alloys &amp; MOSFETs</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=1192</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=1192#comments</comments>
		<pubDate>Tue, 06 Mar 2012 00:46:13 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=1192</guid>
		<description><![CDATA[An introduction to shape memory alloys and MOSFETs. Download slides here. Additional references and resources: http://www.stanford.edu/~richlin1/sma/sma.html http://www.amazon.com/Shape-Memory-Alloys-Engineering-Applications/dp/1441942971/]]></description>
			<content:encoded><![CDATA[<p>An introduction to shape memory alloys and MOSFETs.  <a href="http://newtextiles.media.mit.edu/2012/lectureNotes/4ShapeMemoryMOSFETs.pdf">Download slides here.</a><span id="more-1192"></span></p>
<p>Additional references and resources:<br />
<a href="http://www.stanford.edu/~richlin1/sma/sma.html">http://www.stanford.edu/~richlin1/sma/sma.html</a><br />
<a href="http://www.amazon.com/Shape-Memory-Alloys-Engineering-Applications/dp/1441942971/">http://www.amazon.com/Shape-Memory-Alloys-Engineering-Applications/dp/1441942971/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=1192</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resistive Sensors and Voltage Dividers</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=595</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=595#comments</comments>
		<pubDate>Wed, 22 Feb 2012 02:00:46 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=595</guid>
		<description><![CDATA[An introduction to voltage dividers and resistive sensors. Download slides here.]]></description>
			<content:encoded><![CDATA[<p>An introduction to voltage dividers and resistive sensors.  <a href="http://newtextiles.media.mit.edu/2012/lectureNotes/3aVoltageDividersSensors.pdf">Download slides here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=595</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sensors Introduction</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=582</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=582#comments</comments>
		<pubDate>Wed, 15 Feb 2012 04:02:14 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=582</guid>
		<description><![CDATA[An overview of resistive sensors and textile-based resistive sensors. Download slides here.]]></description>
			<content:encoded><![CDATA[<p>An overview of resistive sensors and textile-based resistive sensors. <a href="http://newtextiles.media.mit.edu/2012/lectureNotes/3Sensors.pdf">Download slides here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=582</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resistive Sensor Assignment Arduino Code</title>
		<link>http://newtextiles.media.mit.edu/2012/?p=396</link>
		<comments>http://newtextiles.media.mit.edu/2012/?p=396#comments</comments>
		<pubDate>Tue, 14 Feb 2012 13:37:21 +0000</pubDate>
		<dc:creator>buechley</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>
		<category><![CDATA[Resistive Sensor]]></category>

		<guid isPermaLink="false">http://newtextiles.media.mit.edu/2012/?p=396</guid>
		<description><![CDATA[int sensorPin = A5; int sensorValue; int internalLED = 13; int LED1 = 9; int LED2 = 10; int LED3 = 11; int LED4 = A2; void setup() { pinMode(sensorPin, INPUT); digitalWrite(sensorPin, HIGH); //turns on the internal pull-up resistor pinMode(internalLED, OUTPUT); pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); pinMode(LED4, OUTPUT); digitalWrite(internalLED, HIGH); Serial.begin(9600); } void loop() [...]]]></description>
			<content:encoded><![CDATA[<p><code><br />
int sensorPin = A5;<span id="more-396"></span><br />
int sensorValue;<br />
int internalLED = 13;<br />
int LED1 = 9;<br />
int LED2 = 10;<br />
int LED3 = 11;<br />
int LED4 = A2;</p>
<p>void setup() {<br />
 pinMode(sensorPin, INPUT);<br />
 digitalWrite(sensorPin, HIGH); //turns on the internal pull-up resistor</p>
<p> pinMode(internalLED, OUTPUT);<br />
 pinMode(LED1, OUTPUT);<br />
 pinMode(LED2, OUTPUT);<br />
 pinMode(LED3, OUTPUT);<br />
 pinMode(LED4, OUTPUT);</p>
<p> digitalWrite(internalLED, HIGH);<br />
 Serial.begin(9600);<br />
}</p>
<p>void loop() {<br />
 sensorValue=analogRead(sensorPin);<br />
 Serial.println(sensorValue);<br />
 delay(100);</p>
<p> if (sensorValue < 1000)<br />
{<br />
   digitalWrite(LED1, HIGH);<br />
   if (sensorValue <750)<br />
  {<br />
     digitalWrite(LED2, HIGH);<br />
     if (sensorValue <500)<br />
{<br />
       digitalWrite(LED3, HIGH);<br />
       if (sensorValue <250)<br />
{<br />
         digitalWrite(LED4, HIGH);<br />
       }<br />
       else<br />
         digitalWrite(LED4, LOW);<br />
     }<br />
     else<br />
     {<br />
         digitalWrite(LED3, LOW);<br />
         digitalWrite(LED4, LOW);<br />
     }<br />
   }<br />
   else<br />
   {<br />
       digitalWrite(LED2, LOW);<br />
       digitalWrite(LED3, LOW);<br />
       digitalWrite(LED4, LOW);<br />
   }<br />
 }<br />
 else {<br />
   digitalWrite(LED1, LOW);<br />
   digitalWrite(LED2, LOW);<br />
   digitalWrite(LED3, LOW);<br />
   digitalWrite(LED4, LOW);<br />
 }<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://newtextiles.media.mit.edu/2012/?feed=rss2&#038;p=396</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
