<?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>MikeRandrup</title>
	<atom:link href="http://blog.MikeRandrup.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.MikeRandrup.com</link>
	<description>pet projects in code, graphics, and more.</description>
	<lastBuildDate>Fri, 31 Aug 2012 13:08:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Find Point along Bezier Curve in JavaScript</title>
		<link>http://blog.MikeRandrup.com/2012/08/find-point-along-bezier-curve-in-javascript/</link>
		<comments>http://blog.MikeRandrup.com/2012/08/find-point-along-bezier-curve-in-javascript/#comments</comments>
		<pubDate>Fri, 31 Aug 2012 12:47:09 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=572</guid>
		<description><![CDATA[I adapted this from an excellent C++ example yesterday and wanted to share. This is for an HTML5 game (like) project I&#8217;m working on where interpolating along vector art created in Adobe Illustrator is needed (more on that in a future post hopefully!) ///////////////////////////////////////////////////////////////// JavaScript Implementation of the DeCasteljau Algorithm// Based on C++ Implementation from [...]]]></description>
				<content:encoded><![CDATA[<p>I adapted this from an excellent C++ example yesterday and wanted to share.  This is for an HTML5 game (like) project I&#8217;m working on where interpolating along vector art created in Adobe Illustrator is needed (more on that in a future post hopefully!)</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Javascript"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #006600; font-style: italic;">///////////////////////////////////////////////////////////////</span></li><li><span style="color: #006600; font-style: italic;">// JavaScript Implementation of the DeCasteljau Algorithm</span></li><li><span style="color: #006600; font-style: italic;">// Based on C++ Implementation from </span></li><li><span style="color: #006600; font-style: italic;">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://cubic.org/docs/bezier.htm</span></li><li><span style="color: #006600; font-style: italic;">// which credits Nils Pipenbrinck aka Submissive/Cubic &amp; $eeN</span></li><li><span style="color: #006600; font-style: italic;">// this particular implementation written by Mike Randrup Aug 30 2012</span></li><li><span style="color: #006600; font-style: italic;">///////////////////////////////////////////////////////////////</span></li><li>&nbsp;</li><li><span style="color: #006600; font-style: italic;">/* Usage:</span></li><li>&nbsp;</li><li><span style="color: #006600; font-style: italic;">	// A &amp; D are the start and end points of the line</span></li><li><span style="color: #006600; font-style: italic;">	// B &amp; C are the handle (influence) points</span></li><li>&nbsp;</li><li><span style="color: #006600; font-style: italic;">	myPointA = bezier.point(40,100);</span></li><li><span style="color: #006600; font-style: italic;">	myPointB = bezier.point(80,20);</span></li><li><span style="color: #006600; font-style: italic;">	myPointC = bezier.point(150,180);</span></li><li><span style="color: #006600; font-style: italic;">	myPointD = bezier.point(260,100);</span></li><li>&nbsp;</li><li><span style="color: #006600; font-style: italic;">	time = 0.5; // halfway through curve</span></li><li>&nbsp;</li><li><span style="color: #006600; font-style: italic;">	resultPoint = bezier.calc(</span></li><li><span style="color: #006600; font-style: italic;">		myPointA, myPointB,</span></li><li><span style="color: #006600; font-style: italic;">		myPointC, myPointD,</span></li><li><span style="color: #006600; font-style: italic;">		time</span></li><li><span style="color: #006600; font-style: italic;">	);</span></li><li>&nbsp;</li><li><span style="color: #006600; font-style: italic;">*/</span>&nbsp;&nbsp; </li><li>&nbsp;</li><li>&nbsp;</li><li><span style="color: #003366; font-weight: bold;">var</span> bezier <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li>&nbsp;</li><li>	<span style="color: #003366; font-weight: bold;">var</span> Point <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span></li><li>		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> y <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span></li><li>		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span></li><li>	<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>	<span style="color: #003366; font-weight: bold;">var</span> interpolateLinear <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>pointA<span style="color: #339933;">,</span> pointB<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span></li><li>			x<span style="color: #339933;">:</span> pointA.<span style="color: #660066;">x</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>pointB.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> pointA.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> time<span style="color: #339933;">,</span></li><li>			y<span style="color: #339933;">:</span> pointA.<span style="color: #660066;">y</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>pointB.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> pointA.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> time<span style="color: #339933;">,</span></li><li>		<span style="color: #009900;">&#125;</span></li><li>	<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>	<span style="color: #003366; font-weight: bold;">var</span> bezObj <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span></li><li>&nbsp;</li><li>		point<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">new</span> Point<span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></li><li>&nbsp;</li><li>		calc<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>p1<span style="color: #339933;">,</span> p2<span style="color: #339933;">,</span> p3<span style="color: #339933;">,</span> p4<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>			<span style="color: #003366; font-weight: bold;">var</span> ab <span style="color: #339933;">=</span> interpolateLinear<span style="color: #009900;">&#40;</span>p1<span style="color: #339933;">,</span> p2<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>				bc <span style="color: #339933;">=</span> interpolateLinear<span style="color: #009900;">&#40;</span>p2<span style="color: #339933;">,</span> p3<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>				cd <span style="color: #339933;">=</span> interpolateLinear<span style="color: #009900;">&#40;</span>p3<span style="color: #339933;">,</span> p4<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>				abbc <span style="color: #339933;">=</span> interpolateLinear<span style="color: #009900;">&#40;</span>ab<span style="color: #339933;">,</span> bc<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>				bccd <span style="color: #339933;">=</span> interpolateLinear<span style="color: #009900;">&#40;</span>bc<span style="color: #339933;">,</span> cd<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>			<span style="color: #000066; font-weight: bold;">return</span> interpolateLinear<span style="color: #009900;">&#40;</span>abbc<span style="color: #339933;">,</span> bccd<span style="color: #339933;">,</span> time<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></li><li>&nbsp;</li><li>	<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>	<span style="color: #000066; font-weight: bold;">return</span> bezObj<span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bezier loaded&quot;</span><span style="color: #339933;">,</span> bezier<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp;&nbsp; </li><li>&nbsp;</li><li><span style="color: #006600; font-style: italic;">///////////////////////////////////////////////////////////////</span></li><li><span style="color: #006600; font-style: italic;">// Also check out http://13thparallel.com/archive/bezier-curves/</span></li><li><span style="color: #006600; font-style: italic;">// for an alternate bezier option in JavaScript</span></li><li><span style="color: #006600; font-style: italic;">///////////////////////////////////////////////////////////////</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Plotting and animating the resulting curve in a canvas is a good way to see it working.  Here is what that might look like.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;us-en&quot;</span>&gt;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Bezier curve test by Mike Randrup<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">canvas</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;output&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;400&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">canvas</span>&gt;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bezier.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span></li><li>&nbsp;&nbsp; // the below javascript snippet goes inline here</li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>This snippet goes into the HTML5 markup above.  (I needed to separate to fix a problem with my new WordPress code formatting plugin)<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Javascript"><div class="devcodeoverflow"><ol><li></li><li>	window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>&nbsp;</li><li>		console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;main running&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>		<span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span></li><li>			t<span style="color: #339933;">,</span></li><li>			steps <span style="color: #339933;">=</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span></li><li>			resultPoint<span style="color: #339933;">,</span></li><li>&nbsp;</li><li>			myPointA <span style="color: #339933;">=</span> bezier.<span style="color: #660066;">point</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">40</span><span style="color: #339933;">,</span><span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>			myPointB <span style="color: #339933;">=</span> bezier.<span style="color: #660066;">point</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">80</span><span style="color: #339933;">,</span><span style="color: #CC0000;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>			myPointC <span style="color: #339933;">=</span> bezier.<span style="color: #660066;">point</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">700</span><span style="color: #339933;">,</span><span style="color: #CC0000;">180</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>			myPointD <span style="color: #339933;">=</span> bezier.<span style="color: #660066;">point</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">550</span><span style="color: #339933;">,</span><span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>&nbsp;</li><li>			canvasEl <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;output&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></li><li>			canvasContext <span style="color: #339933;">=</span> canvasEl.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;2d&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>		<span style="color: #003366; font-weight: bold;">var</span> nextFrame <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>			moveControlPoints<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>			drawCurve<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>		<span style="color: #003366; font-weight: bold;">var</span> moveControlPoints <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>myPointA.<span style="color: #660066;">x</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> myPointA.<span style="color: #660066;">x</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span><span style="color: #CC0000;">600</span><span style="color: #009900;">&#41;</span> myPointA.<span style="color: #660066;">x</span><span style="color: #339933;">++;</span></li><li>			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>myPointB.<span style="color: #660066;">x</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> myPointB.<span style="color: #660066;">x</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span><span style="color: #CC0000;">600</span><span style="color: #009900;">&#41;</span> myPointB.<span style="color: #660066;">x</span><span style="color: #339933;">++;</span></li><li>&nbsp;</li><li>			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>myPointC.<span style="color: #660066;">y</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> myPointC.<span style="color: #660066;">y</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span> myPointC.<span style="color: #660066;">y</span><span style="color: #339933;">--;</span></li><li>			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>myPointD.<span style="color: #660066;">x</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> myPointD.<span style="color: #660066;">x</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span><span style="color: #CC0000;">600</span><span style="color: #009900;">&#41;</span> myPointD.<span style="color: #660066;">x</span><span style="color: #339933;">--;</span></li><li>&nbsp;</li><li>		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>		<span style="color: #003366; font-weight: bold;">var</span> drawCurve <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>			canvasContext.<span style="color: #660066;">fillStyle</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;#FFF&quot;</span><span style="color: #339933;">;</span></li><li>			canvasContext.<span style="color: #660066;">fillRect</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">600</span><span style="color: #339933;">,</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>			canvasContext.<span style="color: #660066;">fillStyle</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;#F00&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>			<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>steps <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>				t <span style="color: #339933;">=</span> i <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span>steps<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>				resultPoint <span style="color: #339933;">=</span> bezier.<span style="color: #660066;">calc</span><span style="color: #009900;">&#40;</span></li><li>					myPointA<span style="color: #339933;">,</span> myPointB<span style="color: #339933;">,</span></li><li>					myPointC<span style="color: #339933;">,</span> myPointD<span style="color: #339933;">,</span></li><li>					t</li><li>				<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>				canvasContext.<span style="color: #660066;">fillRect</span><span style="color: #009900;">&#40;</span>resultPoint.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> resultPoint.<span style="color: #660066;">y</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>			<span style="color: #009900;">&#125;</span></li><li>		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>		setInterval<span style="color: #009900;">&#40;</span>nextFrame<span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// I don't like this here.</span></li><li>&nbsp;</li><li>&nbsp;</li><li>	<span style="color: #009900;">&#125;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></steps></code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2012/08/find-point-along-bezier-curve-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Realtime 3D version of Water Flow Simulation written for Microsoft XNA Framework</title>
		<link>http://blog.MikeRandrup.com/2012/08/realtime-3d-version-of-water-flow-simulation-written-in-the-microsoft-xna/</link>
		<comments>http://blog.MikeRandrup.com/2012/08/realtime-3d-version-of-water-flow-simulation-written-in-the-microsoft-xna/#comments</comments>
		<pubDate>Thu, 30 Aug 2012 13:12:39 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=562</guid>
		<description><![CDATA[Though this is admittedly from earlier this year, hopefully it&#8217;s still interesting.  This is the realtime 3D experiment written on the Microsoft XNA (Xbox, Windows, Windows Phone) Gaming Framework in C#. This is some of my earliest work in the C# language, so much refactoring could occur. Here is the slide deck from a talk [...]]]></description>
				<content:encoded><![CDATA[<p>Though this is admittedly from earlier this year, hopefully it&#8217;s still interesting.  This is the realtime 3D experiment written on the Microsoft XNA (Xbox, Windows, Windows Phone) Gaming Framework in C#. This is some of my earliest work in the C# language, so much refactoring could occur.</p>
<p>Here is the slide deck from a talk I gave on this (contains video clips of results):</p>
<ul>
<li><a href="http://prezi.com/viwjxtkqufmc/getting-started-in-3d-xna-implementing-a-real-time-3d-simulation/">http://prezi.com/getting-started-in-3d-xna/</a></li>
</ul>
<p>The diff analysis on the code between tutorial stage and current stage illustrates my contributions and technique for the water calculation:</p>
<ul>
<li><a href="https://github.com/mikerandrup/XNA_WaterFlow3D/commit/134e654f60b0dff71a5402227d2f058122ae1c86">https://github.com/mikerandrup/XNA_WaterFlow3D/(diff between commits)</a></li>
</ul>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/Rli_dNSI0vU?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/RSD95quZu98?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>Starting point is tutorial from Riemer Grootjans here: <a href="http://www.riemers.net/eng/Tutorials/XNA/Csharp/series4.php">http://www.riemers.net/eng/Tutorials/XNA/Csharp/series4.php</a> Each additional commit shows my changes to achieve water effects. THANK YOU to Riemer!</p>
<p>The core technique is worth discussing, as is the experience of working in XNA, as well as observations on how realtime 3D rendering is handled in this framework.  Hopefully a future blog post will follow.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2012/08/realtime-3d-version-of-water-flow-simulation-written-in-the-microsoft-xna/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3D Land &amp; Water Coding Experiment</title>
		<link>http://blog.MikeRandrup.com/2011/11/3d-land-water-coding-experiment/</link>
		<comments>http://blog.MikeRandrup.com/2011/11/3d-land-water-coding-experiment/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 17:35:18 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[ideas]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[After Effects CS5]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Lightwave 3D]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=539</guid>
		<description><![CDATA[Have you ever played the video game called From Dust? It contains intriguing land, water, and lava simulation. Since first playing it, I have been fascinated with the results of Ubisoft&#8217;s very interesting simulation system. I developed an inspired guess as to how the basic algorithm and technique might work. During some holiday downtime, I [...]]]></description>
				<content:encoded><![CDATA[<p>Have you ever played the video game called From Dust? It contains intriguing land, water, and lava simulation. Since first playing it, I have been fascinated with the results of Ubisoft&#8217;s very interesting simulation system. I developed an inspired guess as to how the basic algorithm and technique might work. During some holiday downtime, I put code to the concept and came up with the following:</p>
<p><iframe width="640" height="480" src="http://www.youtube.com/embed/QUKnzkeWxOI?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>The algorithm steps through a pair of 2 Dimensional arrays containing the height of land and water at each coordinate in the grid. During each step, it determines if and where the water would run downhill, then adjusts the old and new values accordingly. The resolution of the grid was limited by the performance of Flash, which I could no doubt have improved dramatically by using more advanced stage drawing techniques. After running and adjusting the simulations in Flash, I switched the movie to export a JPG image of each frame. That sequence was then run through After Effects (frame blend) to smooth the adjustments. The final sequences were then applied as separate Y-axis displacement maps on &#8220;land&#8221; and &#8220;water&#8221; objects in Lightwave 3D.</p>
<p>In the first of the two animations (mountain springs running downhill into a valley), a trio of simple &#8220;water emitters&#8221; put out a finite amount of water at the tops of the hills, and the algorithm runs it downhill to pool at the bottom. The land was generated with high values at the edges, and low values at the center, with a touch of randomization of the terrain (a &#8220;valley&#8221;).</p>
<p>In the second (sea mountain rising), a flat land mass with water sitting on top (an &#8220;ocean&#8221;) is affected by a strong &#8220;land emitter&#8221; which pushes a mountain out of the sea floor. The water is reacting by being displaced downhill from the land. The circular wave of water was the natural product of the algorithm I created, which seems to indicate being on the right track for how the video game works internally.</p>
<p>Why generate the frames in Flash AS3? Frankly, that choice was due to my own limitations as a programmer. Also, my algorithm fails to ever resolve the water to a natural state of a flat surface.</p>
<p>I now have an even greater sense of awe for what the Ubisoft team achieved with their amazing video game. For example, the game contains dynamic water foam textures which give realistic cues to how the water runs downhill and around obstacles.</p>
<p>The Flash AS3 source code is below. I realize my coding techniques are horrible, and not even object oriented. Had this been for anything other than a proof-of-concept fun project, many loose ends would be wrapped up. There was nothing else in the Flash movie, as it creates all needed movieclips dynamically. If you want to try it, just create a new Flash (ActionScript v3) document and paste the below into the frame 1 actions. It reflects the coding for the &#8220;mountain rising out of the sea&#8221; effect.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="ActionScript 3"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">KeyboardEvent</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Matrix</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #009900; font-style: italic;">//import com.adobe.images.JPGEncoder; // external library used for saving frames</span></li><li>&nbsp;</li><li><span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> frameNum<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">99</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> resX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> resY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = resX<span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> paintStrength<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> tileSpacing<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> tileWidth<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span><span style="color: #000066; font-weight: bold;">/</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">+</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span>tileSpacing<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> tileHeight<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span><span style="color: #000066; font-weight: bold;">/</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">+</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*</span>tileSpacing<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> alreadyEmitted<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> maxEmitted<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> edgeValue<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> =&nbsp;&nbsp;<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> maxBoundary<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = resX<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> drawValue<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = paintStrength<span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> editMode<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;water&quot;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> hideLand<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> hideWater<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> waterInit<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0.1</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> landInit<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0.05</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> updateTimer<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Timer</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Timer</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">250</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>updateTimer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">TimerEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TIMER</span><span style="color: #000066; font-weight: bold;">,</span> advanceFrame<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>updateTimer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #009900; font-style: italic;">// used to capture frames in non-realtime</span></li><li><span style="color: #009900; font-style: italic;">//stage.addEventListener(KeyboardEvent.KEY_DOWN, advanceFrame);</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> advanceFrame<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">TimerEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span></li><li>	updateMap<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #009900; font-style: italic;">//commands</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> parent_mc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>parent_mc<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> landMap<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> landHeight<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>landMap<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> yInit<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> yInit<span style="color: #000066; font-weight: bold;">&lt;</span>resy <span style="color: #000066; font-weight: bold;">;</span> yInit<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> newRow<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #009900; font-style: italic;">//newRow.splice(0,newRow.length);</span></li><li>	newRow<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> xInit<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> xInit<span style="color: #000066; font-weight: bold;">&lt;</span>resX<span style="color: #000066; font-weight: bold;">;</span> xInit<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		landHeight = landInit<span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//+(Math.random()*.1);</span></li><li>		newRow<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>landHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li>	landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>newRow<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> waterMap<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>waterMap<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>yInit=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> yInit<span style="color: #000066; font-weight: bold;">&lt;</span>resY<span style="color: #000066; font-weight: bold;">;</span> yInit<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> waterRow<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #009900; font-style: italic;">//newRow.splice(0,newRow.length);</span></li><li>	waterRow<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>xInit=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> xInit<span style="color: #000066; font-weight: bold;">&lt;</span>resX<span style="color: #000066; font-weight: bold;">;</span> xInit<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		waterRow<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>waterInit<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li>	waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>waterRow<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> calculate_new<span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> newVal<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> newDelta<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> proposedX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> proposedY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> minLevel<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> minX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> minY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> curLand<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> curWater<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> checkLand<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> checkWater<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>	curLand = landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">y</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">x</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	curWater = waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">y</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">x</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span> <span style="color: #6699cc; font-weight: bold;">var</span> neighborX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborX<span style="color: #000066; font-weight: bold;">&lt;</span>=<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborX<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span> <span style="color: #6699cc; font-weight: bold;">var</span> neighborY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborY<span style="color: #000066; font-weight: bold;">&lt;</span>=<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborY<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>&nbsp;</li><li>			proposedX = <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">+</span>neighborX<span style="color: #000066; font-weight: bold;">;</span></li><li>			proposedY = <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">+</span>neighborY<span style="color: #000066; font-weight: bold;">;</span></li><li>			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span></li><li>				<span style="color: #000000;">&#40;</span>proposedX<span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>proposedY<span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">||</span></li><li>				<span style="color: #000000;">&#40;</span>proposedX<span style="color: #000066; font-weight: bold;">&gt;</span>maxBoundary<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>proposedY<span style="color: #000066; font-weight: bold;">&gt;</span>maxBoundary<span style="color: #000000;">&#41;</span> </li><li>			<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>				<span style="color: #009900; font-style: italic;">//trace('skipping edge');</span></li><li>			<span style="color: #000000;">&#125;</span></li><li>			<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></li><li>				checkLand = landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>proposedY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>proposedX<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>				checkWater = waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>proposedY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>proposedX<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>				<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>neighborX==<span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> neighborY==<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>					<span style="color: #009900; font-style: italic;">//trace('skipping self');</span></li><li>				<span style="color: #000000;">&#125;</span></li><li>				<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></li><li>					<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>checkLand<span style="color: #000066; font-weight: bold;">+</span>checkWater<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">&lt;</span>minlevel <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>						minLevel = checkLand<span style="color: #000066; font-weight: bold;">+</span>checkWater<span style="color: #000066; font-weight: bold;">;</span></li><li>						minX = proposedX<span style="color: #000066; font-weight: bold;">;</span></li><li>						minY = proposedY<span style="color: #000066; font-weight: bold;">;</span></li><li>						<span style="color: #009900; font-style: italic;">//trace('new tallness found: ' + minLevel);</span></li><li>					<span style="color: #000000;">&#125;</span></li><li>				<span style="color: #000000;">&#125;</span></li><li>			<span style="color: #000000;">&#125;</span></li><li>		<span style="color: #000000;">&#125;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li>	compare_cells<span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> minX<span style="color: #000066; font-weight: bold;">,</span> minY<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> compare_cells<span style="color: #000000;">&#40;</span>curX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> curY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> checkX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> checkY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">delta</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> curLand<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curX<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> curWater<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curX<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> checkLand<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkX<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> checkWater<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkX<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> idealLevel<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>	<span style="color: #009900; font-style: italic;">// if there is water here</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>curWater <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		<span style="color: #009900; font-style: italic;">//if this water should fall</span></li><li>		<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>curLand<span style="color: #000066; font-weight: bold;">+</span>curLand<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000;">&#40;</span>checkLand<span style="color: #000066; font-weight: bold;">+</span>checkWater<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> </li><li>&nbsp;</li><li>			<span style="color: #009900; font-style: italic;">// get the goal average height between the two including water</span></li><li>			idealLevel = <span style="color: #000000;">&#40;</span>curLand <span style="color: #000066; font-weight: bold;">+</span> curWater <span style="color: #000066; font-weight: bold;">+</span> checkLand <span style="color: #000066; font-weight: bold;">+</span> checkWater<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>idealLevel <span style="color: #000066; font-weight: bold;">&gt;</span> curLand<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> idealLevel = curLand<span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>			<span style="color: #004993;">delta</span> = curLand <span style="color: #000066; font-weight: bold;">+</span> curWater <span style="color: #000066; font-weight: bold;">-</span> idealLevel<span style="color: #000066; font-weight: bold;">;</span></li><li>			<span style="color: #004993;">delta</span> <span style="color: #000066; font-weight: bold;">*</span>= <span style="color: #000000; font-weight:bold;">0.3</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curX<span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">-</span>= <span style="color: #004993;">delta</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkX<span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #004993;">delta</span><span style="color: #000066; font-weight: bold;">;</span></li><li>		<span style="color: #000000;">&#125;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> updateMap<span style="color: #000000;">&#40;</span>eventObject<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span></li><li>	frameNum<span style="color: #000066; font-weight: bold;">++;</span></li><li>&nbsp;</li><li>	<span style="color: #009900; font-style: italic;">// clean up stage from last update</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>parent_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">numChildren</span><span style="color: #000066; font-weight: bold;">!</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #6699cc; font-weight: bold;">var</span> cond<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = parent_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">numChildren</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0033ff; font-weight: bold;">while</span><span style="color: #000000;">&#40;</span> cond <span style="color: #000066; font-weight: bold;">--</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parent_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeChildAt</span><span style="color: #000000;">&#40;</span> cond <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> shading<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> k <span style="color: #0033ff; font-weight: bold;">in</span> waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #0033ff; font-weight: bold;">in</span> waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>k<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>			<span style="color: #6699cc; font-weight: bold;">var</span> square<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Shape</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Shape</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			<span style="color: #6699cc; font-weight: bold;">var</span> squareMC<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			calculate_new<span style="color: #000000;">&#40;</span>i<span style="color: #000066; font-weight: bold;">,</span>k<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>k<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">0.001</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900; font-style: italic;">// water is on this spot</span></li><li>				shading = get_water_color<span style="color: #000000;">&#40;</span>k<span style="color: #000066; font-weight: bold;">,</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			<span style="color: #000000;">&#125;</span></li><li>			<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900; font-style: italic;">// land is showing on this spot</span></li><li>				shading = get_land_color<span style="color: #000000;">&#40;</span>k<span style="color: #000066; font-weight: bold;">,</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			<span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li>			square<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>shading<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			square<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> tileWidth<span style="color: #000066; font-weight: bold;">,</span> tileHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			square<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>			squareMC<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>square<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>			squareMC<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000;">&#40;</span>i <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>tileWidth <span style="color: #000066; font-weight: bold;">+</span> tileSpacing <span style="color: #000066; font-weight: bold;">+</span> tileSpacing<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> tileSpacing<span style="color: #000066; font-weight: bold;">;</span></li><li>			squareMC<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000;">&#40;</span>k <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>tileHeight <span style="color: #000066; font-weight: bold;">+</span> tileSpacing <span style="color: #000066; font-weight: bold;">+</span> tileSpacing<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> tileSpacing<span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>			parent_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>squareMC<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>		<span style="color: #000000;">&#125;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li>	<span style="color: #009900; font-style: italic;">//save_screenshot();&nbsp;&nbsp;// used to capture frames in non-realtime</span></li><li>&nbsp;</li><li>	<span style="color: #009900; font-style: italic;">// water emmitters</span></li><li>	emit_water<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	progress_land<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>frameNum<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> get_land_color<span style="color: #000000;">&#40;</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000;">&#40;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">y</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">x</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">*</span> 0xFF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span> <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">color</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#125;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">255</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">color</span> = <span style="color: #000000; font-weight:bold;">255</span> <span style="color: #000000;">&#125;</span></li><li>	<span style="color: #004993;">color</span> = <span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span> <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">16</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">|</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span> <span style="color: #000066; font-weight: bold;">&lt;&lt;</span> <span style="color: #000000; font-weight:bold;">8</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">|</span> <span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// maps to grey of RGB</span></li><li>	<span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> get_water_color<span style="color: #000000;">&#40;</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">y</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">x</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span></li><li>		<span style="color: #004993;">color</span> = <span style="color: #000000;">&#40;</span>waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">y</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">x</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">+</span> landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">y</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">x</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> 0xFF<span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span> <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">color</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#125;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">255</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">color</span> = <span style="color: #000000; font-weight:bold;">255</span> <span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li>	<span style="color: #009900; font-style: italic;">// the below line draws the water in greyscale, otherwise shades of blue</span></li><li>	<span style="color: #009900; font-style: italic;">// as in an RGB value, the blue is in the least significant digits</span></li><li>	<span style="color: #009900; font-style: italic;">//color = (color &lt; &lt; 16) | (color &lt;&lt; 8) | color; // maps to grey of RGB</span></li><li>	<span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #3f5fbf;">/* </span></li><li><span style="color: #3f5fbf;">function save_screenshot():void {</span></li><li><span style="color: #3f5fbf;">	var jpgSource:BitmapData = new BitmapData (stage.stageWidth, stage.stageHeight);</span></li><li><span style="color: #3f5fbf;">	jpgSource.draw(stage);</span></li><li>&nbsp;</li><li><span style="color: #3f5fbf;">	var jpgEncoder:JPGEncoder = new JPGEncoder(100);</span></li><li><span style="color: #3f5fbf;">	var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);</span></li><li><span style="color: #3f5fbf;">	var file:FileReference = new FileReference();</span></li><li>&nbsp;</li><li><span style="color: #3f5fbf;">	file.save(jpgStream, 'riseLand-'+frameNum+'.jpg');</span></li><li><span style="color: #3f5fbf;">}</span></li><li><span style="color: #3f5fbf;">*/</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> emit_water<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>alreadyEmitted <span style="color: #000066; font-weight: bold;">&lt;</span> maxEmitted<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*.</span>30<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">0.95</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&lt;.</span>3<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>			waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*.</span>30<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">0.95</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000066; font-weight: bold;">.</span>2<span style="color: #000066; font-weight: bold;">;</span></li><li>			alreadyEmitted <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000066; font-weight: bold;">.</span>2<span style="color: #000066; font-weight: bold;">;</span></li><li>		<span style="color: #000000;">&#125;</span></li><li>		<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*.</span>10<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">0.45</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&lt;.</span>3<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>			waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*.</span>10<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">0.45</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000066; font-weight: bold;">.</span>1<span style="color: #000066; font-weight: bold;">;</span></li><li>			alreadyEmitted <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000066; font-weight: bold;">.</span>1<span style="color: #000066; font-weight: bold;">;</span></li><li>		<span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li>		<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*.</span>85<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">0.15</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&lt;.</span>3<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>			waterMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*.</span>85<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">0.15</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000066; font-weight: bold;">.</span>05<span style="color: #000066; font-weight: bold;">;</span></li><li>			alreadyEmitted <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000066; font-weight: bold;">.</span>05<span style="color: #000066; font-weight: bold;">;</span></li><li>		<span style="color: #000000;">&#125;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #6699cc; font-weight: bold;">var</span> landAdded<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> landMax<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> cur_landshift<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #6699cc; font-weight: bold;">var</span> max_landshift<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> progress_land<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> proposedX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> proposedY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span></li><li>&nbsp;</li><li>	<span style="color: #009900; font-style: italic;">// these are the land emitters in the center.</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>landAdded <span style="color: #000066; font-weight: bold;">&lt;</span> landMax<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resY<span style="color: #000066; font-weight: bold;">*.</span>5<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>resX<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">0.5</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">;</span></li><li>		landAdded <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li>	cur_landshift<span style="color: #000066; font-weight: bold;">++;</span></li><li>	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>cur_landshift <span style="color: #000066; font-weight: bold;">&gt;</span> max_landshift<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;</li><li>	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> k <span style="color: #0033ff; font-weight: bold;">in</span> landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>		<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #0033ff; font-weight: bold;">in</span> landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>k<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span> <span style="color: #6699cc; font-weight: bold;">var</span> neighborX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborX<span style="color: #000066; font-weight: bold;">&lt;</span> =<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborX<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>				<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span> <span style="color: #6699cc; font-weight: bold;">var</span> neighborY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborY<span style="color: #000066; font-weight: bold;">&lt;</span>=<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> neighborY<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>					proposedX = i<span style="color: #000066; font-weight: bold;">+</span>neighborX<span style="color: #000066; font-weight: bold;">;</span></li><li>					proposedY = k<span style="color: #000066; font-weight: bold;">+</span>neighborY<span style="color: #000066; font-weight: bold;">;</span></li><li>					<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span></li><li>						<span style="color: #000000;">&#40;</span>proposedX<span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>proposedY<span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">||</span></li><li>						<span style="color: #000000;">&#40;</span>proposedX<span style="color: #000066; font-weight: bold;">&gt;</span>resX<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>proposedY<span style="color: #000066; font-weight: bold;">&gt;</span>resY<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> </li><li>					<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></li><li>						<span style="color: #009900; font-style: italic;">//trace('skipping land edge');</span></li><li>					<span style="color: #000000;">&#125;</span></li><li>					<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></li><li>						shift_land<span style="color: #000000;">&#40;</span>i<span style="color: #000066; font-weight: bold;">,</span> k<span style="color: #000066; font-weight: bold;">,</span> proposedX<span style="color: #000066; font-weight: bold;">,</span> proposedY<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>					<span style="color: #000000;">&#125;</span></li><li>				<span style="color: #000000;">&#125;</span></li><li>			<span style="color: #000000;">&#125;</span></li><li>		<span style="color: #000000;">&#125;</span></li><li>	<span style="color: #000000;">&#125;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #339966; font-weight: bold;">function</span> shift_land<span style="color: #000000;">&#40;</span>curX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> curY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> checkX<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> checkY<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span></li><li>	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">delta</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curX<span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">-</span> landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkX<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	<span style="color: #004993;">delta</span> <span style="color: #000066; font-weight: bold;">*</span>= <span style="color: #000066; font-weight: bold;">.</span>5<span style="color: #000066; font-weight: bold;">;</span></li><li>	landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>curX<span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">-</span>= <span style="color: #004993;">delta</span><span style="color: #000066; font-weight: bold;">;</span></li><li>	landMap<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkY<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>checkX<span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #004993;">delta</span><span style="color: #000066; font-weight: bold;">;</span></li><li><span style="color: #000000;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #000066; font-weight: bold;">&lt;/</span>minlevel<span style="color: #000066; font-weight: bold;">&gt;&lt;/</span>resy<span style="color: #000066; font-weight: bold;">&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2011/11/3d-land-water-coding-experiment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work Stuff: Motion Graphics for Splash Coupons</title>
		<link>http://blog.MikeRandrup.com/2011/10/work-stuff-motion-graphics-for-splash-coupons/</link>
		<comments>http://blog.MikeRandrup.com/2011/10/work-stuff-motion-graphics-for-splash-coupons/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 16:21:23 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Adobe CS5]]></category>
		<category><![CDATA[Adobe Soundbooth CS5]]></category>
		<category><![CDATA[After Effects CS5]]></category>
		<category><![CDATA[Illustrator CS5]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=505</guid>
		<description><![CDATA[These two videos were created to help the Splash Coupons sales force. The videos were available online, and also on iPads the sales team took to appointments. After Effects was my tool of choice. It was my first project getting to use After Effects after completing training. I&#8217;m looking forward to creating better and better [...]]]></description>
				<content:encoded><![CDATA[<p>These two videos were created to help the Splash Coupons sales force.  The videos were available online, and also on iPads the sales team took to appointments.  After Effects was my tool of choice.  It was my first project getting to use After Effects after completing training.  I&#8217;m looking forward to creating better and better results in future projects.</p>
<p>One feature in these videos is the &#8220;traveling line effect&#8221; in the background of both videos (most visible in 2nd video).  The lines were created in Illustrator using an &#8220;expanded&#8221; &#8220;blend&#8221;.  This was then brought into After Effects, where a 3D camera was attached to a variation of its own path.  After Effects did an amazing job of rendering the vector artwork transformed in 3D space.  The voiceover was edited in Adobe Soundbooth CS5. (I&#8217;ve now upgraded to Adobe Audition as part of Adobe CS5.5).  </p>
<p><em>Credits: Shana Rose (voice performance), Various iStockPhoto.com Photographers, Mike Randrup (all other roles)</em></p>
<p><iframe width="640" height="480" src="http://www.youtube.com/embed/j9XnaqK_98g?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>This was the full product introduction video.  It contains a call-to-action, directing users to an online calendar that was on the original page (but is not on this blog page).</p>
<p>http://www.youtube.com/watch?v=Lsa3y5g-9eU</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2011/10/work-stuff-motion-graphics-for-splash-coupons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work Stuff: Big Brands Poster Design</title>
		<link>http://blog.MikeRandrup.com/2011/10/work-stuff-big-brands-poster-design/</link>
		<comments>http://blog.MikeRandrup.com/2011/10/work-stuff-big-brands-poster-design/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 15:17:17 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Adobe CS5]]></category>
		<category><![CDATA[Illustrator CS5]]></category>
		<category><![CDATA[InDesign CS5]]></category>
		<category><![CDATA[Photoshop CS5]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=454</guid>
		<description><![CDATA[This print project was for www.BargainBanners.com. Over the years, they have printed banners promoting quite a few national brands. The idea for a poster to show the diverse group of companies seemed natural. The first task was gathering logo files. Most of them were possible to take from the original banner artwork, but a few [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://blog.MikeRandrup.com/2011/10/work-stuff-big-brands-poster-design/preview-big-brands-october-2011/" rel="attachment wp-att-455"><img src="http://blog.MikeRandrup.com/wp-content/uploads/2011/10/Preview-Big-Brands-October-2011-640x388.jpg" alt="" title="Big Brands Poster for BargainBanners.com" width="640" height="388" class="alignnone size-large wp-image-455" /></a>This print project was for <a href="http://www.BargainBanners.com">www.BargainBanners.com</a>.  Over the years, they have printed banners promoting quite a few national brands.  The idea for a poster to show the diverse group of companies seemed natural.<br />
The first task was gathering logo files.  Most of them were possible to take from the original banner artwork, but a few needed to be picked up from <a href="http://www.brandsoftheworld.com/">www.BrandsOfTheWorld.com</a> as vector files.  Each logo is superimposed on a small &#8220;virtual banner&#8221;, which I created in Photoshop back in 2008 as part of the BargainBanners.com logo.  The background contains a lovely US Map and &#8220;light steaks&#8221; courtesy of VectorStock.com.  Everything was assembled in InDesign, and output to a PDF for the poster printing.<br />
The finished piece is 4 feet wide by about 3 feet tall, and is now hanging in their banner workshop.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2011/10/work-stuff-big-brands-poster-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work Stuff: Loading Animation for native iPhone App</title>
		<link>http://blog.MikeRandrup.com/2011/10/work-stuff-loading-animation-for-native-iphone-app/</link>
		<comments>http://blog.MikeRandrup.com/2011/10/work-stuff-loading-animation-for-native-iphone-app/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 16:25:04 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[Adobe CS5]]></category>
		<category><![CDATA[After Effects CS5]]></category>
		<category><![CDATA[iOS Development]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=426</guid>
		<description><![CDATA[Earlier this year, I worked on the graphics used in a Native iPhone App (now live on the App Store) for www.SplashCoupons.com. The app lists offers for home improvement savings for people in the North Dallas, Texas area. When the App first launches, it downloads the latest set of coupons from a data server via [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://itunes.apple.com/us/app/splashcoupons/id434254471?mt=8"><img src="http://blog.MikeRandrup.com/wp-content/uploads/2011/10/loading-anim-iphonescreenshot.jpg" alt="" title="Screenshot of loading animation" width="115" height="251" class="alignright size-full wp-image-436" /></a><br />
Earlier this year, I worked on the graphics used in a Native iPhone App (<a href="http://itunes.apple.com/us/app/splashcoupons/id434254471?mt=8">now live on the App Store</a>) for <a href="http://www.SplashCoupons.com">www.SplashCoupons.com</a>.  The app lists offers for home improvement savings for people in the North Dallas, Texas area.  When the App first launches, it downloads the latest set of coupons from a data server via XML.  During this process, which can take a couple of seconds, I wanted to display a visually interesting animation.  So out came the storyboard, and a new After Effects project was born.</p>
<p><a href="http://itunes.apple.com/us/app/splashcoupons/id434254471?mt=8"><img src="http://blog.MikeRandrup.com/wp-content/uploads/2011/10/appstore.gif" alt="" title="See the free App in action on the App Store" width="162" height="56" class="alignleft size-full wp-image-443" /></a>Conceptually, the animation was designed to show a user that &#8220;coupons&#8221; are going &#8220;into their iPhone&#8221;.  The After Effects project was relatively simple.  The coupon image assets I created were animated along paths from off screen into the pulsing iPhone in the middle.  The screen of the iPhone has an AJAX-style busy cursor superimposed on it.  Two layers of After Effects &#8220;Particle Playground&#8221; effects were blending with a glow effect.  Since the particle filter naturally emits from the center outward, I time reversed the particle composition so the particles would flow into the iPhone.  There is a colored glow in the center, and concentric circles pulsing inward.  The last element, &#8220;droplet&#8221; pieces of the Splash Coupons logo, fly outward from the phone.  The color decisions were based on the style guide for the Splash Coupons logo and brand.</p>
<p>The end deliverable for the animation was an 18 frame looping sequence.  It didn&#8217;t take up much memory or room in the IPA file, and loops to run as long as needed.  I also provided several other button graphics for the user interface.</p>
<p>Hopefully it makes for a nicer wait as the XML downloads in the background.  At any rate, it was fun to create.</p>
<p><iframe width="420" height="315" src="http://www.youtube.com/embed/0OWAP2DY5PE?rel=0" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2011/10/work-stuff-loading-animation-for-native-iphone-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lightwave 3D v10: Yay!  I&#8217;ve got new graphic software to create work in&#8230;</title>
		<link>http://blog.MikeRandrup.com/2011/05/lightwave-3d-v10-yay-ive-got-new-graphic-software-to-create-work-in/</link>
		<comments>http://blog.MikeRandrup.com/2011/05/lightwave-3d-v10-yay-ive-got-new-graphic-software-to-create-work-in/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 03:25:52 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=418</guid>
		<description><![CDATA[I have such a back log of finished work this year to post on this blog, and yet haven&#8217;t been making it happen. Just added to the category of work will be 3D rendering using Lightwave. They just came out with version 10, and I did a lot of work with it way back in [...]]]></description>
				<content:encoded><![CDATA[<p>I have such a back log of finished work this year to post on this blog, and yet haven&#8217;t been making it happen.  Just added to the category of work will be 3D rendering using Lightwave.  They just came out with version 10, and I did a lot of work with it way back in the day starting at version 3.5.  So naturally I am blown away by the many new features.</p>
<p>I figure over the next year I can learn and develop some basic 3D skills again.  I have a big monster project in mind.  On a more practical level, this stuff has already come in handy for my work.  We just received back from the printers a brochure with a big 3D illustration of a product name on it.</p>
<p>After installing, I rendered a couple of the example scenes:</p>
<div id="attachment_420" class="wp-caption alignleft" style="width: 330px"><a rel="attachment wp-att-420" href="http://blog.MikeRandrup.com/2011/05/lightwave-3d-v10-yay-ive-got-new-graphic-software-to-create-work-in/blog-lightwave-wolf/"><img class="size-full wp-image-420" title="blog-lightwave-wolf" src="http://blog.MikeRandrup.com/wp-content/uploads/2011/05/blog-lightwave-wolf.jpg" alt="" width="320" height="180" /></a><p class="wp-caption-text">That&#39;s a wolf, with the kind of artificial fur that Pixar made famous with the giant blue monster in Monsters, Inc.  Fun stuff!</p></div>
<div id="attachment_419" class="wp-caption alignleft" style="width: 330px"><a rel="attachment wp-att-419" href="http://blog.MikeRandrup.com/2011/05/lightwave-3d-v10-yay-ive-got-new-graphic-software-to-create-work-in/blog-lightwave-spydercar/"><img class="size-medium wp-image-419" title="blog-lightwave-spydercar" src="http://blog.MikeRandrup.com/wp-content/uploads/2011/05/blog-lightwave-spydercar-320x180.jpg" alt="" width="320" height="180" /></a><p class="wp-caption-text">This example scene that came with the 3D software was very shiny.</p></div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2011/05/lightwave-3d-v10-yay-ive-got-new-graphic-software-to-create-work-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work Stuff: Sales Folder (Print Project)</title>
		<link>http://blog.MikeRandrup.com/2011/04/work-stuff-sales-folder-print-project/</link>
		<comments>http://blog.MikeRandrup.com/2011/04/work-stuff-sales-folder-print-project/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 01:33:41 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Adobe CS5]]></category>
		<category><![CDATA[Illustrator CS5]]></category>
		<category><![CDATA[InDesign CS5]]></category>
		<category><![CDATA[Photoshop CS5]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=366</guid>
		<description><![CDATA[Fun Factoid: Everything in the photo is at half scale, even the tiny 1 inch tall business card. This was a recent project I completed for our sales team at work. It will be a nicely printed folder filled with sales materials (brochures, price sheets, things like that). Tiny Mockup of Dark Version: Tiny Mockup [...]]]></description>
				<content:encoded><![CDATA[<h2>Fun Factoid: Everything in the photo is at half scale, even the tiny 1 inch tall business card.</h2>
<p>This was a recent project I completed for our sales team at work.  It will be a nicely printed folder filled with sales materials (brochures, price sheets, things like that).</p>
<h3>Tiny Mockup of Dark Version:</h3>
<div id="attachment_369" class="wp-caption alignleft" style="width: 330px"><a rel="attachment wp-att-369" href="http://blog.MikeRandrup.com/2011/04/work-stuff-sales-folder-print-project/002-2/"><img class="size-medium wp-image-369" title="Sales Folder Mockup - Black Version - Inside" src="http://blog.MikeRandrup.com/wp-content/uploads/2011/04/002-320x240.jpg" alt="Sales Folder Mockup - Black Version - Inside" width="320" height="240" /></a><p class="wp-caption-text">Sales Folder Mockup - Black Version - Inside</p></div>
<div id="attachment_370" class="wp-caption alignleft" style="width: 190px"><a rel="attachment wp-att-370" href="http://blog.MikeRandrup.com/2011/04/work-stuff-sales-folder-print-project/001-2/"><img class="size-medium wp-image-370" title="Sales Folder Mockup - Black Version - Front" src="http://blog.MikeRandrup.com/wp-content/uploads/2011/04/001-180x240.jpg" alt="Sales Folder Mockup - Black Version - Front" width="180" height="240" /></a><p class="wp-caption-text">Sales Folder Mockup - Black Version - Front</p></div>
<hr style="clear: both;" />
<h3>Tiny Mockup of Light Version:</h3>
<div id="attachment_373" class="wp-caption alignleft" style="width: 190px"><a rel="attachment wp-att-373" href="http://blog.MikeRandrup.com/2011/04/work-stuff-sales-folder-print-project/007-2/"><img class="size-medium wp-image-373" title="Sales Folder Mockup - White Version - Front" src="http://blog.MikeRandrup.com/wp-content/uploads/2011/04/007-180x240.jpg" alt="Sales Folder Mockup - White Version - Front" width="180" height="240" /></a><p class="wp-caption-text">Sales Folder Mockup - White Version - Front</p></div>
<div id="attachment_372" class="wp-caption alignleft" style="width: 330px"><a rel="attachment wp-att-372" href="http://blog.MikeRandrup.com/2011/04/work-stuff-sales-folder-print-project/attachment/008/"><img class="size-medium wp-image-372" title="Sales Folder Mockup - White Version - Inside" src="http://blog.MikeRandrup.com/wp-content/uploads/2011/04/008-320x240.jpg" alt="Sales Folder Mockup - White Version - Inside" width="320" height="240" /></a><p class="wp-caption-text">Sales Folder Mockup - White Version - Inside</p></div>
<hr style="clear: both;" />
<p>In the end, we went with the version over white.  This better matches the other series of collateral items I produced earlier this year (envelope, sales team business cards, a promotional coupon, and notesheet sized letterhead).  Can&#8217;t wait to get them back from the printer next week!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2011/04/work-stuff-sales-folder-print-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We are glad to have great suppliers</title>
		<link>http://blog.MikeRandrup.com/2010/04/well-that-was-a-pretty-good-day/</link>
		<comments>http://blog.MikeRandrup.com/2010/04/well-that-was-a-pretty-good-day/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 03:27:34 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=315</guid>
		<description><![CDATA[Our raw materials supplier, which also has a service and technical support division, happened to request and offer to come by today. The meeting was a great conversation, and we very much enjoyed their insight. We figured out pretty quickly that our sales rep was a great one. And our tech (when we need him [...]]]></description>
				<content:encoded><![CDATA[<p>Our raw materials supplier, which also has a service and technical support division, happened to request and offer to come by today.</p>
<p>The meeting was a great conversation, and we very much enjoyed their insight.  We figured out pretty quickly that our sales rep was a great one.  And our tech (when we need him for advanced service needs) is also very, very good.</p>
<p>What a great day.  We definitely realized that we chose the right major supplier.</p>
<p>Can&#8217;t post our supplier name here unfortunately, but please private message me if you are in the banner printing business and need a suggestion for who to align with.  They provide sign industry inputs (inks, materials, and other such items).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2010/04/well-that-was-a-pretty-good-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maintaining the manufacturing equipment</title>
		<link>http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/</link>
		<comments>http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:36:12 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BargainBanners.com]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=299</guid>
		<description><![CDATA[This is all done on the Mutoh ValueJet 1204AS we use in one of our businesses. The print feed motor failed, and for good measure, we intended to replace the print feed motor&#8217;s encoder (which provides feedback to the machine about the movement the motor generates). So I did all this earlier today, pausing only [...]]]></description>
				<content:encoded><![CDATA[<p>This is all done on the Mutoh ValueJet 1204AS we use in one of our businesses.  The print feed motor failed, and for good measure, we intended to replace the print feed motor&#8217;s encoder (which provides feedback to the machine about the movement the motor generates).</p>

<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/002/' title='The big expensive printer broke down yesterday.  Oh no!'><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/002-150x150.jpg" class="attachment-thumbnail" alt="The big expensive printer broke down yesterday. Oh no!" /></a>
<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/001/' title='But fear not!  The replacement parts were overnighted, and the problem is user serviceable. '><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/001-150x150.jpg" class="attachment-thumbnail" alt="But fear not! The replacement parts were overnighted, and the problem is user serviceable." /></a>
<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/031/' title='Here is a mugshot of the culprit: the &quot;Print Feed Motor&quot;'><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/031-150x150.jpg" class="attachment-thumbnail" alt="Here is a mugshot of the culprit: the &quot;Print Feed Motor&quot;" /></a>
<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/028/' title='The old motor is removed, and fortunately the new one looks just like it.'><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/028-e1270843616103-150x150.jpg" class="attachment-thumbnail" alt="The old motor is removed, and fortunately the new one looks just like it." /></a>
<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/018/' title='There is a related part (called an &quot;encoder&quot;) that also should be replaced.  But they sent us the wrong part and it won&#039;t fit!'><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/018-150x150.jpg" class="attachment-thumbnail" alt="There is a related part (called an &quot;encoder&quot;) that also should be replaced. But they sent us the wrong part and it won&#039;t fit!" /></a>
<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/045/' title='Since our supplier sent us the wrong &quot;encoder&quot; wheel for our machine, we had to clean up the old one and hope for the best.  That&#039;s a combo of ink powder and pulverized rubber from a motor belt near it in the machine.'><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/045-150x150.jpg" class="attachment-thumbnail" alt="Since our supplier sent us the wrong &quot;encoder&quot; wheel for our machine, we had to clean up the old one and hope for the best. That&#039;s a combo of ink powder and pulverized rubber from a motor belt near it in the machine." /></a>
<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/015/' title='The new print feed motor is installed!'><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/015-150x150.jpg" class="attachment-thumbnail" alt="The new print feed motor is installed!" /></a>
<a href='http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/attachment/007/' title='Everything is installed back and working great!  The print jobs continue.'><img width="150" height="150" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/007-150x150.jpg" class="attachment-thumbnail" alt="Everything is installed back and working great! The print jobs continue." /></a>

<p>So I did all this earlier today, pausing only to shoot pictures for the blog (and just in case I had to show a real technician what I had done to it later).  Naturally this is pretty scary because the machine way expensive to repair or replace.  But it went really well.</p>
<p>Next I plan to try some home surgery.  There&#8217;s a kit for that called &#8220;Suture Self&#8221;.  (thanks to my dad for telling me that joke when I was a kid)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2010/04/mutoh-valuejet-repair/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It was the extra &#8220;space&#8221; that killed it.</title>
		<link>http://blog.MikeRandrup.com/2010/04/it-was-the-extra-space-that-killed-it/</link>
		<comments>http://blog.MikeRandrup.com/2010/04/it-was-the-extra-space-that-killed-it/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 20:50:48 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MetroplexWeb.com]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=293</guid>
		<description><![CDATA[Just finished troubleshooting a bug in a customer system. It&#8217;s a piece of custom software, run from a website, and written in PHP. This software collects orders from customers online, and transfers them into QuickBooks via a custom XML service and the QuickBooks Web Connector. And the other day, after a simple update, it stopped [...]]]></description>
				<content:encoded><![CDATA[<p>Just finished troubleshooting a bug in a customer system.   It&#8217;s a piece of <a href="http://www.metroplexweb.com/reduce-costs/">custom software</a>, run from a website, and written in PHP.  This software collects orders from customers online, and transfers them into QuickBooks via a custom XML service and the <a href="http://marketplace.intuit.com/webconnector/">QuickBooks Web Connector</a>.  And the other day, after a simple update, it stopped working.</p>
<p>Guess what the problem was?  Heinous code changes?  Chinese hackers?  Faulty QuickBooks update?  Nope.  It was a single &#8221; &#8221; (space) character.</p>
<p>Several functions of the system require that absolutely no output be sent to the browser screen for various redirect functions, especially surrounding SSL and initiating a SOAP session with QuickBooks.  Well, the extra character had been accidentally typed into the visible part of a PHP script file filled with common functions.</p>
<p>I finally found what the problem was after pulling the backup version of the recently changed file out of our <a href="http://aws.amazon.com/s3/">Amazon S3</a> cloud backups (performed via <a href="http://www.jungledisk.com/business/server/features/">JungleDisk</a> automatically on our affected server at <a href="http://www.theplanet.com/data-centers/">The Planet</a>).  Restoring the old version of the file fixed the problem, so I used Komodo code editor to compare the files (results attached).</p>
<p>It turned out that there was an extra &#8221; &#8221; (space) at the end of the file that got sent to the screen too early.  And the browser got really confused about the content of the page as a result.</p>
<p>Just more evidence of the complex nature of  these systems that make the web go round.  Good thing we have solid processes for tracking and fixing!  Yay for automatic backups into the cloud.</p>
<p><a rel="attachment wp-att-295" href="http://blog.MikeRandrup.com/2010/04/it-was-the-extra-space-that-killed-it/it-was-the-space/"><img class="alignnone size-full wp-image-295" title="it-was-the-space" src="http://blog.MikeRandrup.com/wp-content/uploads/2010/04/it-was-the-space.jpg" alt="" width="514" height="188" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2010/04/it-was-the-extra-space-that-killed-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Difficult Day in Non-Profit Land</title>
		<link>http://blog.MikeRandrup.com/2009/05/a-difficult-day-in-non-profit-land/</link>
		<comments>http://blog.MikeRandrup.com/2009/05/a-difficult-day-in-non-profit-land/#comments</comments>
		<pubDate>Sun, 24 May 2009 00:48:07 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=253</guid>
		<description><![CDATA[The local environmental non-profit group I&#8217;m involved with had a significant event happen in its history today. Due to a variety of factors (primarily budget shortfall issues), the board today voted to become an all-volunteer organization effective at the end of June 2009. This is a huge change: the original founder had been a full-time, [...]]]></description>
				<content:encoded><![CDATA[<p>The local environmental non-profit group I&#8217;m involved with had a significant event happen in its history today.  Due to a variety of factors (primarily budget shortfall issues), the board today voted to become an all-volunteer organization effective at the end of June 2009.  This is a huge change: the original founder had been a full-time, paid contractor prior to this point.  No longer will this be the case, and the process of creating this change is a major one that has big consequences for the founder.  No one likes to change jobs, even if their paycheck was sporadic at best.  No one likes to release the reins of their own creation.</p>
<p>Our board has bitten off a huge responsibility to ensure that the organization continues to fulfill its mission, and to properly honor the contributions, vision, and work of our founder.</p>
<p>Let&#8217;s just say that it all made for a pretty heavy board meeting.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2009/05/a-difficult-day-in-non-profit-land/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turning Desktop Wallpaper into Real Wallpaper</title>
		<link>http://blog.MikeRandrup.com/2009/04/turning-desktop-wallpaper-into-real-wallpaper/</link>
		<comments>http://blog.MikeRandrup.com/2009/04/turning-desktop-wallpaper-into-real-wallpaper/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 19:33:49 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[homeownership]]></category>
		<category><![CDATA[ideas]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=214</guid>
		<description><![CDATA[For this project, I picked an area up my upstairs office that was nestled between some built in shelves and cabinets on one wall. It measured 48 inches wide by 33 inchess tall. Next I went to my favorite free high resolution desktop wallpaper sites, and looked for something that I wanted to see on [...]]]></description>
				<content:encoded><![CDATA[<p><img style="-webkit-user-select: none" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/1-full-size-wall-print-bare-wall-150x150.jpg" alt="" /> <img style="-webkit-user-select: none;" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/2-full-size-wall-print-installed-no-trim-150x150.jpg" alt="" /> <img style="-webkit-user-select: none;" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/0-full-size-wall-print-end-result-150x150.jpg" alt="" /></p>
<p>For this project, I picked an area up my upstairs office that was nestled between some built in shelves and cabinets on one wall.  It measured 48 inches wide by 33 inchess tall.</p>
<p><img style="-webkit-user-select: none;" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/1-full-size-wall-print-bare-wall-320x240.jpg" alt="" /></p>
<p>Next I went to my <a href="http://www.hdrwalls.com/categories.php?id=2">favorite free high resolution desktop</a> <a href="http://www.google.com/search?hl=en&amp;rlz=1C1GGLS_en-USUS299US303&amp;q=desktop+wallpaper+1680&amp;btnG=Search">wallpaper sites</a>, and looked for something that I wanted to see on my wall.  I wanted to find something that included obvious perspective cues to give the illusion of depth, and seemed to have a light source in the middle of the picture where my lamp was going to be shining from.  I <a href="http://www.hdrwalls.com/comments.php?id=372">picked this one </a>without over-thinking it too much for the purposes of the experiment.  Many others would have worked, and been much more interesting.  I downloaded it at the highest resolution offered (2,560 x 1,600 pixels).</p>
<p><img style="-webkit-user-select: none;" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/butler_at_library_columbia_university_800x600-320x240.jpg" alt="" /></p>
<p>In order to know how my photo would look, I divided the number of pixels I had wide by inches wide (2,560 pixels/48 inches) = 53 DPI (dots per inch).  For a section of wall that people will be at least 1-3 feet away from, 50 DPI is fine.  100 DPI is good if people will get less than a foot away at eye level to your wall.  This requires less DPI than other printing applications in order  to look good from the distance a viewer sees it.</p>
<p>Next I went to an online printing place to have it printed large.  <a href="http://www.bargainbanners.com/product_info.php?cPath=22&amp;products_id=28">I went to BargainBanners.com, (my employer), here</a>.   My wallpaper printout arrived well within a week.</p>
<p><img style="-webkit-user-select: none;" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/2-full-size-wall-print-installed-no-trim-320x240.jpg" alt="" /></p>
<p>When it arrived, I thumb-tacked it to the wall under where the trim was attached.</p>
<p><img style="-webkit-user-select: none;" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/3-full-size-wall-print-lighting-matches-photo-320x240.jpg" alt="" /></p>
<p>Since there is a lamp that goes on that part of the shelf, I set it up without its shade to preview how the room&#8217;s real lighting would work with the image.  Looks like the bulb is practically part of the sky.  Exactly the effect I was hoping for.</p>
<p><img style="-webkit-user-select: none;" src="http://blog.mikerandrup.com/wp-content/uploads/2009/04/0-full-size-wall-print-end-result-640x457.jpg" alt="" /></p>
<p>Wood trim, lampshade, and various office junk put back into place.  I&#8217;m pretty happy with how it turned out for a first try.  What does everyone else think?  I have more complicated wood paneling elsewhere in the house.  I was thinking of trying something more complex, with a more meaningful image, in the future.</p>
<p>Regarding the copyright of the image, that part is sticky.  I believe it would be a better practice to surf on over to iStockPhoto.com to buy the proper rights to an image they have for $5-$12.  Better yet, if you have a camera with a lot of megapixels, you can print directly from your photographs, which you already own.  My employer sees a lot of this for beautiful engagement photos on huge display at the wedding reception.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2009/04/turning-desktop-wallpaper-into-real-wallpaper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>They didn&#8217;t taste very good, so diplomacy was the *only* option.</title>
		<link>http://blog.MikeRandrup.com/2008/10/they-didnt-taste-very-good-so-diplomacy-was-the-only-option/</link>
		<comments>http://blog.MikeRandrup.com/2008/10/they-didnt-taste-very-good-so-diplomacy-was-the-only-option/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 12:13:11 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[cool technologies]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=115</guid>
		<description><![CDATA[I&#8217;m sure we&#8217;ve all heard quite a bit about Electronic Art&#8217;s new game called SPORE. It allows you to design a creature and develop it over time. You begin as a simple critter swimming around in water, grow onto land and into tribes, and eventually even become a space-faring civilization that travels the galaxy. All [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://blog.mikerandrup.com/wp-content/uploads/2008/10/croctaw.jpg" alt="Mike's SPORE creation: The Croctaw" align="right" border="0"/>I&#8217;m sure we&#8217;ve all heard quite a bit about Electronic Art&#8217;s new game called SPORE.</p>
<p>It allows you to design a creature and develop it over time.  You begin as a simple critter swimming around in water, grow onto land and into tribes, and eventually even become a space-faring civilization that travels the galaxy.</p>
<p>All the while you make choices about your creature&#8217;s disposition.  My creature, the &#8216;Croctaw&#8217; (pictured), is a hyper-aggressive, hyper-carnivore, war-mongering species that normally devours all other species that get in its way.  It was a survival strategy that worked.</p>
<p>Except for once, that is.  And the situation called for something drastic and different for dealing with the neighboring creature.  You see, they didn&#8217;t taste very good, so diplomacy was the only option (unpleasant of an option as it was).</p>
<p>At least the other 99% of the creatures my Croctaw empire have encountered are quite delicious.  Plus, I&#8217;m sure the Croctaw themselves (being some combination of crawdad, lobster, and crocodile) are probably quite delicious.  Lucky for them that they are the dominant species.</p>
<p>SPORE has been fun, and now the Croctaw have been flying around the galaxy conquering all.  The game is definitely worth trying.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2008/10/they-didnt-taste-very-good-so-diplomacy-was-the-only-option/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reconciling 21 months of old personal bank statements?</title>
		<link>http://blog.MikeRandrup.com/2008/07/reconciling-21-months-of-old-personal-bank-statements/</link>
		<comments>http://blog.MikeRandrup.com/2008/07/reconciling-21-months-of-old-personal-bank-statements/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 17:26:32 +0000</pubDate>
		<dc:creator>mikerandrup</dc:creator>
				<category><![CDATA[personal finance]]></category>

		<guid isPermaLink="false">http://blog.MikeRandrup.com/?p=19</guid>
		<description><![CDATA[Checking line by line through 80 pages of old bank statements might not sound like fun. Well, it basically isn&#8217;t (though I don&#8217;t really mind). Recently I just finished up a personal project to get the period of time between Jan 2006 and Sep 2007 completely reconciled in my personal books. There were about 1,600 [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://bp2.blogger.com/_3LpV7ETzEuw/SI3jBHmjupI/AAAAAAAAAD0/8ESdd1KZTRI/s1600-h/bank+statements.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img id="BLOGGER_PHOTO_ID_5228084350807161490" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://bp2.blogger.com/_3LpV7ETzEuw/SI3jBHmjupI/AAAAAAAAAD0/8ESdd1KZTRI/s320/bank+statements.jpg" border="0" alt="" /> </a><br />
Checking line by line through 80 pages of old bank statements might not sound like fun. Well, it basically isn&#8217;t (though I don&#8217;t really mind).</p>
<p>Recently I just finished up a personal project to get the period of time between Jan 2006 and Sep 2007 completely reconciled in my personal books. There were about 1,600 transactions to individually verify.</p>
<p>Once I had eliminated about a dozen small transactions (recording $20 of money spent twice, etc) that didn&#8217;t belong on my side, something interesting showed up.</p>
<p>It looks like there was a bank error that had been hidden by my own small errors. The reconciled balance from Oct 2007 through the present had always been within a small margin of where it was supposed to be. Once the little duplicate transactions were stripped out, a $500 bank error became obvious.</p>
<p>So in exchange for the mind numbing work, it looks like the process will net $500 in adjustments that I wouldn&#8217;t have noticed otherwise. It had always bothered me a little that I hadn&#8217;t ever reconciled these ancient personal bank statements, and I finally did it, and it looks like there&#8217;ll even be a payoff.</p>
<p>Just thought I&#8217;d share.  And now I&#8217;d better go something completely non-bookkeeping related before I get too many funny looks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.MikeRandrup.com/2008/07/reconciling-21-months-of-old-personal-bank-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
