<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Exercise 14-6: Spinning baton</title>
	<atom:link href="http://www.learningprocessing.com/exercises/chapter-14/exercise-14-6/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learningprocessing.com</link>
	<description>A Beginner's Guide to Programming Images, Animation, and Interaction by Daniel Shiffman</description>
	<lastBuildDate>Fri, 10 Feb 2012 19:58:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anonymous</title>
		<link>http://www.learningprocessing.com/exercises/chapter-14/exercise-14-6/comment-page-1/#comment-20723</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 05 Feb 2012 16:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1443#comment-20723</guid>
		<description>Ok so I have done it a long way round.. just looked at the answer.. well I had some fun anyway.</description>
		<content:encoded><![CDATA[<p>Ok so I have done it a long way round.. just looked at the answer.. well I had some fun anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.learningprocessing.com/exercises/chapter-14/exercise-14-6/comment-page-1/#comment-20722</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 05 Feb 2012 16:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1443#comment-20722</guid>
		<description>//Hey I have just been geting my head round all the translate and managed this without //looking at the answer.. Not sure if this will be the same but I managed it with the pop //and push Matrix. 

//draw a baton!!!


void setup(){
  size(300,300);
  strokeWeight(12);//give the handle good width
  smooth();
  }

void draw(){
  background(0);
  fill(255);
  stroke(255);
  pushMatrix();//set the translate to only move for the line
  translate(width/2,height/2);//sets x y to center
  //angle ranges from 0 to PI based on mouseX location to width
  float theta = PI*mouseX/width;
  //rotate by the angle theta
  rotate(theta);
  
  //display a line at the center of the sketch
  
  line(-width/4,0, width/4, 0);
 
  popMatrix();
  pushMatrix();
  translate(width/2,height/2);
  
  //float theta2 = PI*mouseX/width;//dont need this again
  rotate(theta);
  
  ellipseMode(CENTER);
  ellipse(-width/4, 0, 30,30);
  popMatrix();
  
  
  pushMatrix();
  translate(width/2,height/2);
  
  //float theta3 = PI*mouseX/width;//dont need this again
  rotate(theta);
  
  ellipseMode(CENTER);
  ellipse(width/4, 0, 30,30);
  popMatrix();
}
</description>
		<content:encoded><![CDATA[<p>//Hey I have just been geting my head round all the translate and managed this without //looking at the answer.. Not sure if this will be the same but I managed it with the pop //and push Matrix. </p>
<p>//draw a baton!!!</p>
<p>void setup(){<br />
  size(300,300);<br />
  strokeWeight(12);//give the handle good width<br />
  smooth();<br />
  }</p>
<p>void draw(){<br />
  background(0);<br />
  fill(255);<br />
  stroke(255);<br />
  pushMatrix();//set the translate to only move for the line<br />
  translate(width/2,height/2);//sets x y to center<br />
  //angle ranges from 0 to PI based on mouseX location to width<br />
  float theta = PI*mouseX/width;<br />
  //rotate by the angle theta<br />
  rotate(theta);<br />
  <br />
  //display a line at the center of the sketch<br />
  <br />
  line(-width/4,0, width/4, 0);<br />
 <br />
  popMatrix();<br />
  pushMatrix();<br />
  translate(width/2,height/2);<br />
  <br />
  //float theta2 = PI*mouseX/width;//dont need this again<br />
  rotate(theta);<br />
  <br />
  ellipseMode(CENTER);<br />
  ellipse(-width/4, 0, 30,30);<br />
  popMatrix();<br />
  <br />
  <br />
  pushMatrix();<br />
  translate(width/2,height/2);<br />
  <br />
  //float theta3 = PI*mouseX/width;//dont need this again<br />
  rotate(theta);<br />
  <br />
  ellipseMode(CENTER);<br />
  ellipse(width/4, 0, 30,30);<br />
  popMatrix();<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

