<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>toxiclibs</title>
	
	<link>http://toxiclibs.org</link>
	<description>Building blocks for computational design</description>
	<lastBuildDate>Tue, 22 Jun 2010 14:58:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/toxiclibs" /><feedburner:info uri="toxiclibs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Olhares de Processing: Porto workshop</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/gmPG1oWr6Cw/</link>
		<comments>http://toxiclibs.org/2010/06/olhares-de-processing-porto-workshop/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 16:14:04 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://toxiclibs.org/?p=336</guid>
		<description><![CDATA[Before it gets too quiet here (sorry about that recent work &#38; travel-induced hiatus, there&#8217;re loads of updates coming), I&#8217;m super happy to announce details of the next workshop related to this project, incl. a preliminary outline/focus topics for us to get our teeth into. This upcoming workshop is entitled Olhares de Processing (Glimpses of [...]]]></description>
			<content:encoded><![CDATA[<p>Before it gets too quiet here (sorry about that recent work &amp; travel-induced hiatus, there&#8217;re <strong>loads</strong> of updates coming), I&#8217;m super happy to announce details of the next workshop related to this project, incl. a preliminary outline/focus topics for us to get our teeth into. This upcoming workshop is entitled <a href="http://bit.ly/olharesdeprocessing" onclick="pageTracker._trackPageview('/outgoing/bit.ly/olharesdeprocessing?referer=');">Olhares de Processing</a> (Glimpses of Processing) and will take place at the <a href="http://artes.ucp.pt/en/" onclick="pageTracker._trackPageview('/outgoing/artes.ucp.pt/en/?referer=');">School of Arts @ Universidade Católica Portuguesa Porto</a> in conjunction with the <a href="http://olhares-outono.ucp.pt" onclick="pageTracker._trackPageview('/outgoing/olhares-outono.ucp.pt?referer=');">Festival de Artes Digitais Olhares de Outono</a>.</p>
<p>Mark these dates in your calendar: <strong>July 12-18th 2010</strong> &#8211; It&#8217;s going to be a whole 7 long days of code crafting in the north of Portugal and I&#8217;m looking very forward to it! The workshop is limited to 14 participants. Bookings are handled by the University and should be done via their <a href="http://bit.ly/olharesdeprocessing" onclick="pageTracker._trackPageview('/outgoing/bit.ly/olharesdeprocessing?referer=');">special website</a>. Thank you dearly!</p>
<p>The planned outline is below the poster I made for this unique occasion, so please do read on:</p>
<p><img class="alignnone size-full wp-image-345" title="olhares_poster_a0" src="http://toxiclibs.org/wp-content/uploads/2010/06/olhares_poster_a0.jpg" alt="Workshop poster" width="680" height="920" /></p>
<p>The general idea is to split our time into 4 days of intense tutorials and hands-on examination of core principles &amp; techniques of the computational design approach in the context of creating &#8220;generative identities&#8221;, without prescribing too much what shape &amp; form these should take. Part of our workshop&#8217;s remit is also to enquire the current possibilities. The final 3 days will then be used to build your own project(s) to be use for the Olhares de Outono festival later in November.</p>
<p>The topics listed below are not set in stone and we&#8217;ll decide as group on what to focus (much depends on the skills &amp; interests of the participants). Similarly, if you&#8217;d like to experiment/include external devices into your project (Wiimote, Arduino), please bring them along. The workshop space is equipped with iMacs, but there&#8217;re also a couple of spaces to use your own machine as well&#8230; At the end of the workshop, we all should have at least one completed (if not polished) project for the festival, and should strive to document it (the project) too.</p>
<h3>Day 1: Getting ready</h3>
<h4 id="Processing">Processing</h4>
<ul>
<li>recap of basics
<ul>
<li>types</li>
<li>structures</li>
<li>working with libraries</li>
<li>exporting</li>
</ul>
</li>
</ul>
<ul>
<li>scope
<ul>
<li>learning curve</li>
<li>use as environment (PDE)</li>
<li>use online vs. offline</li>
<li>use as library in larger frameworks</li>
<li>P5 within the bigger picture
<ul>
<li>JavaScript</li>
<li>Java (Android)</li>
<li>OpenFrameworks</li>
<li>Cinder</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4 id="Toxiclibs">Toxiclibs</h4>
<ul>
<li>Overview</li>
<li>Recent updates</li>
<li>Philosophy</li>
<li>Resources</li>
<li>Use cases</li>
<li>Exercises
<ul>
<li>Key techniques/classes</li>
<li>Layering processes/Combining modules</li>
<li>Easier handling in Processing</li>
</ul>
</li>
</ul>
<h4 id="OOP">OOP</h4>
<ul>
<li>Concepts
<ul>
<li>Interfaces</li>
<li>Inheritance</li>
<li>Polymorphism</li>
<li>Encapsulation</li>
</ul>
</li>
</ul>
<ul>
<li>Best practices
<ul>
<li>Events</li>
<li>Architecture</li>
<li>Design patterns</li>
<li>Anti patterns</li>
<li>Reusability</li>
<li>Open source</li>
</ul>
</li>
</ul>
<h4 id="Eclipse">Eclipse</h4>
<ul>
<li>overview</li>
<li>project setup</li>
<li>using Processing as lib only</li>
<li>editor features
<ul>
<li>code completion</li>
<li>navigation</li>
<li>refactoring</li>
</ul>
</li>
</ul>
<h3 id="Day2Workingwithdata">Day 2: Working with data</h3>
<h4 id="datamodellingprocessing">Data modelling/processing</h4>
<ul>
<li>Collections
<ul>
<li>Hashmaps
<ul>
<li>Histograms:
<ul>
<li>Images, FFT</li>
<li>Tag clouds</li>
</ul>
</li>
</ul>
</li>
<li>Lists
<ul>
<li>Iterators</li>
</ul>
</li>
<li>Queues
<ul>
<li>Priority based processing</li>
<li>Pipes</li>
<li>Stacks</li>
</ul>
</li>
<li>Trees
<ul>
<li>recursion</li>
<li>sorted sets using comparators
<ul>
<li>sort by custom criteria</li>
<li>spatial subdivision (quadtree, octree etc.)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li>XML
<ul>
<li>standard formats
<ul>
<li>Atom</li>
<li>RSS</li>
</ul>
</li>
<li>code generation from data model
<ul>
<li>XML Schema</li>
<li>JAXB</li>
</ul>
</li>
<li>Defining your own formats
<ul>
<li>Loading/saving app state</li>
<li>Presets</li>
<li>Configuration</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li>
<ul>
<li>Aggregation
<ul>
<li>merging of sources and/or time samples</li>
<li>set theory
<ul>
<li>union</li>
<li>intersection</li>
<li>difference</li>
<li>relationships (1:1, 1:N, N:M)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4 id="Visualisation">Visualisation</h4>
<ul>
<li>basic graph theory</li>
<li>finding &amp; creating metaphors</li>
<li>techniques
<ul>
<li>geometry basics</li>
<li>coordinate systems
<ul>
<li>spherical (Geomapping example)</li>
<li>polar (color transforms)</li>
<li>cartesian</li>
</ul>
</li>
<li>vector maths</li>
<li>mapping/geometric transformations
<ul>
<li>M-&gt;N dimensions</li>
<li>time -&gt; space</li>
</ul>
</li>
<li>mesh generation</li>
</ul>
</li>
<li>animation
<ul>
<li>interpolation curves</li>
<li>state transitions</li>
<li>viewport changes
<ul>
<li>transformation matrix</li>
<li>camera control (e.g. 3rd person camera)</li>
</ul>
</li>
</ul>
</li>
<li>exporting data
<ul>
<li>high res bitmap</li>
<li>PDF</li>
<li>image sequence + automatic FFMPEG assembly</li>
<li>3D data for digital fabrication</li>
</ul>
</li>
</ul>
<h3 id="Day3Interactions">Day 3: Interactions</h3>
<p>Building on previous day exercises</p>
<h4 id="HCI">HCI</h4>
<ul>
<li>Wiimote</li>
<li>Mobile</li>
<li>Computer vision</li>
<li>TUIO / OSC
<ul>
<li>
<ul>
<li>multitouch</li>
<li>reacTIVision</li>
<li>external devices</li>
</ul>
</li>
</ul>
</li>
<li>QRCodes</li>
<li>Location triggers
<ul>
<li>GPS/compass based AR</li>
</ul>
</li>
<li>Serial input
<ul>
<li>Firmata</li>
</ul>
</li>
</ul>
<h4 id="Machinemachineinteractions">Machine-machine interactions</h4>
<ul>
<li>asynchronous event handling
<ul>
<li>twitter updates</li>
<li>reacting to Pachube sensor data</li>
</ul>
</li>
<li>multi-threading</li>
<li>network communications/protocols
<ul>
<li>UDP</li>
<li>OSC</li>
</ul>
</li>
</ul>
<h3 id="Day4Generativetechniques">Day 4: Generative techniques</h3>
<p>Building on previous day exercises</p>
<h4 id="Processesasdesigntools">Processes as design tools</h4>
<ul>
<li>inputs
<ul>
<li>observation</li>
<li>abstraction</li>
<li>mental model building</li>
</ul>
</li>
<li>behaviour
<ul>
<li>parametrization</li>
<li>rules</li>
<li>feedback</li>
</ul>
</li>
<li>simulation
<ul>
<li>agents</li>
<li>automata</li>
<li>erosion</li>
<li>fluids</li>
<li>particles</li>
<li>physics</li>
</ul>
</li>
<li>randomness
<ul>
<li>balance of control</li>
<li>bias</li>
<li>chaos vs. determinism</li>
<li>role of authorship?</li>
<li>techniques &amp; differences</li>
</ul>
</li>
</ul>
<h3 id="Day57Workonownprojects">Day 5-7: Work on own projects</h3>
<h4>Process</h4>
<ul>
<li>If possible form pairs/groups</li>
<li>2 reviews/status reports/discussion per day with all<br />
participants</li>
<li>Karsten giving help &amp; support to all groups</li>
<li>Final review and presentation on Sunday PM</li>
<li>Project documentations</li>
</ul>
<p>And once again, please head over to <a href="http://bit.ly/olharesdeprocessing" onclick="pageTracker._trackPageview('/outgoing/bit.ly/olharesdeprocessing?referer=');">this site</a> for further organisational things &amp; the signup form&#8230;</p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/gmPG1oWr6Cw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/06/olhares-de-processing-porto-workshop/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/06/olhares-de-processing-porto-workshop/</feedburner:origLink></item>
		<item>
		<title>Processing Paris workshop</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/gEOlH42lx7c/</link>
		<comments>http://toxiclibs.org/2010/04/processing-paris-workshop/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 01:44:33 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://toxiclibs.org/?p=306</guid>
		<description><![CDATA[After several earlier announcements on Twitter &#38; the Processing forums, here&#8217;s another (last) call for people who&#8217;d still like to be part of this (at the time of writing less than 5 places are left): On April 23 &#38; 24, 2010 I&#8217;ll be teaching an advanced Processing, Eclipse &#38; toxiclibs workshop as part of the [...]]]></description>
			<content:encoded><![CDATA[<p>After several earlier announcements on <a href="http://twitter.com/processingparis" onclick="pageTracker._trackPageview('/outgoing/twitter.com/processingparis?referer=');">Twitter</a> &amp; the <a href="http://processing.org/discourse/yabb2/YaBB.pl?num=1267779630" onclick="pageTracker._trackPageview('/outgoing/processing.org/discourse/yabb2/YaBB.pl?num=1267779630&amp;referer=');">Processing forums</a>, here&#8217;s another (last) call for people who&#8217;d still like to be part of this (at the time of writing less than 5 places are left):</p>
<p>On April 23 &amp; 24, 2010 I&#8217;ll be teaching an advanced Processing, Eclipse &amp; toxiclibs workshop as part of the <a href="http://processingparis.ning.com" onclick="pageTracker._trackPageview('/outgoing/processingparis.ning.com?referer=');">Processing Paris</a> activities organized by the talented <a href="http://cargocollective.com/mwebster" onclick="pageTracker._trackPageview('/outgoing/cargocollective.com/mwebster?referer=');">Mr. Webster</a> &amp; David Abouna-Tomé from <a href="http://offf.ws" onclick="pageTracker._trackPageview('/outgoing/offf.ws?referer=');">OFFF</a>.</p>
<p><a href="http://www.flickr.com/photos/toxi/4516505474" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4516505474?referer=');"><img class="aligncenter size-large wp-image-309" title="the memory tree (sketch)" src="http://toxiclibs.org/wp-content/uploads/2010/04/tree-1271117113-680x382.png" alt="" width="680" height="382" /></a></p>
<h2>The Memory Tree</h2>
<p>During the 2 days of the <a href="http://processingparis.ning.com/profiles/blogs/atelier-advanced-content" onclick="pageTracker._trackPageview('/outgoing/processingparis.ning.com/profiles/blogs/atelier-advanced-content?referer=');">advanced Processing Paris workshop</a> we will create an interactive installation called The Memory Tree. The installation will consist of a large projection of a generative, slowly growing 3D tree whose leaves are all made up from messages/thoughts left by visitors and workshop participants.</p>
<p>These messages can either be submitted as voice via mobile phones, Skype or IM, but will also be harvested automatically via tagged content from Flickr and Twitter. The tree will grow and become more complex with every new message collected and so slowly form a browsable history of its creation during the workshop, but also document the reactions of exhibition visitors. Visitors can interact with the installation via a mouse (or Wiimote, if we&#8217;re quick&#8230;) to change the view of the tree, zoom in, and focus particular messages/images or play recorded voice messages. There could also be a mode where the user directs a &#8220;cursor&#8221; freely between the various tree branches and listens to all voice messages associated with leaves in the cursor&#8217;s proximity. This playback would use 3D audio so that when the focal point is moved, the recorded voices move around in space accordingly and are creating an immersive audio collage. Voices closer to the cursor will play louder than ones further away.</p>
<p>The installation concept will nicely combine a number of different concepts, technologies and programming techniques. It&#8217;ll also educate participants about the distributed nature of technologies available and the importance of open standards acting as technological glue between them.</p>
<p><a href="http://www.flickr.com/photos/toxi/4515869669" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4515869669?referer=');"><img class="aligncenter size-large wp-image-311" title="The Memory Tree (sketch)" src="http://toxiclibs.org/wp-content/uploads/2010/04/tree-1271117014-680x382.png" alt="" width="680" height="382" /></a></p>
<h2>Scope</h2>
<p>Amongst other things, we will cover:</p>
<ul>
<li>core 3D geometry techniques: vectors, matrices, quaternions, cameras, curves, texture mapping</li>
<li>complex mesh creation with volumetric modelling</li>
<li>working with OpenGL</li>
<li>dealing with parallel processes using multi-threading</li>
<li>working with 3rd party libraries (mainly from toxiclibs.org)</li>
<li>multi-channel audio playback</li>
<li>working with XML efficiently (using JAXB)</li>
<li>parsing RSS/Atom feeds (Flickr, Twitter integration)</li>
<li>working with (and creating) REST based web services</li>
<li>designing an application data model</li>
<li>object oriented architecture as key enabler for flexible designs</li>
</ul>
<p>The installation will be obviously using Processing as core platform, however we will use <a href="http://eclipse.org" onclick="pageTracker._trackPageview('/outgoing/eclipse.org?referer=');">Eclipse</a> as development environment to make development faster, easier and more efficient. Participants should have a medium/firm grasp of Processing and feel comfortable with experimenting with new concepts &amp; techniques with a looming deadline.</p>
<p>If you want to sign up for this, please head over to: <a href="http://processingparis.ning.com" onclick="pageTracker._trackPageview('/outgoing/processingparis.ning.com?referer=');">processingparis.ning.com</a></p>
<p>The images are above and below are some very early explorations of a deterministic random 3D tree generator. I&#8217;m currently working on a proof-of-concept of some of the above ideas, mainly in order to help us be as efficient as possible on these two workshop days&#8230;</p>
<p>The images below are showing the combination of the generated tree structures above with <a href="http://toxiclibs.org/category/volumeutils/">volumeutils</a> to create 3D meshes of the trees&#8230;</p>
<p><a href="http://www.flickr.com/photos/toxi/4516521668" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4516521668?referer=');"><img class="aligncenter size-large wp-image-312" title="tree-1271103530" src="http://toxiclibs.org/wp-content/uploads/2010/04/tree-1271103530-680x382.png" alt="" width="680" height="382" /></a></p>
<p><a href="http://www.flickr.com/photos/toxi/4516522778" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4516522778?referer=');"><img class="aligncenter size-large wp-image-314" title="tree-1271112557" src="http://toxiclibs.org/wp-content/uploads/2010/04/tree-1271112557-680x382.png" alt="" width="680" height="382" /></a></p>
<p><a href="http://www.flickr.com/photos/toxi/4516522644" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4516522644?referer=');"><img class="aligncenter size-large wp-image-313" title="tree-1271112532" src="http://toxiclibs.org/wp-content/uploads/2010/04/tree-1271112532-680x382.png" alt="" width="680" height="382" /></a></p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/gEOlH42lx7c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/04/processing-paris-workshop/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/04/processing-paris-workshop/</feedburner:origLink></item>
		<item>
		<title>simutils-0001: Gray-Scott reaction diffusion</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/Om3J5UEjn4I/</link>
		<comments>http://toxiclibs.org/2010/02/simutils-grayscott/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 08:05:39 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Usage]]></category>
		<category><![CDATA[colorutils]]></category>
		<category><![CDATA[simutils]]></category>
		<category><![CDATA[volumeutils]]></category>

		<guid isPermaLink="false">http://toxiclibs.org/?p=217</guid>
		<description><![CDATA[This is part 2 of the discussion of the classes &#38; processes provided by the recently released simutils package. The first part of this series dealt with Diffusion-limited Aggregation (DLA) and this next process too is related to the simulated diffusion of particles. However, whereas the DLA process dealt with individual particles, this next one [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 2 of the discussion of the classes &amp; processes provided by the recently released <a href="http://toxiclibs.org/category/simutils/">simutils</a> package. <a href="http://toxiclibs.org/2010/02/new-package-simutils/">The first part of this series dealt with Diffusion-limited Aggregation</a> (DLA) and this next process too is related to the simulated diffusion of particles. However, whereas the DLA process dealt with individual particles, this next one is only looking at the concentrations of particles of different &#8220;substances&#8221; in a two-dimensional simulation space.</p>
<p>The Gray-Scott reaction diffusion model is a member of a whole variety of <a href="http://en.wikipedia.org/wiki/Reaction-diffusion_system" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Reaction-diffusion_system?referer=');">RD systems</a>, popular largely due to its ability to produce a very varied number of biological looking (and behaving) patterns, both static and constantly changing. Some patterns are reminiscent of cell devision, gastrulation or the formation of spots &amp; stripes on furry animals. As with all RD models, these patterns are the result of an iterative process evaluating each cell of the simulation space based on the concentrations of the two main parameters (for Gray-Scott usually named <strong>f</strong> and <strong>K</strong>) of the reaction equation as well as taking into account the concentrations of these 2 substances in neighboring cells. So conceptually the reaction diffusion system lies somewhere between the isolated DLA process working with individual particles and the entirely rulebased evaluation of a cell&#8217;s neighborhood in traditional cellular automatas, which we will deal with in the next post.</p>
<p>The image below, by <a href="http://mrob.com/pub/comp/xmorphia/" onclick="pageTracker._trackPageview('/outgoing/mrob.com/pub/comp/xmorphia/?referer=');">Robert Munafo</a>, is a fantastically helpful map of possible patterns resulting from various combinations of the <strong>f</strong> and <strong>K</strong> coefficients. Click the image to go to his website and explore the parameters in more detail (there&#8217;re close-ups and videos of all interesting combinations).</p>
<p><a href="http://mrob.com/pub/comp/xmorphia/" onclick="pageTracker._trackPageview('/outgoing/mrob.com/pub/comp/xmorphia/?referer=');"><img class="alignnone size-large wp-image-245" title="gs-parameter-map" src="http://toxiclibs.org/wp-content/uploads/2010/02/gs-parameter-map-680x680.jpg" alt="GS parameter map" width="680" height="680" /></a></p>
<p>As with the other classes of the <a href="http://toxiclibs.org/category/simutils/">simutils</a> package, the GrayScott implementation comes with several small demos to help you get started. The most basic use case (<a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/HelloGrayScott/HelloGrayScott.pde" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/HelloGrayScott/HelloGrayScott.pde?referer=');">HelloGrayScott</a>) is just setting up a simulation with default parameters and then allows you to draw in the simulation space with the mouse. Each frame, the reaction is updated, its new state translated into grayscale pixels and then rendered to the screen. The important thing to know here is that there&#8217;re 2 separate results states available, normally called the <strong>u</strong> and <strong>v</strong> buffers.</p>
<pre class="brush:java">
GrayScott gs;

// create a new simulation instance
// the "false" refers to a non-tiled space with walls
// set to true to create tiling patterns
gs=new GrayScott(width,height,false);

// configure the simulation params to:
// f=0.023, K=0.074
// diffusion speed for u buffer = 0.095
// diffusion speed for u buffer = 0.03
gs.setCoefficients(0.023,0.074,0.095,0.03);
</pre>
<p>The main <code>draw()</code> loop then just does this:</p>
<pre class="brush:java">
void draw() {
  if (mousePressed) {
    // set cells around mouse pos to max saturation
    gs.setRect(mouseX, mouseY,20,20);
  }
  loadPixels();
  // update simulation by 10 time steps per frame
  for(int i=0; i&lt;10; i++) gs.update(1);
  // read out the v buffer and translate into grayscale colors
  for(int i=0; i&lt;gs.v.length; i++) {
    float cellValue=gs.v[i];
    // the cell values in v are usually in the range 0.0 .. 0.33
    int col=255-(int)(min(255,cellValue*768));
    // use the col value for red, green and blue and set alpha to full opacity
    pixels[i]=col&lt;&lt;16|col&lt;&lt;8|col|0xff000000;
  }
  updatePixels();
}
</pre>
<p>To avoid this manual pixel pushing and enable us to make some of the subtle changes of densities more obvious, we can also use the handy (and also new) <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.color/toxi/color/ToneMap.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.color/toxi/color/ToneMap.java?referer=');"><code>ToneMap</code></a> class of the <a href="http://toxiclibs.org/category/colorutils/">colorutils</a> package. This allows us to map a number range to different positions (colors) on a multi-color gradient and so potentially better visualize the different densities. The basic usage of this class is shown below:</p>
<pre class="brush:java">
import toxi.color.*;

ToneMap toneMap;

// define a color gradient by adding colors at certain key points
// a gradient is like a 1D array with target colors at certain points
// all inbetween values are automatically interpolated (customizable too)
// this gradient here will contain 256 values
ColorGradient gradient=new ColorGradient();
gradient.addColorAt(0, NamedColor.BLACK);
gradient.addColorAt(128, NamedColor.RED);
gradient.addColorAt(192, NamedColor.YELLOW);
gradient.addColorAt(255, NamedColor.WHITE);

// now create a ToneMap instance using this gradient
// this maps the value range 0.0 .. 0.33 across the entire gradient width
// a 0.0 input value will be black, 0.33 white
toneMap=new ToneMap(0, 0.33, gradient);
</pre>
<p>Now we can refactor our Gray-Scott rendering code into something even simpler:</p>
<pre class="brush:java">
for(int i=0; i&lt;gs.v.length; i++) {
    // take a GS v value and turn it into a packed integer ARGB color value
    pixels[i]=toneMap.getARGBToneFor(gs.v[i]);
}
</pre>
<p>Btw. The <code>ToneMap</code> class is a nice example of the whole reusable &#8220;building block philosophy&#8221; of toxiclibs (and the object oriented approach in general). The class is simply a <a href="http://en.wikipedia.org/wiki/Object_composition" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Object_composition?referer=');">composition</a> of other library classes and under the hood delegates everything to these elements:</p>
<p><img src="http://toxiclibs.org/wp-content/uploads/2010/02/tonemap.png" alt="ToneMap composition" title="ToneMap composition" width="379" height="266" class="aligncenter size-full wp-image-275" /></p>
<p>All other GrayScott demos, as well as all Cellular Automata examples, make use of this ToneMap class, so do have a look at those for more reference&#8230; </p>
<p>Since a homogeneous configuration of the entire sim grid will always just provide one particular character/patterning, the <code>GrayScott</code> class has been designed with extension in mind. The <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/CustomGrayScott/CustomGrayScott.pde" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/CustomGrayScott/CustomGrayScott.pde?referer=');">CustomGrayScott</a> demo shows how to impose a pattern on the actual simulation parameters themselves, so that cells at different positions are evaluated using different parameters:</p>
<pre class="brush:java">
class PatternedGrayScott extends GrayScott {

  // our constructor just passes things on to the parent class
  PatternedGrayScott(int w, int h, boolean tiling) {
    super(w,h,tiling);
  }

  // this function is called for each cell
  // to retrieve its f coefficient
  public float getFCoeffAt(int x, int y) {
    // here we only take the x coordinate
    // and choose one of 2 options (even &#038; odd)
    x/=32;
    return 0==x%2 ? f : f-0.005;
  }

  // this function is called for each cell
  // to retrieve its K coefficient
  public float getKCoeffAt(int x, int y) {
    // here we only use the y coordinate
    // and create a gradient falloff for this param
    return k-y*0.00004;
  }
}
</pre>
<p>Instead of using the default GrayScott class, we only need to change one line in the setup() method to use our extended version instead:</p>
<pre class="brush:java">
GrayScott gs;

void setup() {
	size(200,200);
	gs=new PatternedGrayScott(width,height,false);
	...
}
</pre>
<p>The result of this is shown below&#8230; Easy, huh? :)</p>
<p><img class="alignnone size-full wp-image-193" title="CustomGrayScott001" src="http://toxiclibs.org/wp-content/uploads/2010/02/CustomGrayScott001.png" alt="" width="680" height="362" /></p>
<p>Having this mechanism in place, it can be also used to create more interesting types of masking. For a commission to produce a <a href="http://postspectacular.com/work/printmag/" onclick="pageTracker._trackPageview('/outgoing/postspectacular.com/work/printmag/?referer=');">cover design for Print Magazine</a> in 2008, I generated a type face from simple line &#038; arc segments and used it as mask to manipulate the concentrations of the f &#038; K parameters to achieve two different types of patterning: one for the inside of the letter shapes, the other for the outside&#8230;</p>
<p><object width="680" height="383"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1272071&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1272071&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="383"></embed></object><br /></p>
<p>The frames of that animation were then stacked up along the Z axis in 3D space and with the help of the <a href="http://toxiclibs.org/category/volumeutils/">volumeutils</a> classes turned into 3D mesh, <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.core/toxi/geom/util/STLWriter.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.core/toxi/geom/util/STLWriter.java?referer=');">exported as STL format</a> (also see <a href="http://toxiclibs.org/docs/core/toxi/geom/util/TriangleMesh.html#saveAsSTL%28java.lang.String%29">TriangleMesh.saveAsSTL()</a>) and finally fabricated into the physical, 3D printed sculpture shown below. In a way, the sculpture can be seen as a map of its entire creation process&#8230;</p>
<p><img class="size-full wp-image-237" title="typeform_square_680" src="http://toxiclibs.org/wp-content/uploads/2010/02/typeform_square_680.jpg" alt="Type &amp; Form sculpture" width="680" height="680" /></p>
<p>Here&#8217;re some more rendered detail shots of the sculpture. <a href="http://postspectacular.com/work/printmag/" onclick="pageTracker._trackPageview('/outgoing/postspectacular.com/work/printmag/?referer=');">More information about this project is here</a> and the <a href="http://www.flickr.com/photos/toxi/sets/72157604724789091/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/sets/72157604724789091/?referer=');">related flickr set</a>.</p>
<p><img class="aligncenter size-full wp-image-265" title="typeform_detail1" src="http://toxiclibs.org/wp-content/uploads/2010/02/typeform_detail1.jpg" alt="" width="680" height="382" /></p>
<p><img src="http://toxiclibs.org/wp-content/uploads/2010/02/typeform_detail2.jpg" alt="" title="typeform_detail2" width="680" height="382" class="aligncenter size-full wp-image-266" /></p>
<p>Finally, the <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/GrayScottImage/GrayScottImage.pde" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/GrayScottImage/GrayScottImage.pde?referer=');"><code>GrayScottImage</code></a> demo shows another supported technique of using the library: the seeding of the simulation using a bitmap image.</p>
<p><img class="alignnone size-full wp-image-194" title="GrayScottImage002" src="http://toxiclibs.org/wp-content/uploads/2010/02/GrayScottImage002.png" alt="" width="680" height="362" /></p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/Om3J5UEjn4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/02/simutils-grayscott/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/02/simutils-grayscott/</feedburner:origLink></item>
		<item>
		<title>verletphysics in the wild</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/tWeCFP5kT34/</link>
		<comments>http://toxiclibs.org/2010/02/verletphysics-in-the-wild/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 10:27:52 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Showcase]]></category>
		<category><![CDATA[verletphysics]]></category>

		<guid isPermaLink="false">http://toxiclibs.org/?p=248</guid>
		<description><![CDATA[Here&#8217;s a quick note of 2 projects/experiments by other users of the 3D version of the physics engine: First up is Ricardo Sanchez, one of those guys who had been hindered by the lack of demos &#38; documentation last year and has been in touch a few times about the physics engine. His questioning also [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick note of 2 projects/experiments by other users of the 3D version of the <a href="http://toxiclibs.org/category/verletphysics/">physics engine</a>:</p>
<p>First up is <a href="http://www.nardove.com/blog/" onclick="pageTracker._trackPageview('/outgoing/www.nardove.com/blog/?referer=');">Ricardo Sanchez</a>, one of those guys who had been hindered by the lack of demos &amp; documentation last year and has been in touch a few times about the physics engine. His questioning also directly triggered me to do a few more demos, which are now bundled with the last couple releases. A few days ago he excitedly told me that he&#8217;s finished his project and I wanted to share it with you here too:</p>
<p><a href="http://www.nardove.com/jellies/" onclick="pageTracker._trackPageview('/outgoing/www.nardove.com/jellies/?referer=');"><img class="aligncenter size-full wp-image-247" title="nardove_jelly" src="http://toxiclibs.org/wp-content/uploads/2010/02/nardove_jelly.jpg" alt="Nardove's Jellies" width="639" height="400" /></a></p>
<p>You can download the Processing source code for this sketch from the <a href="http://www.nardove.com/jellies/" onclick="pageTracker._trackPageview('/outgoing/www.nardove.com/jellies/?referer=');">project website</a> and read some <a href="http://www.nardove.com/blog/?p=248" onclick="pageTracker._trackPageview('/outgoing/www.nardove.com/blog/?p=248&amp;referer=');">more about his process on his blog</a>.</p>
<p>The other experiment I found is a nice showcase of the <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.physics/toxi/physics/constraints/SphereConstraint.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.physics/toxi/physics/constraints/SphereConstraint.java?referer=');"><code>SphereConstraint</code></a> in action to create a, well spherical, boundary for the physical simulation space. FYI the constraint can also be inverted and be configured to work as obstacle instead, not allowing any particles within the volume of the sphere. This can be achieved via a flag to its constructor.</p>
<p><object width="680" height="383"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9535398&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=9535398&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="383"></embed></object><br /></p>
<p>The effect is quite interesting and somewhat reminds me of <a href="http://okdeluxe.co.uk/" onclick="pageTracker._trackPageview('/outgoing/okdeluxe.co.uk/?referer=');">Mikkel Koser&#8217;s</a> &amp; <a href="http://www.shiftcontrol.dk/" onclick="pageTracker._trackPageview('/outgoing/www.shiftcontrol.dk/?referer=');">shiftControl&#8217;s</a> recent <a href="http://okdeluxe.co.uk/cop15/index.html" onclick="pageTracker._trackPageview('/outgoing/okdeluxe.co.uk/cop15/index.html?referer=');">COP15 identity</a>, although the behaviour of particles there is far more complex.</p>
<p>More detailed info about the most recent release and the behaviour changes it caused will be posted asap.</p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/tWeCFP5kT34" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/02/verletphysics-in-the-wild/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/02/verletphysics-in-the-wild/</feedburner:origLink></item>
		<item>
		<title>simutils-0001: Diffusion limited aggregation</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/k7rTQzTncJk/</link>
		<comments>http://toxiclibs.org/2010/02/new-package-simutils/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 11:44:16 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[simutils]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[diffusion]]></category>
		<category><![CDATA[dla]]></category>
		<category><![CDATA[generative]]></category>
		<category><![CDATA[octree]]></category>
		<category><![CDATA[particles]]></category>
		<category><![CDATA[rulebased]]></category>

		<guid isPermaLink="false">http://toxiclibs.org/?p=190</guid>
		<description><![CDATA[A few days ago I published some updates to all five existing main packages and also bundled up some other classes from existing projects into a new package, called simutils. As the name indicates, these new classes deal with the simulation of some fairly basic processes inspired by nature, but each of them exhibits some [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I published some updates to all five existing main packages and also bundled up some other classes from existing projects into a new package, called <strong>simutils</strong>. As the name indicates, these new classes deal with the simulation of some fairly basic processes inspired by nature, but each of them exhibits some emergent behaviours which can be (and have been) used for a wide variety of design tasks from 3D printed sculptures to generative music. To help you get started, the package also contains two or three Processing demos for each process showing basic usage patterns. The three processes implemented so far are explained in more detail in this &amp; <a href="http://toxiclibs.org/2010/02/simutils-grayscott/">the next</a> few upcoming posts. Let&#8217;s start with&#8230;</p>
<p><img class="alignnone size-full wp-image-220" title="brownian_sunflow" src="http://toxiclibs.org/wp-content/uploads/2010/02/brownian_sunflow.jpg" alt="brownian motion" width="680" height="382" /></p>
<h2>Diffusion limited aggregation</h2>
<p><a href="http://en.wikipedia.org/wiki/Diffusion-limited_aggregation" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Diffusion-limited_aggregation?referer=');">Diffusion limited aggregation</a>, DLA in short, is a theoretical process describing the clustering of particles through a process of diffusion, like a random walk/<a href="http://en.wikipedia.org/wiki/Brownian_motion" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Brownian_motion?referer=');">Brownian motion</a>. Inspired by the work of <a href="http://www.andylomas.com" onclick="pageTracker._trackPageview('/outgoing/www.andylomas.com?referer=');">Andy Lomas</a> with this process, in 2006 I set out to implement DLA myself from scratch, in order to apply it to structures and literally grow objects not made out of triangles/polygons. At the same time I&#8217;d also just discovered the possibilities of <a href="http://toxi.co.uk/blog/2006_12_01_archive.htm" onclick="pageTracker._trackPageview('/outgoing/toxi.co.uk/blog/2006_12_01_archive.htm?referer=');">rendering huge point clouds with Sunflow</a>, which seemed the perfect combination to explore this all further. By March &#8217;07 I had a system in place which allowed me to grow type and have used it for a commission to produce the &#8220;New Shoots&#8221; title sequence for Channel4.</p>
<p><img class="alignnone size-large wp-image-207" title="New Shoots (still)" src="http://toxiclibs.org/wp-content/uploads/2010/02/456471284_95dc1b9b45_o-680x382.png" alt="" width="680" height="382" /></p>
<p>The basic premise of a DLA simulation is the slow formation of complex structures through the (random) movement of single particles. Once a particle comes close to an existing one, it attaches itself and a new particle is spawned in a sphere around a previous particle. The process then repeats, slowly filling up the simulation space. If the random walk ever takes a particle passed a certain escape radius, the search is restarted with a different initial direction until another particle is hit. Because particles are usually very tiny, a large number of them and even more iterations are required for even very simple structures to emerge. For example, <a href="http://www.flickr.com/photos/toxi/456487319/in/set-72157600200636464/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/456487319/in/set-72157600200636464/?referer=');">the final frame of the New Shoots sequence</a> consisted of 4.5 million particles, whereas the structure for the image below has a &#8220;mere&#8221; 645,000&#8230;</p>
<p><img class="alignnone size-large wp-image-196" title="dlatest_spiral2" src="http://toxiclibs.org/wp-content/uploads/2010/02/dlatest_spiral2-680x382.png" alt="" width="680" height="382" /></p>
<h3>Finding the needle in the haystack</h3>
<p>Searching for particle collisions in sets of such size linearly is super slow &amp; cumbersome, so to make the process more efficient, my version of DLA is using the <a href="http://toxiclibs.org/docs/core/toxi/geom/PointOctree.html">PointOctree</a> class from the core package. This class is recursively (and on-demand) subdividing the simulation space into smaller, nested cubes, which are stored as <a href="http://en.wikipedia.org/wiki/Octree" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Octree?referer=');">tree structure</a>. When new particles are added by the DLA process they&#8217;re also being attached to the leaf nodes of the octree. When the next particle is searching for collisions with existing particles, these can then be found very quickly by querying the octree based on local search criteria using these 2 methods:</p>
<pre class="brush:java">PointOctree octree = new PointOctree(new Vec3D(-50,-50,50),100);
List&lt;Vec3D&gt; points; // in Java
java.util.List points; // in Processing, no support for generics!

// search within a sphere (i.e. all points within a certain distance)
Sphere boundingSphere = new Sphere(new Vec3D(),1);
points = octree.getPointsWithinSphere(boundingSphere); // or
points = octree.getPointsWithinSphere(origin, radius);

// search within an axis-aligned bounding box
AABB boundingBox = AABB.fromMinMax(new Vec3D(-1, -1, -1), new Vec3D(1, 1, 1));
points = octree.getPointsWithinBox(boundingBox);</pre>
<p>For more usage information about the octree also see the <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/DLASpiral/DLASpiral.pde" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/sim/DLASpiral/DLASpiral.pde?referer=');">DLASpiral</a> demo (the screenshot below also shows the adaptive structure of the octree) and the <a href="http://code.google.com/p/toxiclibs/source/browse/#svn/trunk/toxiclibs/examples/core/OctreeDemo" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/_svn/trunk/toxiclibs/examples/core/OctreeDemo?referer=');">OctreeDemo</a> of the core package&#8230;</p>
<p>In the future I&#8217;ll probably refactor this current dependency on the <code>PointOctree</code> class and have the <code>DLA</code> merely depend on a more generic <code>SpatialTree</code> interface, which then can also be implemented by other tree types, e.g. a <a href="http://en.wikipedia.org/wiki/Kd-tree" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Kd-tree?referer=');">kD tree</a>. To compensate, the DLA class so far has an extension point of sorts to allow custom <code>PointOctree</code> sub-classes to be used. In this case you&#8217;ll simply have to also sub-class <code>DLA</code> and overwrite the <code>createOctree</code> method to return an instance of your custom <code>PointOctree</code>.</p>
<p><img class="alignnone size-full wp-image-192" title="DLASpiral004" src="http://toxiclibs.org/wp-content/uploads/2010/02/DLASpiral004.png" alt="" width="680" height="362" /></p>
<h3>Guided growth</h3>
<p>In the above screenshot you can also see the blue spiral shape guideline directing the growth of the particles. These guidelines can either be individual line segments or points lists, e.g. sourced from a <a href="http://toxiclibs.org/docs/core/toxi/geom/Spline3D.html">Spline3D</a> instance or computed otherwise. When passing in a list of points, they&#8217;re connected into successive line segments internally. At least one line segment is required for the DLA process to function and you&#8217;d combine the 2 classes like this:</p>
<pre class="brush:java">// define a spline
Spline3D spline = new Spline3D();
spline.add(new Vec3D()).add(new Vec3D(0,-50,0)).add(new Vec3D(50,0,50)).add(new Vec3D(0,50,0));
DLAGuideLines guides = new DLAGuideLines();
guides.addCurveStrip(spline.computeVertices(8));

// setup DLA in a cubic space of 100 units edge length (always centred around (0,0,0))
DLA dla = new DLA(100);
// assign guideline(s)
dla.setGuideLines(guides);
</pre>
<p>The moment the guidelines are attached, each line segment is sampled at a high resolution and the computed points added to a second octree kept by the <code>DLA</code> class. It&#8217;s these points which are shown in the above screenshot (although only 10% of them are displayed)&#8230;</p>
<p><object width="680" height="382"><param name="movie" value="http://www.youtube.com/v/yDIh3PVq3RE&#038;fs=1" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed src="http://www.youtube.com/v/yDIh3PVq3RE&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="680" height="382"></embed></object></p>
<h3>Order of growth</h3>
<p>By default the growth of the entire particle system will be in the same order as the guideline segments have been added, however you&#8217;re free to change this by means of custom <a href="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html" onclick="pageTracker._trackPageview('/outgoing/java.sun.com/javase/6/docs/api/java/util/Comparator.html?referer=');">Compatators</a>. The <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLAGuideLines.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLAGuideLines.java?referer=');">DLAGuideLines</a> class is storing <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLASegment.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLASegment.java?referer=');">DLASegment</a> instances in a sorted <a href="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html" onclick="pageTracker._trackPageview('/outgoing/java.sun.com/javase/6/docs/api/java/util/TreeSet.html?referer=');">TreeSet</a>. The order of this set can be defined by defining a custom comparator implementation when creating the guidelines and so any possible growth order can be designed/defined. The example below defines one which enforces a bottom-up growth (assuming positive Y is up):</p>
<pre class="brush:java">// define comparator
// (this how to do in Processing, which doesn't support generics...
// in plain Java you'd compare Line3D instance directly
// without the need for casting from Object)
class BottomUpOrder implements Comparator {
  public int compare(Object a, Object b) {
    float ya=((Line3D)a).getMidPoint().y;
    float yb=((Line3D)b).getMidPoint().y;
    if (ya&lt;yb) return -1;
    if (ya&gt;yb) return 1;
    return 0;
  }
}

// now use the comparator for the guidelines
DLAGuideLines guides = new DLAGuideLines(new BottomUpOrder());
</pre>
<p>The next release of this package will contain a few more of those&#8230;</p>
<h3>Parameters of growth</h3>
<p>The final requirement for the whole process to start is a set of configuration parameters. Of these there are many and so they&#8217;re encapsulated in their own class. To use them they&#8217;re simply passed to the DLA like:</p>
<pre class="brush:java">// use default configuration
dla.setConfig(new DLAConfiguration());
</pre>
<p>The default configuration has the following values, also briefly described below:</p>
<pre class="brush:java">// threshold distance below which a particle attaches itself to an older one
float snapDistance = 1.8f;
// threshold distance to attach to a curve/guideline particle
float curveAttachDistance = 2;

// max. radius of the sphere in which a new particle is spawned around a previous one
float spawnRadius = 12;
// max. radius of the sphere when the particle's random walk is interrupted/restarted
float escapeRadius = 36;
// actual size of the particles (currently assumed to be uniform for entire system)
float particleRadius = 0.25f;
// stickiness factor, only 10% of all attachments will be successful
float stickiness = 0.1f;
// using guidelines the growth can be forced into a certain direction
// this parameter defines the impact strength of this direction
// if 0.0 particles grow in all directions, 1.0 = actual segment direction is used
float curveAlign = 0.74f;

// percentage amount to progress along segments after each new particle
float curveSpeed = 0.00045f;
// velocity of the random particle walk
float searchSpeed = snapDistance * 0.66f;
// turn speed when particle changes direction
float particleSpeed = 0.001f;

// progress speed when scanning guidelines to build octree
float guideLineDensity = 0.1;

// chance for existing/already processed segments to continue growing
// evaluated before spawning each new particle
float continousGrowthRatio = 0.1f;
</pre>
<h3>Why a library?</h3>
<p>Whereas this is setup creates very interesting structures (especially when rendered in Sunflow), my idea for this library was not necessarily to have everyone replicate this specific look over &amp; over again, but provide the means to focus more on exploring the actual growth process, to customize it and use it as driver for creating new structures in which the actual particles are only present indirectly/secondary. One key feature for that matter are events emitted by the DLA class at key moments of the process. The <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLAEventListener.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLAEventListener.java?referer=');">DLAEventListener</a> interface defines the following 3 event hooks:</p>
<pre class="brush:java">public interface DLAEventListener {

    void dlaAllSegmentsProcessed(DLA dla);

    void dlaNewParticleAdded(DLA dla, Vec3D p);

    void dlaSegmentSwitched(DLA dla, DLASegment s);
}
</pre>
<p>You can subscribe to these events by either creating your own class implementing this interface or sub-classing the also supplied <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLAEventAdapter.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.sim/toxi/sim/dla/DLAEventAdapter.java?referer=');">DLAEventAdapter</a> (in case you don&#8217;t want to react to all of them):</p>
<pre class="brush:java">class MyDLAListener extends DLAEventAdapter {

  // only get notified when growth is complete
  public  void dlaAllSegmentsProcessed(DLA dla) {
     System.out.println("done");
  }
}

DLA dla=new DLA(100);
// attach listener
dla.addListener(new MyDLAListener());
</pre>
<p>Alternatively, listening to &#8220;new particle&#8221; events allows you to construct elaborate structures not just from particles, but use particle positions to deposit small meshes or use <a href="http://toxiclibs.org/category/volumeutils/">volumeutils</a> to draw with a <code>VolumetricBrush</code> at these positions&#8230; There&#8217;re endless possibilities for further exploration and I hope some of you are excited enough to explore them! If so have fun &amp; share it!</p>
<p><a href="http://www.flickr.com/photos/toxi/tags/dla/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/tags/dla/?referer=');">Some more of my own earlier explorations into this field are on flickr.</a></p>
<p><img class="alignnone size-large wp-image-210" title="dlatest_spiral" src="http://toxiclibs.org/wp-content/uploads/2010/02/dlatest_spiral-680x382.png" alt="" width="680" height="382" /></p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/k7rTQzTncJk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/02/new-package-simutils/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/02/new-package-simutils/</feedburner:origLink></item>
		<item>
		<title>Re-inventing the wheel</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/lOURTWM0Sts/</link>
		<comments>http://toxiclibs.org/2010/01/re-inventing-the-wheel/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 02:44:50 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Usage]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[generative]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[searchspace]]></category>
		<category><![CDATA[spline]]></category>
		<category><![CDATA[symmetry]]></category>
		<category><![CDATA[variation]]></category>

		<guid isPermaLink="false">http://toxiclibs.org/?p=141</guid>
		<description><![CDATA[Firstly, massive thanks are in order for such a storming positive reception of this new site &#8211; I really hope this will become a good resource for everyone interested in the fields these libs are addressing and I will try to update everyone (and everything) as often as I can. In the near future that [...]]]></description>
			<content:encoded><![CDATA[<p>Firstly, massive thanks are in order for such a storming positive reception of this new site &#8211; I really hope this will become a good resource for everyone interested in the fields these libs are addressing and I will try to update everyone (and everything) as often as I can. In the near future that will include a bit of future gazing, but today I&#8217;ve been re-inventing the wheel, literally&#8230;</p>
<p><a href="http://www.flickr.com/photos/toxi/4280317234/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4280317234/?referer=');"><img class="alignnone size-full wp-image-147" title="wheel12" src="http://toxiclibs.org/wp-content/uploads/2010/01/wheel12.jpg" alt="wheel 12 spokes" width="680" height="525" /></a></p>
<p>I&#8217;ve been working on some designs for custom made wheels for a potential installation project. The aim is to lasercut some light-weight &amp; good looking acrylic wheels and so I&#8217;ve been literally searching for a few candidate solutions, which allow me to cut out large pieces of material from inside the wheel to keep the weight down whilst still being sturdy enough (thankfully the load on them will be minimal so I can skip the structural analysis).</p>
<p>Not wanting to do this exploration/hike manually, I opted for the Processing PDF output route and have written this little tool below to show me my options (at least some of them) and also tweak them easily.</p>
<p>Apart from Processing, the tool also makes use of these 3 classes from the <a href="http://toxiclibs.org/docs/core/">toxiclibscore</a> package:</p>
<h2>Vec2D</h2>
<p>This class, alongside its sibling Vec3D, is likely one of the most used classes of the entire library. Since 1.0 Processing has its own vector class too now, but Vec2D/3D are far more feature complete, implement a <a href="http://en.wikipedia.org/wiki/Fluent_interface" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Fluent_interface?referer=');">fluent interface</a> for more legible code when dealing with complex vector maths and <em>can</em> be faster too (especially for 2D, but also by helping you to avoid temporary object creation). Furthermore Vec2D also has support for polar coordinates (Vec3D has spherical as equivalent) which was very helpful for building the tool below:</p>
<p>Normally, you&#8217;d specify a Cartesian point with:</p>
<pre class="brush:java">Vec2D v = new Vec2D(x, y);</pre>
<p>However, if we want to interpret our vector as polar coordinates, we&#8217;re using the x component to specify the radius and the y component as rotation angle. To convert the vector back into Cartesian space (e.g. our screen) we can use the <code>.toCartesian()</code> method&#8230;</p>
<pre class="brush:java">Vec2D v = new Vec2D(radius, theta).toCartesian();</pre>
<p>In a similar manner, you can also transform a Cartesian point into polar coordinates:</p>
<pre class="brush:java">// here we 1st create a copy of v and then convert that one
Vec2D p = v.copy().toPolar();</pre>
<p>To see this basic usage pattern in more context, take a closer look at the <code>drawHoles(</code>) method below (lines 114-134) or check out the <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/core/PolarUnravel/PolarUnravel.pde" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/core/PolarUnravel/PolarUnravel.pde?referer=');">PolarUnravel demo</a> bundled with the core lib.</p>
<h2>Spline2D</h2>
<p>Each cut-out shape in the wheel is created from a simple spline shape, specified using only 4 points. As mentioned above, these anchor points are specified using (initially) polar coordinates and the Spline2D class is then computing control points (handles) for each of these given points automatically. As user you can also specify tightness &amp; subdivisions for the computed curve vertices in between. While the lack of direct manual control over the spline handles might be a shortcoming in some situations, I generally found it easier to work with this automated version, especially when working with long curves and not only single bezier segments.</p>
<p>The next release of the library will also add a decimator method to this class which will enable the sampling of the curve at a uniform interval (i.e. all successive points of the returned list have the same distance (within a tolerance), regardless of curvature). This feature comes from the <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.physics/toxi/physics/ParticlePath.java" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.physics/toxi/physics/ParticlePath.java?referer=');">ParticlePath</a> class briefly described in the <a href="http://toxiclibs.org/2010/01/happy-2010/">Happy 2010 post</a>.</p>
<p>Computing symmetrical handles for the curve endpoints is another still outstanding feature, but currently low priority (unless someone has got a patch ready for that ;)</p>
<p>The next image shows the 4 anchor points of each spline shape in green and all other computed vertices in pink.</p>
<p><a href="http://www.flickr.com/photos/toxi/4280635396/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4280635396/?referer=');"><img src="http://toxiclibs.org/wp-content/uploads/2010/01/wheelspline-e1263695654792.png" alt="wheel with highlighted spline vertices" title="wheelspline" width="680" height="680" class="alignnone size-full wp-image-180" /></a></p>
<h2>UnitTranslator</h2>
<p>This class is the sole, lonely member of the <code>toxi.math.conversion</code> package, but is especially useful for those of you using Processing for digital fabrication or creating printed outputs. It provides the following conversion methods, making it trivial to e.g produce PDF outputs at the right physical dimensions (without trial &amp; error):</p>
<ul>
<li><code>millisToPixels(double mm, int dpi)</code> &#8211; Converts millimeters into pixels.</li>
<li><code>millisToPoints(double mm)</code> &#8211; Converts millimeters into PostScript points.</li>
<li><code>pixelsToInch(int pix, int dpi)</code> &#8211; Converts pixels into inches.</li>
<li><code>pixelsToMillis(int pix, int dpi)</code> &#8211; Converts pixels into millimeters.</li>
<li><code>pixelsToPoints(int pix, int dpi)</code> &#8211; Converts pixels into points.</li>
<li><code>pointsToMillis(double pt)</code> &#8211; Converts points into millimeters.</li>
<li><code>pointsToPixels(double pt, int dpi)</code> &#8211; Converts points into pixels.</li>
</ul>
<p>In the demo below, we&#8217;re using it to specifiy the wheel radius and drill holes in mm and then automatically calculate the required window size in pixels. In that case we&#8217;re however not using <code>millisToPixels()</code>, but <code>millisToPoints()</code> because PDF units are in points which are interpreted as 1 pixel (at 72 dpi)&#8230;</p>
<h2>The Wheel tool</h2>
<p>Just copy &#038; paste the code below into Processing and hit <em>Run</em> to fill up your hard disk (kidding, by default it only generates 120 different small PDF files/variations). The variations are created by iterating over all permutations of 4 parameters: number of symmetry steps, inset radius, core radius, alternate core radius.</p>
<pre class="brush:java">/**
 * Generative wheel designs utilizing Vec2D polar coordinates,
 * splines and unit conversion. By default each design is exported as
 * PDF &#038; PNG file, but can be turned off by setting the doExport flag to false.
 *
 * Usage: if export is enabled simply run &#038; wait until all permutations
 * have been generated. Else press 'x' to activate next permutation or
 * use - / = to adjust the ARC_WIDTH parameter which defines the
 * size of the cutouts.
 *
 * (c) 2010 Karsten Schmidt, PostSpectacular Ltd.
 *
 * More info: http://toxiclibs.org/2010/01/re-inventing-the-wheel/
 * Source code licensed under GPL v3.0. See http://www.gnu.org/licenses/gpl.html
 */

import processing.pdf.*;

import toxi.geom.*;
import toxi.math.conversion.*;

// bleed in mm
int BLEED = 6;

// wheel radii &#038; document size
float R = (float)UnitTranslator.millisToPoints(370 / 2);
float W = 2 * R + 2 * (float)UnitTranslator.millisToPoints(BLEED);
float EMPTY_CORE_SIZE = (float)UnitTranslator.millisToPoints(5);

// start number of main segments
int NUM_SEGMENTS = 3;

// normalized parameters
float INSET_RADIUS = 0.8f;
float OFFSET = 0.1f;
float CORE_RADIUS = 0.15f;
float ALTCORE_RADIUS = 0.3f;
float ARC_WIDTH = 0.4f;

// optional mounting holes
int NUM_DOTS = 18;
float DOT_RADIUS = 0.97f;
float DOTSIZE = (float)UnitTranslator.millisToPoints(2);

// number of subdivisions for spline vertex computation
int SPLINE_SUBDIV = 20;

// flag for PDF &#038; PNG export of all permutations
boolean doExport = true;

public void setup() {
  size((int) W, (int) W);
  // turn off automatic redraws when not exporting
  if (!doExport) {
    noLoop();
  }
}

public void draw() {
  String frameID =
    "wheel-" + NUM_SEGMENTS + "-" + nf(INSET_RADIUS, 1, 2) + "-"
    + nf(ALTCORE_RADIUS, 1, 2) + "-"
    + nf(CORE_RADIUS, 1, 2) + "-" + nf(ARC_WIDTH, 1, 2);
  println(frameID);
  if (doExport) {
    beginRecord(PDF, "out/" + frameID + ".pdf");
  }
  background(255);
  noStroke();
  fill(0);
  translate(width / 2, height / 2);
  ellipseMode(RADIUS);
  ellipse(0, 0, R, R);
  fill(255);
  ellipse(0, 0, EMPTY_CORE_SIZE, EMPTY_CORE_SIZE);
  // main holes
  drawHoles((INSET_RADIUS + OFFSET) * R, CORE_RADIUS * R, (INSET_RADIUS
    + OFFSET + CORE_RADIUS)
    / 2 * R, ARC_WIDTH, 0, NUM_SEGMENTS);
  if (CORE_RADIUS &gt;= 0.5) {
    drawHoles(CORE_RADIUS * 0.85f * R, 0.2f * R,
    (CORE_RADIUS * 0.85f + 0.2f) / 2 * R, ARC_WIDTH, 0,
    NUM_SEGMENTS);
  }
  // small cutouts
  drawHoles(INSET_RADIUS * R, ALTCORE_RADIUS * R,
  (INSET_RADIUS + ALTCORE_RADIUS) / 2 * R, ARC_WIDTH / 2, PI
    / NUM_SEGMENTS, NUM_SEGMENTS);
  if (ALTCORE_RADIUS &gt;= 0.5) {
    drawHoles(ALTCORE_RADIUS * 0.85f * R, 0.3f * R,
    (ALTCORE_RADIUS * 0.85f + 0.3f) / 2 * R, ARC_WIDTH / 2, PI
      / NUM_SEGMENTS, NUM_SEGMENTS);
  }
  // drill holes
  drawDots(NUM_DOTS, DOT_RADIUS * R, DOTSIZE);
  if (doExport) {
    endRecord();
    saveFrame("png/" + frameID + ".png");
    nextPermutation();
  }
}

void drawDots(int num, float radius, float s) {
  float delta = TWO_PI / num;
  for (int i = 0; i &lt; num; i++) {
    Vec2D p = new Vec2D(radius, i * delta).toCartesian();
    ellipse(p.x, p.y, s, s);
  }
}

void drawHoles(float outerR, float innerR, float centerR, float radiusWidth, float thetaOffset, int num) {
  radiusWidth *= PI / num;
  Spline2D s = new Spline2D();
  // define point in polar coordinates, then convert them
  Vec2D p = new Vec2D(outerR, 0).toCartesian();
  Vec2D a = new Vec2D(outerR, radiusWidth).toCartesian();
  Vec2D b = new Vec2D(centerR, radiusWidth).toCartesian();
  Vec2D c = new Vec2D(innerR, 0).toCartesian();
  Vec2D d = new Vec2D(centerR, -radiusWidth).toCartesian();
  Vec2D e = new Vec2D(outerR, -radiusWidth).toCartesian();
  // add points to spline &#038; compute
  s.add(p).add(a).add(b).add(c).add(d).add(e).add(p);
  java.util.List verts = s.computeVertices(SPLINE_SUBDIV);
  float delta = TWO_PI / num;
  for (int i = 0; i &lt; num; i++) {
    pushMatrix();
    rotate(i * delta + thetaOffset);
    drawPath(verts);
    popMatrix();
  }
}

void drawPath(java.util.List verts) {
  beginShape();
  for (Iterator i = verts.iterator(); i.hasNext();) {
    Vec2D v = (Vec2D) i.next();
    vertex(v.x, v.y);
  }
  endShape();
}

public void keyPressed() {
  if (key == 'x') {
    nextPermutation();
  } else if (key == '-') {
    ARC_WIDTH -= 0.02;
  } else if (key == '=') {
    ARC_WIDTH += 0.02;
  }
  redraw();
}

void nextPermutation() {
  CORE_RADIUS += 0.2;
  if (CORE_RADIUS &gt;= INSET_RADIUS) {
    CORE_RADIUS = 0.15f;
    ALTCORE_RADIUS += 0.2f;
    if (ALTCORE_RADIUS &gt;= INSET_RADIUS) {
      ALTCORE_RADIUS = 0.3f;
      INSET_RADIUS += 0.1f;
      if (INSET_RADIUS &gt; 0.8) {
        NUM_SEGMENTS++;
        INSET_RADIUS = 0.8f;
        if (NUM_SEGMENTS &gt; 12) {
          exit();
        }
      }
    }
  }
}
</pre>
<p>Finally, below are some more images of variations created with this tool (<a href="http://www.flickr.com/photos/toxi/sets/72157623224570676/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/sets/72157623224570676/?referer=');">see the full size &#038; set on flickr</a>):</p>
<p><a href="http://www.flickr.com/photos/toxi/4280053262/" title="wheel3_all by toxi, on Flickr" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4280053262/?referer=');"><img src="http://farm3.static.flickr.com/2680/4280053262_5e0676cd13.jpg" width="350" height="500" alt="wheel3_all" /></a></p>
<p><a href="http://www.flickr.com/photos/toxi/4279310563/" title="wheel5_all by toxi, on Flickr" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4279310563/?referer=');"><img src="http://farm5.static.flickr.com/4021/4279310563_ca5ed79d6c.jpg" width="350" height="500" alt="wheel5_all" /></a></p>
<p><a href="http://www.flickr.com/photos/toxi/4280055796/" title="wheel8_all by toxi, on Flickr" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4280055796/?referer=');"><img src="http://farm3.static.flickr.com/2758/4280055796_f43663fc20.jpg" width="350" height="500" alt="wheel8_all" /></a></p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/lOURTWM0Sts" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/01/re-inventing-the-wheel/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/01/re-inventing-the-wheel/</feedburner:origLink></item>
		<item>
		<title>Recode submissions</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/cn_xNqxDdRc/</link>
		<comments>http://toxiclibs.org/2010/01/decoderecode-submissions/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 02:14:00 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Showcase]]></category>
		<category><![CDATA[volumeutils]]></category>
		<category><![CDATA[decode]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[variation]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://toxiclibs.postspectacular.com/?p=85</guid>
		<description><![CDATA[Here&#8217;re four of my personal favourites of the many submissions to the Recode competition of the V&#38;A Decode identity, which closed last Sunday&#8230; I&#8217;m not part of the judging panel, but I&#8217;m looking forward to find out if one of them will be chosen to be shown on the cross-track projectors throughout London Underground. Generative [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;re four of my personal favourites of the many submissions to the Recode competition of the <a href="/2009/12/va-decode-generative-identity/">V&amp;A Decode identity</a>, which closed last Sunday&#8230; I&#8217;m not part of the judging panel, but I&#8217;m looking forward to find out if one of them will be chosen to be shown on the cross-track projectors throughout London Underground. Generative art for the masses! :)</p>
<p><object width="680" height="382"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8613900&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8613900&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="382"></embed></object><br /><br />
By <a href="http://www.vimeo.com/oampo" onclick="pageTracker._trackPageview('/outgoing/www.vimeo.com/oampo?referer=');">Joe Turner</a></p>
<p><object width="680" height="382"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8658509&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8658509&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="382"></embed></object><br /><br />
By <a href="http://www.vimeo.com/user2007615" onclick="pageTracker._trackPageview('/outgoing/www.vimeo.com/user2007615?referer=');">DieTapete</a></p>
<p><object width="680" height="382"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8556433&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8556433&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="382"></embed></object><br /><br />
By <a href="http://www.vimeo.com/user1584689" onclick="pageTracker._trackPageview('/outgoing/www.vimeo.com/user1584689?referer=');">Stefan Mylleager</a></p>
<p><object width="680" height="382"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8051278&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8051278&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="382"></embed></object><br /><br />
By <a href="http://www.vimeo.com/liasomething" onclick="pageTracker._trackPageview('/outgoing/www.vimeo.com/liasomething?referer=');">Lia</a></p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/cn_xNqxDdRc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/01/decoderecode-submissions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/01/decoderecode-submissions/</feedburner:origLink></item>
		<item>
		<title>Ginger section</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/wkS0K55YUI8/</link>
		<comments>http://toxiclibs.org/2010/01/ginger-section/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 22:21:08 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Showcase]]></category>
		<category><![CDATA[volumeutils]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[contour]]></category>
		<category><![CDATA[generative]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[volumetric]]></category>

		<guid isPermaLink="false">http://toxiclibs.postspectacular.com/?p=61</guid>
		<description><![CDATA[It&#8217;s always still a nice surprise to spot other people&#8217;s experiments with these libraries in the wild. Just came across this beautiful example of using volumeutils by mariusz0z0Bydgoszczy, a cross section of an imaginary plant. Unfortunately no further info is available about the actual growth process, though it looks like a semi-random particle walk or [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s always still a nice surprise to spot other people&#8217;s experiments with these libraries in the wild. Just came across this beautiful example of using <a href="/category/volumeutils">volumeutils</a> by <a href="http://www.youtube.com/user/mariusz0z0Bydgoszczy" onclick="pageTracker._trackPageview('/outgoing/www.youtube.com/user/mariusz0z0Bydgoszczy?referer=');">mariusz0z0Bydgoszczy</a>, a cross section of an imaginary plant. Unfortunately no further info is available about the actual growth process, though it looks like a semi-random particle walk or <a href="http://en.wikipedia.org/wiki/Diffusion-limited_aggregation" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Diffusion-limited_aggregation?referer=');">DLA</a> method.</p>
<p><object width="680" height="382"><param name="movie" value="http://www.youtube.com/v/Gqu-2n2hidg&#038;fs=1" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed src="http://www.youtube.com/v/Gqu-2n2hidg&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="680" height="382"></embed></object></p>
<p>I especially like the amount &amp; colours of the contour layers used to visualize different densities. A similar (only in principle) thought also lead to the concept for the <a href="/2009/12/va-decode-generative-identity/">V&amp;A Decode Identity</a> completed recently. Just create a VolumetricSpace instance, use one of the preset VolumetricBrushes (or create your own one through sub-classing), use it to manipulate the &#8220;density&#8221; in the space and then pass the space instance to a IsoSurface to turn it into a TriangleMesh. Et voila! <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/volume/VolumeBrush/VolumeBrush.pde" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/volume/VolumeBrush/VolumeBrush.pde?referer=');">Example code</a> for this basic approach comes with the <a href="http://code.google.com/p/toxiclibs/downloads/list" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/downloads/list?referer=');">volumeutils library download</a>.</p>
<p><strong>UPDATE:</strong> There&#8217;s also an older, alternative version which is using sensor inputs to control its growth (so maybe the above process is related or even the same)&#8230;</p>
<p><object width="680" height="382"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7594282&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7594282&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="382"></embed></object><br /></p>
<blockquote><p>&#8220;this rhizome grows only if PIR sensor doesn&#8217;t detect movement [either nobody is in the room, or you stay still] amount of light measured by photocell influences branches girth. in this way, resulting form is a diagram of changing environmental conditions.&#8221;</p></blockquote>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/wkS0K55YUI8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/01/ginger-section/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/01/ginger-section/</feedburner:origLink></item>
		<item>
		<title>Happy 2010</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/fyGjf9NW1GM/</link>
		<comments>http://toxiclibs.org/2010/01/happy-2010/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 23:19:58 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Showcase]]></category>
		<category><![CDATA[verletphysics]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[particles]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://toxiclibs.postspectacular.com/?p=68</guid>
		<description><![CDATA[One of my favourite childhood toys was Vero Construc which helped me to develop a big interest in building little (often pointless) mechanical contraptions. I&#8217;m still having a few salvaged parts of it at home which I passed on to the kids to play with, though it&#8217;s having a hard time to compete with the [...]]]></description>
			<content:encoded><![CDATA[<p>One of my favourite childhood toys was <a href="http://www.flickr.com/photos/toxi/sets/72157600467182633/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/sets/72157600467182633/?referer=');">Vero Construc</a> which helped me to develop a big interest in building little (often pointless) mechanical contraptions. I&#8217;m still having a few salvaged parts of it at home which I passed on to the kids to play with, though it&#8217;s having a hard time to compete with the more &#8220;modern&#8221; toys &amp; gadgets.</p>
<p><a title="Vero Construc by toxi, on Flickr" href="http://www.flickr.com/photos/toxi/613818768/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/613818768/?referer=');"><img src="http://farm2.static.flickr.com/1176/613818768_7ab8e752d5.jpg" alt="Vero Construc" width="500" height="375" /></a></p>
<p>So over the holidays I&#8217;ve been doing some research about kinetic &amp; mechanical art and then started working on some additions to various classes in the core and physics packages. These in turn needed testing and inspired me to create the little New Year&#8217;s greetings below:</p>
<p><object width="680" height="382"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8547987&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8547987&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="680" height="382"></embed></object><br /></p>
<p>Amongst other things the new additions include:</p>
<ul>
<li><strong>ParticleString</strong> class to automatically connect a list of particles with springs or create a string of particles along a line/ray</li>
<li><strong>ParticlePath</strong> is extending Spline2D/3D and can turn the spline into a ParticleString sampled at an uniform interval</li>
<li>New <strong>ParticleContstraint</strong> implementations and improvements to existing ones:
<ul>
<li><strong>AxisConstraint</strong> locks movement of a single axis</li>
<li><strong>PlaneConstraint</strong> locks movement in a plane (only 1 axis left to move in freely)</li>
<li><strong>CylinderConstraint</strong> creates a cylindrical obstacle in the simulation space</li>
<li><strong>BoxConstraint</strong> turns an axis-aligned box (AABB) into an obstacle</li>
<li><strong>SoftBoxConstraint</strong> uses an AABB as perimeter and slowly forces particles towards its centroid coordinates (per axis)</li>
</ul>
</li>
<li>Reworked (corrected) velocity handling and accessors for contraints to manipulate particle velocities upon collision</li>
</ul>
<p>Even though these updates are not yet part of a new release, you can download the source code (as complete Eclipse project incl. compiled versions of the pre-release libraries) and interactive realtime versions for OSX &amp; Windows from here:</p>
<p><a href="http://xmas.postspectacular.com/2010/" onclick="pageTracker._trackPageview('/outgoing/xmas.postspectacular.com/2010/?referer=');">xmas.postspectacular.com/2010/</a></p>
<p>To get the project into Eclipse, simply use the Import wizard:</p>
<p><em>File &gt; Import&#8230; &gt; Existing projects into workspace &gt; Next &gt; Select archive file &gt; Choose the downloaded zip &gt; Finish</em></p>
<p>Apart from the showing how to use these new classes mentioned above, Processing heads might also be interested in the elegance of XML parsing using <a href="https://jaxb.dev.java.net/" onclick="pageTracker._trackPageview('/outgoing/jaxb.dev.java.net/?referer=');">JAXB</a> (one of my favourite additions to Java 6). Last but not least, the project is also utilizing the custom vector shape alphabet system originally developed for the <a href="http://postspectacular.com/work/onedotzero/" onclick="pageTracker._trackPageview('/outgoing/postspectacular.com/work/onedotzero/?referer=');">onedotzero festival identity</a> last year.</p>
<p>Happy 2010 everyone!</p>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/fyGjf9NW1GM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2010/01/happy-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2010/01/happy-2010/</feedburner:origLink></item>
		<item>
		<title>Additive waves</title>
		<link>http://feedproxy.google.com/~r/toxiclibs/~3/wICYpuhnqiM/</link>
		<comments>http://toxiclibs.org/2009/12/additive-waves/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 22:28:34 +0000</pubDate>
		<dc:creator>toxi</dc:creator>
				<category><![CDATA[Showcase]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Usage]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[terrain]]></category>
		<category><![CDATA[waves]]></category>

		<guid isPermaLink="false">http://toxiclibs.postspectacular.com/?p=50</guid>
		<description><![CDATA[The December release cycle has seen a number of new demos, including this one below using the built-in wave generators to create a dynamic 3D terrain. These generators are actually some of the oldest &#38; most re-usable components of the core library, but they never got much attention on the demo front. This is of [...]]]></description>
			<content:encoded><![CDATA[<p>The December release cycle has seen a number of new demos, including this one below using the built-in wave generators to create a dynamic 3D terrain. These generators are actually some of the oldest &amp; most re-usable components of the core library, but they never got much attention on the demo front. This is of course not right, especially since they also nicely demonstrate the object oriented &#8220;building block&#8221; approach also underlying most of the other available classes.</p>
<p><a title="new toxiclibs demo: AdditiveWaves017 by toxi, on Flickr" href="http://www.flickr.com/photos/toxi/4124850086/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4124850086/?referer=');"><img src="http://farm3.static.flickr.com/2689/4124850086_407814a592_m.jpg" alt="new toxiclibs demo: AdditiveWaves017" width="240" height="140" /></a> <a title="new toxiclibs demo: AdditiveWaves011 by toxi, on Flickr" href="http://www.flickr.com/photos/toxi/4124848628/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4124848628/?referer=');"><img src="http://farm3.static.flickr.com/2709/4124848628_96243ea1e9_m.jpg" alt="new toxiclibs demo: AdditiveWaves011" width="240" height="140" /></a></p>
<p><a title="new toxiclibs demo: AdditiveWaves003 by toxi, on Flickr" href="http://www.flickr.com/photos/toxi/4124075907/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4124075907/?referer=');"><img src="http://farm3.static.flickr.com/2709/4124075907_1de68ca9da_m.jpg" alt="new toxiclibs demo: AdditiveWaves003" width="240" height="140" /></a> <a title="new toxiclibs demo: AdditiveWaves005 by toxi, on Flickr" href="http://www.flickr.com/photos/toxi/4124847486/" onclick="pageTracker._trackPageview('/outgoing/www.flickr.com/photos/toxi/4124847486/?referer=');"><img src="http://farm3.static.flickr.com/2804/4124847486_7cf1c98746_m.jpg" alt="new toxiclibs demo: AdditiveWaves005" width="240" height="140" /></a></p>
<p>The Processing source code for generating these meshes is available with the library download, with an excerpt shown also below. But first, here&#8217;s a brief overview of how to use these classes:</p>
<p>Waves &amp; oscillation in general are very flexible &amp; powerful tools for many different design tasks and shouldn&#8217;t always be thought of in an audio context. For example, a square wave can be used to flick between 2 values at a given frequency, without the need for any <code>if()</code> statements. I also often use sine waves to create cyclical, soft, harmonious value changes, be it for interface design, movement, animation or even the time based modulation of behavioural parameters of agents. The core library comes with the following pre-defined wave types:</p>
<ul>
<li>Sine (pure, frequency modulated (FM), amplitude &amp; frequency modulated (AMFM))</li>
<li>Sawtooth (FM)</li>
<li>Square (FM and FM with harmonics)</li>
<li>Triangle (FM)</li>
<li>Constant (only provides a static value, e.g. useful as static source for input as FM)</li>
</ul>
<p>All of these types are expressed as implementations of the <code>AbstractWave</code> class in the <a href="http://toxiclibs.postspectacular.com/docs/core/toxi/math/waves/package-summary.html" onclick="pageTracker._trackPageview('/outgoing/toxiclibs.postspectacular.com/docs/core/toxi/math/waves/package-summary.html?referer=');">toxi.math.waves</a> package. This abstract class defines all commonalities of what constitutes a wave: a phase, a frequency, an amplitude, a centre offset and a bunch of accessors and converters. The actual wave function then needs to be implemented by a concrete sub-class. Using <a href="http://en.wikipedia.org/wiki/Type_polymorphism" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Type_polymorphism?referer=');">poly-morphism</a> and having an <a href="http://en.wikipedia.org/wiki/Abstract_class" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Abstract_class?referer=');">abstract super class</a> makes a lot of sense in this case, since it allows for all this:</p>
<ol>
<li>It frees our main application from having to know which exact wave type we&#8217;re going to use and so allows for easier/faster experimentation and generally more flexibility.</li>
<li>It enables us to plug-in any of the available wave types as input for frequency or amplitude modulation and so create highly (theoretically infinitely) complex waveforms.</li>
<li>It provides the basics of an extensible framework for creating new wave types.</li>
</ol>
<p>These points are hopefully confirmed by you when looking at this method below (taken from the <a href="http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/core/AdditiveWaves/AdditiveWaves.pde" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/examples/core/AdditiveWaves/AdditiveWaves.pde?referer=');">AdditveWaves</a> demo, bundled since toxiclibscore-0015):</p>
<pre class="brush:java">AbstractWave createRandomWave() {

  AbstractWave result=null;

  // create a randomized sine wave to be used as
  // FM input for the main wave chosen below
  // the order of parameters is:
  // start phase, frequency (in radians), amplitude, offset value
  AbstractWave fmod=new SineWave(0, random(0.005, 0.02), random(0.1, 0.5), 0);

  // pick a random frequency
  float freq=random(0.005, 0.05);

  // choose a wave type
  switch((int)random(7)) {
  case 0:
    result = new FMTriangleWave(0, freq, 1, 0, fmod);
    break;
  case 1:
    result = new FMSawtoothWave(0, freq, 1, 0, fmod);
    break;
  case 2:
    result = new FMSquareWave(0, freq, 1, 0, fmod);
    break;
  case 3:
    // harmonic square waves are created by
    // adding sine waves upto a number of octaves
    // above the base frequency
    result = new FMHarmonicSquareWave(0, freq, 1, 0, fmod);
    ((FMHarmonicSquareWave)result).maxHarmonics=(int)random(3,30);
    break;
  case 4:
    result = new FMSineWave(0, freq, 1, 0, fmod);
    break;
  case 5:
    AbstractWave amod=new SineWave(0, random(0.01,0.2), random(2, 3), 0);
    result = new AMFMSineWave(0, freq, 0, fmod, amod);
    break;
  case 6:
    result = new ConstantWave(random(-1,1));
    break;
  }
  return result;
}</pre>
<p>The next snippet then quickly shows how this method would be used:</p>
<pre class="brush:java">import toxi.math.waves.*;

AbstractWave wave=createRandomWave();

// updates the wave phase and computes the new function value
// this code doesn't care which wave type we're dealing with
float currValue=wave.update();
</pre>
<p>The generators have another useful feature, though: A state stack. If you&#8217;ve used Processing or OpenGL before, you have likely  come across the concept in the form of <code>pushMatrix()</code>/<code>popMatrix()</code> calls to save and restore the state of the graphical transformation matrix. The wave generators implement the same idea and so can be easily used to create the 3D meshes above.</p>
<pre class="brush:java">// save current wave state
wave.push();

for(int i=0; i<10; i++) {
  float lookahead=wave.update();
  // do something clever
}

// restore wave to previous state
wave.pop();
</pre>
<img src="http://feeds.feedburner.com/~r/toxiclibs/~4/wICYpuhnqiM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://toxiclibs.org/2009/12/additive-waves/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://toxiclibs.org/2009/12/additive-waves/</feedburner:origLink></item>
	</channel>
</rss>
