<?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>Tomorrow Evening &#187; Trigonometry</title>
	<atom:link href="http://blog.tomorrowevening.com/tag/trig/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tomorrowevening.com</link>
	<description>Digitally Driven</description>
	<lastBuildDate>Fri, 16 Jul 2010 06:33:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Useful Trig Methods</title>
		<link>http://blog.tomorrowevening.com/fla/useful-trig-methods/</link>
		<comments>http://blog.tomorrowevening.com/fla/useful-trig-methods/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 05:36:27 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Trigonometry]]></category>

		<guid isPermaLink="false">http://blog.tomorrowevening.com/?p=144</guid>
		<description><![CDATA[I've recently been working on a physics/trigonometry project at home using Processing and memo's amazing MSARemote. In short, I realized I haven't posted anything on Tomorrow Evening in ages, I have a lot of cool things up my sleeve right now, just trying to find time to get all these ideas out. I'll be taking [...]]]></description>
			<content:encoded><![CDATA[<p>I've recently been working on a physics/trigonometry project at home using <a href="http://www.processing.org/" target="_blank">Processing </a>and <a href="http://www.memo.tv/" target="_blank">memo</a>'s amazing <a href="http://www.memo.tv/iphone/msaremote" target="_blank">MSARemote</a>. In short, I realized I haven't posted anything on <strong>Tomorrow Evening</strong> in ages, I have a lot of cool things up my sleeve right now, just trying to find time to get all these ideas out. I'll be taking all of Thanksgiving week off to take a break from work and do some fun experiments. If I weren't a web developer I'd turn my internet off for a few weeks, I keep finding such great developers/art online that I start something new every other day and never finish what I was working on the day before! That needs to end soon :P. I know I said I was doing a Processing experiment and this code is in AS3 but I have a good reason why! My wordpress doesn't know how to format processing code and since it's only a few lines, I converted it to AS3.</p>
<pre class="actionscript3"><span style="color: #b1b100;">function</span> findDistance<span style="color: #66cc66;">&#40;</span>x1:<span style="color: #0066CC;">Number</span>, y1:<span style="color: #0066CC;">Number</span>, x2:<span style="color: #0066CC;">Number</span>, y2:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #b1b100;">var</span> xd:<span style="color: #0066CC;">Number</span> = x1 - x2;
  <span style="color: #b1b100;">var</span> yd:<span style="color: #0066CC;">Number</span> = y1 - y2;
  <span style="color: #b1b100;">var</span> td:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">sqrt</span><span style="color: #66cc66;">&#40;</span>xd <span style="color: #b1b100;">*</span> xd + yd <span style="color: #b1b100;">*</span> yd<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">return</span> td;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">function</span> findAngle<span style="color: #66cc66;">&#40;</span>x1:<span style="color: #0066CC;">Number</span>, y1:<span style="color: #0066CC;">Number</span>, x2:<span style="color: #0066CC;">Number</span>, y2:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #b1b100;">var</span> xd:<span style="color: #0066CC;">Number</span> = x1 - x2;
  <span style="color: #b1b100;">var</span> yd:<span style="color: #0066CC;">Number</span> = y1 - y2;
&nbsp;
  <span style="color: #b1b100;">var</span> t:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">atan2</span><span style="color: #66cc66;">&#40;</span>yd,xd<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">var</span> a:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">180</span> + <span style="color: #66cc66;">&#40;</span>-<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">180</span> <span style="color: #b1b100;">*</span> t<span style="color: #66cc66;">&#41;</span> / <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">PI</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">return</span> a;
<span style="color: #66cc66;">&#125;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomorrowevening.com/fla/useful-trig-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logarithmic Spiral</title>
		<link>http://blog.tomorrowevening.com/fla/logarithmic-spiral/</link>
		<comments>http://blog.tomorrowevening.com/fla/logarithmic-spiral/#comments</comments>
		<pubDate>Wed, 20 May 2009 01:27:35 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Trigonometry]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.tomorrowevening.com/?p=10</guid>
		<description><![CDATA[Like my previous post, I'll teach you how to draw a spiral using code. This spiral's radius increases per iteration, thus the distance between arms increasing. First off, the math equation... r = a * b * O r = Radius a = Turn of the spiral b = Distance between arms O = Theta [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.tomorrowevening.com/wp-content/uploads/2009/05/blue.jpg"><img class="alignnone size-full wp-image-9" title="logarithmic" src="http://blog.tomorrowevening.com/wp-content/uploads/2009/05/blue.jpg" alt="logarithmic" width="512" height="384" /></a><br />
Like my previous post, I'll teach you how to draw a spiral using code. This spiral's radius increases per iteration, thus the distance between arms increasing.<br />
<span id="more-10"></span><br />
First off, the math equation...</p>
<p>r = a * b * O</p>
<p>r = Radius<br />
a = Turn of the spiral<br />
b = Distance between arms<br />
O = Theta (greek character now allowed in post)</p>
<p>Theta is the variable which is constantly updated, so in the instance of showing the spiral being created, we'll say that O = the degree; in other words, O = (O &lt; 360) ? O++ : O = 0;</p>
<p>We also need to determine the X and Y values of where to draw the new point.  Since we get the value for r, we simply need to split it up uysing sin and cosine.</p>
<p>Cosine is used to retrieve the X value<br />
Sine is used to retrieve the Y value</p>
<p>Here's our final code:</p>
<pre class="actionscript3"><span style="color: #b1b100;">const</span> speed:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">2</span>;
<span style="color: #b1b100;">const</span> a:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0.25</span>;
<span style="color: #b1b100;">const</span> b:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10</span>;
<span style="color: #b1b100;">const</span> midX:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">200</span>;
<span style="color: #b1b100;">const</span> midY:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">150</span>;
&nbsp;
<span style="color: #b1b100;">var</span> angle:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #b1b100;">var</span> px:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #b1b100;">var</span> py:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
&nbsp;
<span style="color: #b1b100;">var</span> sp:<span style="color: #0066CC;">Sprite</span> = new <span style="color: #0066CC;">Sprite</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
sp.<span style="color: #0066CC;">graphics</span>.<span style="color: #006600;">lineStyle</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.1</span>, 0x000000<span style="color: #66cc66;">&#41;</span>;
sp.<span style="color: #0066CC;">graphics</span>.<span style="color: #006600;">moveTo</span> <span style="color: #66cc66;">&#40;</span>midX, midY<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">addChild</span> <span style="color: #66cc66;">&#40;</span>sp<span style="color: #66cc66;">&#41;</span>;
&nbsp;
addEventListener <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Event.<span style="color: #006600;">ENTER_FRAME</span></span>, _enter<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">function</span> _enter <span style="color: #66cc66;">&#40;</span>e:<span style="color: #0066CC;">Event</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	angle -= speed;
<span style="color: #808080; font-style: italic;">// add the midpoints so that the spiral starts from the center of your stage :)</span>
	px = midX + <span style="color: #66cc66;">&#40;</span>a <span style="color: #b1b100;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">cos</span> <span style="color: #66cc66;">&#40;</span>toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">*</span> <span style="color: #66cc66;">&#40;</span>b <span style="color: #b1b100;">*</span> toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	py = midY + <span style="color: #66cc66;">&#40;</span>a <span style="color: #b1b100;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">sin</span> <span style="color: #66cc66;">&#40;</span>toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">*</span> <span style="color: #66cc66;">&#40;</span>b <span style="color: #b1b100;">*</span> toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	sp.<span style="color: #0066CC;">graphics</span>.<span style="color: #006600;">lineTo</span> <span style="color: #66cc66;">&#40;</span>px, py<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">function</span> toRadians <span style="color: #66cc66;">&#40;</span>degrees:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>degrees / <span style="color: #cc66cc;">180</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">PI</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomorrowevening.com/fla/logarithmic-spiral/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Archimedian Spiral</title>
		<link>http://blog.tomorrowevening.com/fla/archimedian-spiral/</link>
		<comments>http://blog.tomorrowevening.com/fla/archimedian-spiral/#comments</comments>
		<pubDate>Wed, 20 May 2009 01:26:02 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Trigonometry]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.tomorrowevening.com/?p=6</guid>
		<description><![CDATA[Ever draw spirals in your notebook when you're doodling? Well this will teach you just how to code such a thing! First off, the math equation... r = a + bO r = Radius a = Turn of the spiral b = Distance between arms O = Theta (greek character now allowed in post) Theta [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.tomorrowevening.com/wp-content/uploads/2009/05/green.jpg"><img class="alignnone size-full wp-image-7" title="archimedian" src="http://blog.tomorrowevening.com/wp-content/uploads/2009/05/green.jpg" alt="archimedian" width="512" height="384" /></a></p>
<p>Ever draw spirals in your notebook when you're doodling? Well this will teach you just how to code such a thing!<br />
<span id="more-6"></span><br />
First off, the math equation...</p>
<p>r = a + bO</p>
<p>r = Radius<br />
a = Turn of the spiral<br />
b = Distance between arms<br />
O = Theta (greek character now allowed in post)</p>
<p>Theta is the variable which is constantly updated, so in the instance of showing the spiral being created, we'll say that O = the degree; in other words, O = (O &lt; 360) ? O++ : O = 0;</p>
<p>We also need to determine the X and Y values of where to draw the new point.  Since we get the value for r, we simply need to split it up uysing sin and cosine.</p>
<p>Cosine is used to retrieve the X value<br />
Sine is used to retrieve the Y value</p>
<p>Here's our final code:</p>
<pre class="actionscript3"><span style="color: #b1b100;">const</span> speed:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">2</span>;
<span style="color: #b1b100;">const</span> a:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0.25</span>;
<span style="color: #b1b100;">const</span> b:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10</span>;
<span style="color: #b1b100;">const</span> midX:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">200</span>;
<span style="color: #b1b100;">const</span> midY:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">150</span>;
&nbsp;
<span style="color: #b1b100;">var</span> angle:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #b1b100;">var</span> px:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #b1b100;">var</span> py:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
&nbsp;
<span style="color: #b1b100;">var</span> sp:<span style="color: #0066CC;">Sprite</span> = new <span style="color: #0066CC;">Sprite</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
sp.<span style="color: #0066CC;">graphics</span>.<span style="color: #006600;">lineStyle</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.1</span>, 0x000000<span style="color: #66cc66;">&#41;</span>;
sp.<span style="color: #0066CC;">graphics</span>.<span style="color: #006600;">moveTo</span> <span style="color: #66cc66;">&#40;</span>midX, midY<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">addChild</span> <span style="color: #66cc66;">&#40;</span>sp<span style="color: #66cc66;">&#41;</span>;
&nbsp;
addEventListener <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Event.<span style="color: #006600;">ENTER_FRAME</span></span>, _enter<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">function</span> _enter <span style="color: #66cc66;">&#40;</span>e:<span style="color: #0066CC;">Event</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
angle -= speed;
<span style="color: #808080; font-style: italic;">// add the midpoints so that the spiral starts from the center of your stage :)</span>
px = midX + <span style="color: #66cc66;">&#40;</span>a <span style="color: #b1b100;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">cos</span> <span style="color: #66cc66;">&#40;</span>toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">*</span> <span style="color: #66cc66;">&#40;</span>b <span style="color: #b1b100;">*</span> toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
py = midY + <span style="color: #66cc66;">&#40;</span>a <span style="color: #b1b100;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">sin</span> <span style="color: #66cc66;">&#40;</span>toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">*</span> <span style="color: #66cc66;">&#40;</span>b <span style="color: #b1b100;">*</span> toRadians <span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
sp.<span style="color: #0066CC;">graphics</span>.<span style="color: #006600;">lineTo</span> <span style="color: #66cc66;">&#40;</span>px, py<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">function</span> toRadians <span style="color: #66cc66;">&#40;</span>degrees:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>degrees / <span style="color: #cc66cc;">180</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #006600;">PI</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomorrowevening.com/fla/archimedian-spiral/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
