<?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 9-8: Array of button objects</title>
	<atom:link href="http://www.learningprocessing.com/exercises/chapter-9/exercise-9-8/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>Thu, 09 Feb 2012 16:27:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Daniel Shiffman</title>
		<link>http://www.learningprocessing.com/exercises/chapter-9/exercise-9-8/comment-page-1/#comment-17880</link>
		<dc:creator>Daniel Shiffman</dc:creator>
		<pubDate>Tue, 18 Jan 2011 00:30:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1287#comment-17880</guid>
		<description>For circular buttons, you can use the distance function, i.e. if you know the x,y, and radius of the button you have:

&lt;pre&gt;
float d = dist(mouseX,mouseY,x,y);
if (d &lt; r) {
 // you are inside the button!
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>For circular buttons, you can use the distance function, i.e. if you know the x,y, and radius of the button you have:</p>
<pre>
float d = dist(mouseX,mouseY,x,y);
if (d < r) {
 // you are inside the button!
}
</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.learningprocessing.com/exercises/chapter-9/exercise-9-8/comment-page-1/#comment-17282</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Thu, 06 Jan 2011 15:52:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1287#comment-17282</guid>
		<description>Hi,

Great exercise, but after I did it, i thought- how would you generate circular buttons? I started to try it but got stuck when I realised the x and y values are dependent on one another when you define a cartesian circle. Therefore I couldn&#039;t define limits for the edge of the button.

Is there a way to do this simply using polar coordiantes? Or is it possible to define to variables such that they can describe a circle in the standard cartesian form? :
(x - a) ^ 2  + (y - b) ^ 2 = r ^ 2

If the way to do it is far more complicated than my current level of Processing knowledge then not to worry!

cheers</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Great exercise, but after I did it, i thought- how would you generate circular buttons? I started to try it but got stuck when I realised the x and y values are dependent on one another when you define a cartesian circle. Therefore I couldn&#8217;t define limits for the edge of the button.</p>
<p>Is there a way to do this simply using polar coordiantes? Or is it possible to define to variables such that they can describe a circle in the standard cartesian form? :<br />
(x &#8211; a) ^ 2  + (y &#8211; b) ^ 2 = r ^ 2</p>
<p>If the way to do it is far more complicated than my current level of Processing knowledge then not to worry!</p>
<p>cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Shiffman</title>
		<link>http://www.learningprocessing.com/exercises/chapter-9/exercise-9-8/comment-page-1/#comment-9251</link>
		<dc:creator>Daniel Shiffman</dc:creator>
		<pubDate>Tue, 09 Feb 2010 03:40:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1287#comment-9251</guid>
		<description>That&#039;s exactly right.  fill() affects the shapes drawn afterwards so you always want to make sure you call rect() (or whatever shape you want) after you set the rectangle&#039;s color.</description>
		<content:encoded><![CDATA[<p>That&#8217;s exactly right.  fill() affects the shapes drawn afterwards so you always want to make sure you call rect() (or whatever shape you want) after you set the rectangle&#8217;s color.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maria Antônia</title>
		<link>http://www.learningprocessing.com/exercises/chapter-9/exercise-9-8/comment-page-1/#comment-9245</link>
		<dc:creator>Maria Antônia</dc:creator>
		<pubDate>Mon, 08 Feb 2010 18:44:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1287#comment-9245</guid>
		<description>Hi!
Something weird happened here with my display function:

void display(){
  rectMode(CORNER);
  stroke(100);
rect(x,y,w,h);  // when rect is here, the button that reacts is always the next button of the array...
 if (on){
    fill(175);
  }else{
    fill(0);
  }
//rect(x,y,w,h);  ----&gt; when rect is here, the program works properly...
}

Is that any relation with the program flow, or is that a bug??</description>
		<content:encoded><![CDATA[<p>Hi!<br />
Something weird happened here with my display function:</p>
<p>void display(){<br />
  rectMode(CORNER);<br />
  stroke(100);<br />
rect(x,y,w,h);  // when rect is here, the button that reacts is always the next button of the array&#8230;<br />
 if (on){<br />
    fill(175);<br />
  }else{<br />
    fill(0);<br />
  }<br />
//rect(x,y,w,h);  &#8212;-&gt; when rect is here, the program works properly&#8230;<br />
}</p>
<p>Is that any relation with the program flow, or is that a bug??</p>
]]></content:encoded>
	</item>
</channel>
</rss>

