
<?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>daniel shiffman &#187; nature of code</title>
	<atom:link href="http://www.shiffman.net/category/nature-of-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shiffman.net</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 03:00:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Nature of Code book: PVector Spring example</title>
		<link>http://www.shiffman.net/2011/02/10/nature-of-code-book-pvector-spring-example/</link>
		<comments>http://www.shiffman.net/2011/02/10/nature-of-code-book-pvector-spring-example/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:34:52 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[nature of code]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[springs]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=742</guid>
		<description><![CDATA[I&#8217;m working this week on Chapter 3 of my upcoming Nature of Code book. For the most part, if you are looking to connect particles with springs, I recommend the wonderful verlet physics of toxiclibs, and I have some examples &#8230; <a href="http://www.shiffman.net/2011/02/10/nature-of-code-book-pvector-spring-example/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working this week on Chapter 3 of my <a href="https://www.kickstarter.com/projects/shiffman/the-nature-of-code-book-project">upcoming Nature of Code book</a>.   For the most part, if you are looking to connect particles with springs, I recommend the wonderful verlet physics of <a href="http://toxiclibs.org/">toxiclibs</a>, and I have some examples for that <a href="http://www.shiffman.net/teaching/nature/toxiclibs/">here</a>.  Nevertheless, I am including an elementary implementation of a single &#8220;bob&#8221; connected  to an &#8220;anchor&#8221; point via a &#8220;spring&#8221; force.   The example implements <a href="http://en.wikipedia.org/wiki/Hooke's_law">Hooke&#8217;s Law</a> (Spring Force = -k * displacement) with the <a href="http://processing.org/reference/PVector.html">PVector</a> class, using the Euler integration model of all my other examples.  Here it is below.</p>
<p><script type="application/processing">
// Mover object
Bob bob;

// Spring object
Spring spring;

void setup() {
  size(430, 200);
  smooth();
  frameRate(60);
  // Create objects at starting location
  // Note third argument in Spring constructor is "rest length"
  spring = new Spring(width/2,10,100); 
  bob = new Bob(width/2,100); 

}

void draw()  {
  background(50); 
  // Apply a gravity force to the bob
  PVector gravity = new PVector(0,1);
  bob.applyForce(gravity);
  
  // Connect the bob to the spring (this calculates the force)
  spring.connect(bob);
  // Constrain spring distance between min and max
  spring.constrainLength(bob,30,200);
  bob.dragIt(mouseX,mouseY);
  bob.update();

  spring.displayLine(bob);
  bob.display();
  spring.display();

  fill(255);
  text("click on bob to drag",10,height-5);

  
}


// For mouse interaction with bob

void mousePressed()  {
  bob.clicked(mouseX,mouseY);
}

void mouseReleased()  {
  bob.stopDragging(); 
}

class Bob { 
  PVector location;
  PVector velocity;
  PVector acceleration;
  float mass = 10;
  
  // Arbitrary damping to simulate friction / drag 
  float damping = 0.98;

  // For mouse interaction
  PVector drag;
  boolean dragging = false;

  // Constructor
  Bob(float x, float y) {
    location = new PVector(x,y);
    velocity = new PVector();
    acceleration = new PVector();
    drag = new PVector();
  } 

  // Standard Euler integration
  void update() { 
    velocity.add(acceleration);
    velocity.mult(damping);
    location.add(velocity);
    acceleration.mult(0);
  }

  // Newton's law: F = M * A
  void applyForce(PVector force) {
    PVector f = force.get();
    f.div(mass);
    acceleration.add(f);
  }


  // Draw the bob
  void display() { 
    stroke(255);
    fill(100);
    if (dragging) {
      fill(255);
    }
    ellipse(location.x,location.y,mass*2,mass*2);
  } 

  void dragIt(int mx, int my) {
    if (dragging) {
      location.x = mx + drag.x;
      location.y = my + drag.y;
    }
  }
  // This checks to see if we clicked on the mover
  void clicked(int mx, int my) {
    float d = dist(mx,my,location.x,location.y);
    if (d < mass) {
      dragging = true;
      drag.x = location.x-mx;
      drag.y = location.y-my;
    }
  }

  void stopDragging() {
    dragging = false;
  }


}

class Spring { 

  // Location
  PVector anchor;

  // Rest length and spring constant
  float len;
  float k = 0.1;
  
  // Constructor
  Spring(float x, float y, int l) {
    anchor = new PVector(x,y);
    len = l;
  } 

  // Calculate spring force
  void connect(Bob b) {
    // Vector pointing from anchor to bob location
    PVector force = PVector.sub(b.location,anchor);
    // What is distance
    float d = force.mag();
    // Stretch is difference between current distance and rest length
    float stretch = d - len;
    
    // Calculate force according to Hooke's Law
    // F = k * stretch
    force.normalize();
    force.mult(stretch);
    force.mult(-k);
    b.applyForce(force);
  }

  // Constrain the distance between bob and anchor between min and max
  void constrainLength(Bob b, float minlen, float maxlen) {
    PVector dir = PVector.sub(b.location,anchor);
    float d = dir.mag();
    // Is it too short?
    if (d < minlen) {
      dir.normalize();
      dir.mult(minlen);
      // Reset location and stop from moving (not realistic physics)
      b.location = PVector.add(anchor,dir);
      b.velocity.mult(0);
    // Is it too long?
    } else if (d > maxlen) {
      dir.normalize();
      dir.mult(maxlen);
      // Reset location and stop from moving (not realistic physics)
      b.location = PVector.add(anchor,dir);
      b.velocity.mult(0);
    }
  }

  void display() { 
    fill(100);
    rectMode(CENTER);
    rect(anchor.x,anchor.y,10,10);
  }
  
  void displayLine(Bob b) {
    stroke(255);
    line(b.location.x,b.location.y,anchor.x,anchor.y);
  }
  
}
</script></p>
<p>Source: <a href="http://www.shiffman.net/itp/classes/nature/week04_s11/_03spring.zip">_03spring.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2011/02/10/nature-of-code-book-pvector-spring-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Box2D ContactListener in Processing</title>
		<link>http://www.shiffman.net/2010/02/19/box2d-contact-listener-in-processing/</link>
		<comments>http://www.shiffman.net/2010/02/19/box2d-contact-listener-in-processing/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 18:08:20 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[box2d]]></category>
		<category><![CDATA[nature of code]]></category>
		<category><![CDATA[processing.org]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=558</guid>
		<description><![CDATA[view applet, download source Above is a new Box2D Processing example that demonstrates two key aspects of working with Box2D: 1) Though tempting as it may be, you cannot set the location manually of an object in the Box2D world &#8230; <a href="http://www.shiffman.net/2010/02/19/box2d-contact-listener-in-processing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shiffman.net/itp/classes/nature/box2d_2010/collisions/"><img src="http://www.shiffman.net/itp/classes/nature/box2d_2010/collisions.jpg"/></a></p>
<p><a href="http://www.shiffman.net/itp/classes/nature/box2d_2010/collisions/">view applet</a>, <a href="http://www.shiffman.net/itp/classes/nature/box2d_2010/CollisionsAndControl.zip">download source</a></p>
<p>Above is a new Box2D Processing example that demonstrates two key aspects of working with Box2D:</p>
<p>1) Though tempting as it may be, you cannot set the location manually of an object in the Box2D world and expect the physics to continue to work.  Box2D doesn&#8217;t understand teleportation (which is the equivalent of telling an object to disappear and then reappear at a different pixel).  Rather, if you want to move an object manually, you can attach a joint to the object and tug it around.  This way, you control its motion and yet it still lives within the world of Box2D physics. The example demonstrates how this is done with a MouseJoint.  The object moves according to an perlin noise algorithm (unless the mouse is pressed in which case it follows the mouse).</p>
<p>2) The example also demonstrates how to use Box2D&#8217;s ContactListener to know when objects have collided.  The circles turn red when they encounter the square.</p>
<p>It&#8217;s my intention to eventually add this example with further explanation to the <a href="http://www.shiffman.net/teaching/nature/box2d-processing/">Box2D tutorial</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2010/02/19/box2d-contact-listener-in-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VerletPhysics and Toxiclibs</title>
		<link>http://www.shiffman.net/2010/02/14/verletphysics-and-toxiclibs/</link>
		<comments>http://www.shiffman.net/2010/02/14/verletphysics-and-toxiclibs/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 22:23:30 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[library]]></category>
		<category><![CDATA[nature of code]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[toxiclibs]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=546</guid>
		<description><![CDATA[Building off of last week&#8217;s Box2D and Processing post, I have now posted a short tutorial about the physics package in toxiclibs. The force directed graph example is a simplified version of toxi&#8217;s wonderful fidgen project. Link: http://www.shiffman.net/teaching/nature/toxiclibs/]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shiffman.net/teaching/nature/toxiclibs/"><img src="http://www.shiffman.net/itp/classes/nature/toxiclibs_2010/fdg.jpg"/></a></p>
<p>Building off of last week&#8217;s <a href="http://www.shiffman.net/2010/02/08/box2d-and-processing/">Box2D and Processing</a> post, I have now posted <a href="http://www.shiffman.net/teaching/nature/toxiclibs/">a short tutorial</a> about the physics package in <a href="http://toxiclibs.org/">toxiclibs</a>.   The <a href="http://www.shiffman.net/itp/classes/nature/toxiclibs_2010/forcedirectedgraph">force directed graph example</a> is a simplified version of toxi&#8217;s wonderful <a href="http://code.google.com/p/fidgen/">fidgen</a> project. </p>
<p>Link: <a href="http://www.shiffman.net/teaching/nature/toxiclibs/">http://www.shiffman.net/teaching/nature/toxiclibs/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2010/02/14/verletphysics-and-toxiclibs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Box2D and Processing</title>
		<link>http://www.shiffman.net/2010/02/08/box2d-and-processing/</link>
		<comments>http://www.shiffman.net/2010/02/08/box2d-and-processing/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 03:03:00 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[box2d]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[nature of code]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[processing.org]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=531</guid>
		<description><![CDATA[&#160; I&#8217;m pleased to announce I&#8217;ve published a first draft of a tutorial about using Box2D in Processing. Tutorial: http://www.shiffman.net/teaching/nature/box2d-processing/ Google code repository: http://code.google.com/p/pbox2d/ I&#8217;m struggling here to figure out whether I&#8217;m (a) creating a Processing Box2D library or (b) &#8230; <a href="http://www.shiffman.net/2010/02/08/box2d-and-processing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.shiffman.net/itp/classes/nature/box2d_2010/boxes.jpg"/>&nbsp; <img src="http://www.shiffman.net/itp/classes/nature/box2d_2010/blob.jpg"/></p>
<p>I&#8217;m pleased to announce I&#8217;ve <a href="http://www.shiffman.net/teaching/nature/box2d-processing/">published a first draft of a tutorial</a> about using <a href="http://www.box2d.org/">Box2D</a> in <a href="http://www.processing.org">Processing</a>. </p>
<p>Tutorial: <a href="http://www.shiffman.net/teaching/nature/box2d-processing/">http://www.shiffman.net/teaching/nature/box2d-processing/</a><br />
Google code repository: <a href="http://code.google.com/p/pbox2d/">http://code.google.com/p/pbox2d/</a></p>
<p>I&#8217;m struggling here to figure out whether I&#8217;m (a) creating a Processing Box2D library or (b) simply creating a tutorial and set of examples piggybacking off of JBox2D.  For now, I&#8217;m doing a little bit of both.  The library is just a few helper functions, but the examples require you to dig into actual Box2D code.  These examples aren&#8217;t nearly as comprehensive as what you&#8217;ll find in the <a href="http://jbox2d.org">JBox2D demos</a>.  It&#8217;s my goal, however, to make the material accessible and easy to use.  Hopefully, with some feedback and more time, I&#8217;ll be able to publish a more sophisticated library and thorough suite of example.  Who knows, maybe no one will ever need any of my previous Nature of Code tutorials any more!</p>
<p>Next up, I&#8217;m planning on creating a few simple examples that use the fantastic and awe-inspiring <a href="http://toxiclibs.org/">toxiclibs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2010/02/08/box2d-and-processing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nature of Code Book Chapter 1 Draft Available</title>
		<link>http://www.shiffman.net/2009/06/02/nature-of-code-book-2/</link>
		<comments>http://www.shiffman.net/2009/06/02/nature-of-code-book-2/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 20:41:20 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[book]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[nature of code]]></category>
		<category><![CDATA[print on demand]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[publishing]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vectors]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=429</guid>
		<description><![CDATA[Ok, so I may very well be one of the slowest writers ever, but I am pleased to finally announce that I have completed a draft chapter for what I hope will become my next book: The Nature of Code. &#8230; <a href="http://www.shiffman.net/2009/06/02/nature-of-code-book-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ok, so I may very well be one of the slowest writers ever, but I am pleased to finally announce that I have completed a draft chapter for what I hope will become my next book: <a href="http://www.learningprocessing.com/noc/">The Nature of Code</a>.  Based on my experience getting <a href="http://www.learningprocessing.com">Learning Processing</a> out into the world I&#8217;ve decided to go ahead and experiment with self-publishing.  I&#8217;m not sure what service I&#8217;ll ultimately use or exactly how I&#8217;ll distribute the text (most likely as a PDF for sale online as well as print-on-demand physical book) so feel free to write me with suggestions, etc.  </p>
<p>Let&#8217;s take a moment to go over some of the finer points as to why I am doing this.</p>
<h2>Dollars and cents</h2>
<p><a href="http://www.learningprocessing.com">Learning Processing</a> retails for $49.95 (amazon&#8217;s discount is 10%: $44.95).  When the publisher sells a copy of the book, I get some money (yay for me!).  Based on my first royalty statement, this works out to approximately $3.73 per copy.  Sure, I&#8217;m not writing books about programming with <a href="http://www.processing.org">Processing</a> to get rich, but I did spend a couple years working hard on the project and every little bit counts.  </p>
<p>Let&#8217;s assume for the moment that I could sell the same exact book via <a href="http://www.lulu.com">lulu.com</a>.   The actual cost for printing the book would be ~$14.00.  Ok, so let&#8217;s say I choose to sell the book at $25.00 (half the actual current cost.)   That&#8217;s $11 of profit for every book sold, lulu takes 20%, leaving me with ~$8.80 per book sold.  The book costs half as much and I get more than double the revenue!  Now, this is just one scenario.  I haven&#8217;t decided what service to use, how much of a mark-up is appropriate, etc.  But you get the idea.   There&#8217;s no reason a no color, no frills, beginner programming text needs to be $50.00.</p>
<h2>Release early, Release often</h2>
<p>As an author, it&#8217;s just nice to have a lot of flexibility with the process.  With self-publishing, I can do things like release early drafts of PDFs online for feedback (see below).  This is not something I could have easily done with a traditional publishing house.  Instead of spending months or years writing a book before anyone sees anything, the idea is that I can just put stuff out there (for cheap) as I type and then iterate.  And there are no limits of how I choose to distribute the book (excerpts published as tutorials on Processing.org? Free on my site? PDF for a million dollars?  Audio book? It&#8217;s all fair game.). </p>
<p>Once the book is done, I can easily continue to make changes and update.  Now, Processing has a fairly stable API, one that is not going to undergo massive changes anytime soon.  And sure, how gravity works, the formula for the mandelbrot set, these aren&#8217;t concepts that are going to change that often.  Nevertheless, anytime you write a technical book, technology changes faster than you can write, and no matter how careful you are, there&#8217;s no way to avoid making a serious amount of mistakes.  With self-publishing and print-on-demand, I don&#8217;t have to wait (possibly years) for a print run to finish selling in order to make changes.   I could make them <b><i>daily</i></b> if I wanted to.  And that Chapter on PHP that I realized I really should have included in Learning Processing, well, I could just add it whenever I so choose.</p>
<h2>Downfalls</h2>
<p>There are certainly some pitfalls to self-publishing.  One major issue, of course, is deadlines.  Without a publisher I&#8217;ve got very little pushing me forward other than myself.  In fact, getting this first chapter done took me twice as long as I intended.  And other projects are getting in the way, I&#8217;m not sure how fast I will actually get to chapter #2.  </p>
<p>The other main issue is distribution.  I don&#8217;t care if I don&#8217;t get my book in Barnes and Noble, I mean who is really buying Processing books at Barnes and Noble?!   I do need Amazon.com, but looks like there are plenty of print-on-demand options that can be distributed via Amazon.  The major question for me is university bookstores.  I don&#8217;t have any numbers, but it does seem to me that Learning Processing gets stocked in a lot of school bookstores because it is being used as a text for classes.  So this is something I need to figure out, how can I get a self-published book to stores.</p>
<p>Oh yeah, an index.  The publisher made an index for me.  There&#8217;s got to be a way I don&#8217;t need them for that, though.</p>
<p>In the end, I could be wrong.  This could be a failed experiment.  Maybe no one will buy it, maybe I won&#8217;t finish it.  The nice thing, however, is that if I&#8217;m really headed in the wrong direction here, I can always change my mind and start sending out proposals to a publisher.  But the other way around, going from a publisher to self-published, well, that wouldn&#8217;t be so easy.</p>
<p>So, if you&#8217;re interested in checking out what I&#8217;ve started so far, for now (subject to change), you can purchase the PDF on lulu.com.  I&#8217;m selling draft chapters for small amounts with the idea that I could raise a little bit of money to pay for design, typesetting, technical editing, etc. once I&#8217;ve got a more finished draft.</p>
<p><a href="http://stores.lulu.com/dshiffman">http://stores.lulu.com/dshiffman</a></p>
<p>UPDATE: I&#8217;m also looking for a service that would let users buy early drafts of a book and then upgrade to the final version at a discount or for free.  Suggestions for how to do this welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2009/06/02/nature-of-code-book-2/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Path Following Dot Product Tutorial</title>
		<link>http://www.shiffman.net/2009/03/02/path-following-dot-product-tutorial/</link>
		<comments>http://www.shiffman.net/2009/03/02/path-following-dot-product-tutorial/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 03:49:06 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[book]]></category>
		<category><![CDATA[dot product]]></category>
		<category><![CDATA[draft]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[nature of code]]></category>
		<category><![CDATA[path following]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=388</guid>
		<description><![CDATA[As an addendum to the previous post, here&#8217;s an early draft excerpt from Chapter 7 on steering behaviors, more specifically a tutorial related to my new path following examples. Also an excuse to cover the dot product in more detail. &#8230; <a href="http://www.shiffman.net/2009/03/02/path-following-dot-product-tutorial/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shiffman.net/teaching/nature/path-following/"><br />
<img src="http://www.shiffman.net/itp/classes/nature/pathimages/pathfollow.jpg"/></a></p>
<p>As an addendum to the previous post, here&#8217;s <a href="http://www.shiffman.net/teaching/nature/path-following/">an early draft excerpt from Chapter 7 on steering behaviors</a>, more specifically a tutorial related to my new <a href="http://www.shiffman.net/teaching/nature/steering">path following examples</a>.   Also an excuse to cover the <a href="http://en.wikipedia.org/wiki/Dot_product">dot product</a> in more detail.  All based on <a href="http://www.red3d.com/cwr/steer/">Craig Reynolds</a> of course.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2009/03/02/path-following-dot-product-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nature of Code Book</title>
		<link>http://www.shiffman.net/2009/03/02/nature-of-code-book/</link>
		<comments>http://www.shiffman.net/2009/03/02/nature-of-code-book/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 03:35:43 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[book]]></category>
		<category><![CDATA[nature of code]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=378</guid>
		<description><![CDATA[This semester, I&#8217;ve started working on expanding my nature of code tutorials into a book. My plan is to self-publish (looking into a few options) and have drafts available for download / purchase as early as this summer. I&#8217;ll also &#8230; <a href="http://www.shiffman.net/2009/03/02/nature-of-code-book/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.shiffman.net/images/noc/1.jpg"/> <img src="http://www.shiffman.net/images/noc/3.jpg"/><img src="http://www.shiffman.net/images/noc/2.jpg"/> <img src="http://www.shiffman.net/images/noc/5.jpg"/> <img src="http://www.shiffman.net/images/noc/8.jpg"/> </p>
<p>This semester, I&#8217;ve started working on expanding my <a href="http://www.shiffman.net/teaching/nature">nature of code tutorials</a> into a book.  My plan is to self-publish (looking into a few options) and have drafts available for download / purchase as early as this summer.  I&#8217;ll also be publishing excerpts from the book as tutorials on <a href="http://www.processing.org/learning/tutorials/">processing.org</a> (the first will be a PVector tutorial) and on this site as well.</p>
<p><a href="http://www.learningprocessing.com/noc/">sign up for e-mail updates about the book</a></p>
<p>Here is a <a href="http://www.learningprocessing.com/noc/table_of_contents.pdf">PDF of the draft table of contents</a> for those who are curious.   Feedback is welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2009/03/02/nature-of-code-book/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>More Steering Examples</title>
		<link>http://www.shiffman.net/2009/02/28/more-steering-examples/</link>
		<comments>http://www.shiffman.net/2009/02/28/more-steering-examples/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 22:26:44 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[nature of code]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[steering]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=365</guid>
		<description><![CDATA[I&#8217;ve added three new steering examples (based, of course, off of Craig Reynolds&#8217; Steering Behaviors for Autonomous Characters) to the nature of code tutorials. Ultimately, it&#8217;s my goal to build out all of Reynolds&#8217; algorithms into a Processing library (much &#8230; <a href="http://www.shiffman.net/2009/02/28/more-steering-examples/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added three new steering examples (based, of course, off of <a href="http://www.red3d.com/cwr/steer/">Craig Reynolds&#8217; Steering Behaviors for Autonomous Characters</a>) to the <a href="http://www.shiffman.net/teaching/nature/">nature of code</a> tutorials.  Ultimately, it&#8217;s my goal to build out all of Reynolds&#8217; algorithms into a Processing library (much like <a href="http://opensteer.sourceforge.net/">Open Steer</a>), so stay tuned. . .</p>
<p><a href="http://www.shiffman.net/itp/classes/nature/week06_s09/pathfollowing"><img src="http://www.shiffman.net/itp/classes/nature/week06_s09/path.jpg"/></a>&nbsp; <a href="http://www.shiffman.net/itp/classes/nature/week06_s09/flowfield"> <img src="http://www.shiffman.net/itp/classes/nature/week06_s09/flow.jpg"/></a>&nbsp; <a href="http://www.shiffman.net/itp/classes/nature/week06_s09/crowdpathfollowing"> <img src="http://www.shiffman.net/itp/classes/nature/week06_s09/crowdpath.jpg"/></a></p>
<p><a href="http://www.shiffman.net/itp/classes/nature/week06_s09/pathfollowing">Path Following</a><br />
<a href="http://www.shiffman.net/itp/classes/nature/week06_s09/flowfield">Flow Field</a><br />
<a href="http://www.shiffman.net/itp/classes/nature/week06_s09/crowdpathfollowing">Crowd Path Following</a></p>
<p>I hope to have a new tutorial about the use of the <a href="http://processing.org/reference/PVector.html">PVector</a> dot product in the path following examples posted in the next day or two as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2009/02/28/more-steering-examples/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Art collides with Code</title>
		<link>http://www.shiffman.net/2009/02/10/art-collides-with-code/</link>
		<comments>http://www.shiffman.net/2009/02/10/art-collides-with-code/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 17:27:28 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[art and code]]></category>
		<category><![CDATA[nature of code]]></category>
		<category><![CDATA[processing.org]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/?p=353</guid>
		<description><![CDATA[Two announcements. I am incredibly honored and excited to be participating in the upcoming Art and Code symposium, organized by Golan Levin at Carnegie Mellon University. Visit Art and Code In addition, I&#8217;m finally working on a new tutorial page &#8230; <a href="http://www.shiffman.net/2009/02/10/art-collides-with-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Two announcements.</p>
<p>I am incredibly honored and excited to be participating in the upcoming <a href="http://artandcode.ning.com/">Art and Code</a> symposium, organized by Golan Levin at Carnegie Mellon University.  </p>
<p><embed src="http://static.ning.com/artandcode/widgets/index/swf/badge.swf?v=3.13.3%3A15354" quality="high" scale="noscale" salign="lt" wmode="transparent" bgcolor="#ffffff" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="206" height="242" allowScriptAccess="always" flashvars="networkUrl=http%3A%2F%2Fartandcode.ning.com%2F&amp;panel=network_large&amp;configXmlUrl=http%3A%2F%2Fstatic.ning.com%2Fartandcode%2Finstances%2Fmain%2Fembeddable%2Fbadge-config.xml%3Ft%3D1233765294" /> <br /><small><a href="http://artandcode.ning.com/">Visit <em>Art and Code</em></a></small></p>
<p>In addition, I&#8217;m finally working on <a href="http://www.shiffman.net/teaching/nature/collisions/">a new tutorial page</a> for the <a href="http://www.shiffman.net/teaching/nature">Nature of Code</a> site.  The tutorial will be about resolving collisions and I&#8217;m using the excellent book <a href="http://www.amazon.com/gp/product/1584503300?ie=UTF8&#038;tag=shiffman-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=1584503300">Mathematics and Physics for Programmers</a> as a basis.  I&#8217;ve posted the very first example, a simple implementation (using <a href="http://www.processing.org/reference/PVector.html">PVector</a>) of two circles (equal mass) colliding.  Note the collision is an idealized <i>elastic</i> collision. And the example isn&#8217;t terribly sophisticated and needs some improvements in order to work with more than two objects.</p>
<p><a href="http://www.shiffman.net/teaching/nature/collisions/"><img src="http://www.shiffman.net/itp/classes/nature/collisions_s09/collisions1.jpg"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2009/02/10/art-collides-with-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

