<?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: Pi and Pie: Enjoying some time with trigonometry</title>
	<atom:link href="http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/feed" rel="self" type="application/rss+xml" />
	<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry</link>
	<description>blogging about life, the universe, and everything tech</description>
	<lastBuildDate>Sat, 08 Sep 2012 07:06:53 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Juilan Viereck</title>
		<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/comment-page-1#comment-40938</link>
		<dc:creator>Juilan Viereck</dc:creator>
		<pubDate>Sun, 07 Jun 2009 19:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://almaer.com/blog/?p=2435#comment-40938</guid>
		<description>oh yes, I had to solve this on my own some years ago :D

But to put a little bit more math in there: you should calculate the distance between the center of the pie and the mouse-click-point. If this distance &gt; radius =&gt; user clicked outside of the pie =&gt; we don&#039;t have to care about this ;) 

That&#039;s where you bring in the nice math equation:  a^2 + b^2 = c^2.

And who wants to miss this nice equation ;)</description>
		<content:encoded><![CDATA[<p>oh yes, I had to solve this on my own some years ago :D</p>
<p>But to put a little bit more math in there: you should calculate the distance between the center of the pie and the mouse-click-point. If this distance &gt; radius =&gt; user clicked outside of the pie =&gt; we don&#8217;t have to care about this ;) </p>
<p>That&#8217;s where you bring in the nice math equation:  a^2 + b^2 = c^2.</p>
<p>And who wants to miss this nice equation ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dion</title>
		<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/comment-page-1#comment-40926</link>
		<dc:creator>dion</dc:creator>
		<pubDate>Fri, 05 Jun 2009 02:42:02 +0000</pubDate>
		<guid isPermaLink="false">http://almaer.com/blog/?p=2435#comment-40926</guid>
		<description>Awesome comments!

@Joe Ah come on mate, there is always room for a new slice of pie ;)

@Mike: Great point for this solution!

@zznq: Very true. atan2 is so simple though that it didn&#039;t seem like more work really.</description>
		<content:encoded><![CDATA[<p>Awesome comments!</p>
<p>@Joe Ah come on mate, there is always room for a new slice of pie ;)</p>
<p>@Mike: Great point for this solution!</p>
<p>@zznq: Very true. atan2 is so simple though that it didn&#8217;t seem like more work really.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Rampersad</title>
		<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/comment-page-1#comment-40925</link>
		<dc:creator>Ryan Rampersad</dc:creator>
		<pubDate>Fri, 05 Jun 2009 01:21:40 +0000</pubDate>
		<guid isPermaLink="false">http://almaer.com/blog/?p=2435#comment-40925</guid>
		<description>This is neat if only because I&#039;m finishing my school year learning trigonometric identities. I&#039;ve always wanted to make a circle menu.</description>
		<content:encoded><![CDATA[<p>This is neat if only because I&#8217;m finishing my school year learning trigonometric identities. I&#8217;ve always wanted to make a circle menu.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Walker</title>
		<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/comment-page-1#comment-40923</link>
		<dc:creator>Joe Walker</dc:creator>
		<pubDate>Thu, 04 Jun 2009 22:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://almaer.com/blog/?p=2435#comment-40923</guid>
		<description>Dion&#039;s general solution works for an arbitrary number of slices. If you want small, incomprehensible and quadrants only, you could also do:

return [&quot;bottom&quot;,&quot;left&quot;,&quot;right&quot;,&quot;top&quot;][(x&gt;y?2:0)+(500-x&gt;y?1:0)];

Needless to say, I&#039;ll leave Dion&#039;s version in Bespin, if only to prevent him from changing the number of slices. ;-)</description>
		<content:encoded><![CDATA[<p>Dion&#8217;s general solution works for an arbitrary number of slices. If you want small, incomprehensible and quadrants only, you could also do:</p>
<p>return ["bottom","left","right","top"][(x&gt;y?2:0)+(500-x&gt;y?1:0)];</p>
<p>Needless to say, I&#8217;ll leave Dion&#8217;s version in Bespin, if only to prevent him from changing the number of slices. ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Riley</title>
		<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/comment-page-1#comment-40921</link>
		<dc:creator>Will Riley</dc:creator>
		<pubDate>Thu, 04 Jun 2009 20:50:51 +0000</pubDate>
		<guid isPermaLink="false">http://almaer.com/blog/?p=2435#comment-40921</guid>
		<description>I did something similar a while ago, it&#039;s in dojoc. I used dojox.gfx to draw the pie, and trig to figure out the angle. There&#039;s also some code there so that it can support any number of menu items.

You can grab the code here: http://svn.dojotoolkit.org/dojoc/sandbox/piemenu/</description>
		<content:encoded><![CDATA[<p>I did something similar a while ago, it&#8217;s in dojoc. I used dojox.gfx to draw the pie, and trig to figure out the angle. There&#8217;s also some code there so that it can support any number of menu items.</p>
<p>You can grab the code here: <a href="http://svn.dojotoolkit.org/dojoc/sandbox/piemenu/" rel="nofollow">http://svn.dojotoolkit.org/dojoc/sandbox/piemenu/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/comment-page-1#comment-40920</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 04 Jun 2009 20:43:22 +0000</pubDate>
		<guid isPermaLink="false">http://almaer.com/blog/?p=2435#comment-40920</guid>
		<description>Trig is cool but occasionally people resort to it prematurely.
High school linear algebra applies.
You have two lines that each divide the plane in two. One line is y=x and the other line is y=-x. You can compute a boolean for each line that says which side you&#039;re on.
var a = y&gt;-x; var b = !a;
var c = y&gt;x;  var d = !c;
If area one is the area that contains (1,0) and you number counter-clockwise,
var area;
if (d &amp; a) area=1;
if (c &amp; a) area = 2;
if (c &amp; b) area = 3;
if (d &amp; b) area = 4;
Optimization left to the reader.
Now suppose you want the wedges that contain (1,0) and (-1,0) to be thinner than the wedges that contain (0,1) and (0,-1). This simply changes the equations of your lines and the resulting definitions of the predicates a, b, c and d.
Suppose the slopes of these lines are .5 and -.5:
y = x *.5;
y = -x *.5;
Change two statements of the code:
var a = y &gt; -x*.5;
var c = y &gt; x*.5;
The rest of the above logic would be the same.</description>
		<content:encoded><![CDATA[<p>Trig is cool but occasionally people resort to it prematurely.<br />
High school linear algebra applies.<br />
You have two lines that each divide the plane in two. One line is y=x and the other line is y=-x. You can compute a boolean for each line that says which side you&#8217;re on.<br />
var a = y&gt;-x; var b = !a;<br />
var c = y&gt;x;  var d = !c;<br />
If area one is the area that contains (1,0) and you number counter-clockwise,<br />
var area;<br />
if (d &amp; a) area=1;<br />
if (c &amp; a) area = 2;<br />
if (c &amp; b) area = 3;<br />
if (d &amp; b) area = 4;<br />
Optimization left to the reader.<br />
Now suppose you want the wedges that contain (1,0) and (-1,0) to be thinner than the wedges that contain (0,1) and (0,-1). This simply changes the equations of your lines and the resulting definitions of the predicates a, b, c and d.<br />
Suppose the slopes of these lines are .5 and -.5:<br />
y = x *.5;<br />
y = -x *.5;<br />
Change two statements of the code:<br />
var a = y &gt; -x*.5;<br />
var c = y &gt; x*.5;<br />
The rest of the above logic would be the same.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zznq</title>
		<link>http://almaer.com/blog/pi-and-pie-enjoying-some-time-with-trigonometry/comment-page-1#comment-40918</link>
		<dc:creator>zznq</dc:creator>
		<pubDate>Thu, 04 Jun 2009 19:10:16 +0000</pubDate>
		<guid isPermaLink="false">http://almaer.com/blog/?p=2435#comment-40918</guid>
		<description>Using atan2 to solve this seems to be a bit like overkill; a coordinate change (with your easy-ville solution) would probably function better.</description>
		<content:encoded><![CDATA[<p>Using atan2 to solve this seems to be a bit like overkill; a coordinate change (with your easy-ville solution) would probably function better.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
