<?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>Computational Artwork &#187; cloud</title>
	<atom:link href="http://matthewbrown.net.au/tag/cloud/feed/" rel="self" type="application/rss+xml" />
	<link>http://matthewbrown.net.au</link>
	<description>by Matthew Brown</description>
	<lastBuildDate>Sun, 20 Jun 2010 02:37:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Recursively Generated Clouds &#8211; Continued</title>
		<link>http://matthewbrown.net.au/programming/recursively-generated-clouds-continued/</link>
		<comments>http://matthewbrown.net.au/programming/recursively-generated-clouds-continued/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 11:21:03 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[frameRate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[recursion]]></category>

		<guid isPermaLink="false">http://matthewbrown.net.au/programming/recursively-generated-clouds-continued/</guid>
		<description><![CDATA[Continuing on from the clouds I had generated earlier, I thought it would be pretty cool if I could get it to move and appear to grow. Unfortunately, I haven&#8217;t been able to make it do that yet. I have however, gotten it to generate random cloud combinations and position them randomly on the canvas [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing on from the <a href="http://matthewbrown.net.au/programming/recursively-generated-clouds/" title="Recursively generated clouds">clouds I had generated earlier</a>, I thought it would be pretty cool if I could get it to move and appear to grow.</p>
<p>Unfortunately, I haven&#8217;t been able to make it do that yet. I have however, gotten it to generate random cloud combinations and position them randomly on the canvas with semi-random colours based around reds, yellows and oranges.</p>
<p>It is available <a href="http://matthewbrown.net.au/uploads/processing/mushroom_cloud_moving/" title="Recursively generated moving clouds">online here</a>.</p>
<p><span id="more-32"></span><br />
I have added a stroke(1) command to the draw function, every time it redraws the clouds, it will add a stroke around each circle, this gives it a very cartoony look. I have commented this out as it slows down the rendering, but switching it back on is very easy by removing the //.</p>
<p>Changing the value of the level has a significant impact on the render times, increasing it slows it down, decreasing it speeds u the render. On my computer, 5 seems to be ideal, anything higher and the interval between each cloud that is generated becomes uneven. Anything lower and the density of the clouds starts to drop and it loses some of the effect.</p>
<pre class="brush: java;"> }
void setup()
{
  size(500, 500);
  noStroke();
  smooth();
  frameRate(50);
}

void draw()
{
  // uncommenting the below creates a very cartoony effect
  // stroke(1);
  drawCircle(random(500), random(500), random(170), 5);
}

void drawCircle(float x, float y, float radius, float level)
{
  float r = 126 * level/4.0;
  float g = random(80);
  float b = random(60);
  fill(r, g, b);
  ellipse(x, y, radius*2, radius*2);
  if(level &gt; 1) {
    level = level - 0.5;
    int num = int(random(2, 6));
    for(int i=0; i&lt;num; i++) {
      float a = random(0, TWO_PI);
      float nx = x + sin(a) * 6.0 * level;
      float ny = y + radius/2;
      drawCircle(nx, ny, radius/2, level);
    }
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://matthewbrown.net.au/programming/recursively-generated-clouds-continued/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursively Generated Clouds</title>
		<link>http://matthewbrown.net.au/programming/recursively-generated-clouds/</link>
		<comments>http://matthewbrown.net.au/programming/recursively-generated-clouds/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 06:01:22 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[circle]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[recursion]]></category>

		<guid isPermaLink="false">http://matthewbrown.net.au/programming/recursively-generated-clouds/</guid>
		<description><![CDATA[I have been having a look at using recursion in Processing to tile things, however, I got a little bit sidetracked. Going through the online learning basics, there are two recursion examples, &#8220;Recursion&#8221; and &#8220;Recursion 2&#8220;. In the first of these, recursion is used to have a circle repeat itself twice at half the original [...]]]></description>
			<content:encoded><![CDATA[<p>I have been having a look at using recursion in Processing to tile things, however, I got a little bit sidetracked.</p>
<p>Going through the <a href="http://processing.org/learning/basics/" title="Processing Learning Basics">online learning basics</a>, there are two recursion examples, &#8220;<a href="http://processing.org/learning/basics/recursion.html" title="Recursion example 1">Recursion</a>&#8221; and &#8220;<a href="http://processing.org/learning/basics/recursion2.html" title="Recursion example 2">Recursion 2</a>&#8220;. In the first of these, recursion is used to have a circle repeat itself twice at half the original size inside itself, and continue doing this with each smaller circle until the level is no longer greater than 1. The level is basically the amount of times the function will call itself.</p>
<p>The second of these examples builds on the first, but instead of repeating the circle&#8217;s inside themselves, it generates random sizes and shades of circles in semi-random x and y co-ordinates around the main circle until the level is no longer greater than 1. The level again basically being how many times the function calls itself.</p>
<p>Experimenting with these two recursive functions, I combined the two to create a cartoonish cloud that slightly resembles a mushroom cloud which can be found <a href="http://matthewbrown.net.au/uploads/processing/mushroom_cloud/" title="Recursively generated mushroom cloud">online here</a>.</p>
<p><span id="more-31"></span><br />
What I have done, is I have taken the second recursive example, and then changed the way it positions the circles along the y axis to be the same as the first recursive example. Thus the circles are all on the same level and appear to be getting bigger, though they are actually getting smaller.</p>
<p>Because I have kept the way the second example generates the circles, there are heaps of circles overlapping each other that weren&#8217;t before, creating a more cloud-like appearance.</p>
<pre class="brush: java;">
void setup()
{
size(500, 500);
noStroke();
smooth();
noLoop();
}

void draw()
{
drawCircle(250, 200, 170, 6);
}

void drawCircle(float x, float y, int radius, float level)
{
float tt = 126 * level/4.0;
fill(tt, 153);
ellipse(x, y, radius*2, radius*2);
if(level &gt; 1) {
level = level - 0.5;
int num = int(random(2, 6));
for(int i=0; i&lt;num;&gt;
float a = random(0, TWO_PI);
float nx = x + sin(a) * 6.0 * level;
float ny = y + radius/2;
drawCircle(nx, ny, radius/2, level);
}
}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://matthewbrown.net.au/programming/recursively-generated-clouds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

