<rss version="2.0" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
<channel>
	<title>roxlu.com (openframeworks, projects, arduino, processing)</title>
	<link>http://www.roxlu.com</link>
	<description>roxlu.com: openFrameworks, processing, visual effects, opengl, arduino, hardware, projects, installations </description>
	<generator>WAFCMS</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
<item>
		<title>Minivegas</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>812b4ba287f5ee0bc9d43bbf5bbe87fbguid</guid>
		<description><![CDATA[<p>
	Last week I met <a href="http://www.vincentlindeboom.nl/">Vincent Lindeboom</a>&nbsp;and had a meeting with him at Baked Beans with <a href="http://minivegas.co.uk/">MiniVegas</a> for an awesome project. &nbsp;This weekend I worked on a little visualisation with openFrameworks / openGL.&nbsp;</p>
<p>
	<img alt="" id="file_611intro" src="/assets/uploaded/611-minivegas_0.jpg" /></p>
<p>
	<img alt="" id="file_615intro" src="/assets/uploaded/615-minivegas_10.jpg" /></p>
<p>
	<img alt="" id="file_616intro" src="/assets/uploaded/616-minivegas_12.jpg" /></p>
<p>
	<img alt="" id="file_617intro" src="/assets/uploaded/617-minivegas_14.jpg" /></p>
<p>
	<img alt="" id="file_618intro" src="/assets/uploaded/618-minivegas_25.jpg" /></p>
<p>
	<img alt="" id="file_619intro" src="/assets/uploaded/619-minivegas_26.jpg" /></p>
<p>
	<img alt="" id="file_612intro" src="/assets/uploaded/612-minivegas_3.jpg" /></p>
<p>
	<img alt="" id="file_620message" src="/assets/uploaded/620-minivegas_38.jpg" /></p>
<p>
	<img alt="" id="file_621intro" src="/assets/uploaded/621-minivegas_39.jpg" /></p>
<p>
	<img alt="" id="file_622intro" src="/assets/uploaded/622-minivegas_40.jpg" /></p>
<p>
	<img alt="" id="file_623one_liner" src="/assets/uploaded/623-minivegas_43.jpg" /></p>
<p>
	<img alt="" id="file_624one_liner" src="/assets/uploaded/624-minivegas_44.jpg" /></p>
<p>
	<img alt="" id="file_613intro" src="/assets/uploaded/613-minivegas_6.jpg" /></p>
<p>
	<img alt="" id="file_614intro" src="/assets/uploaded/614-minivegas_9.jpg" /></p>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p>]]></description>
</item><item>
		<title>Juggling ball tracking</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>f4b9ec30ad9f68f89b29639786cb62efguid</guid>
		<description><![CDATA[<p>
	Had some minutes to work on my Juggling ball tracking visualisation. &nbsp;I&#39;m working towards ball tracking application where I use the x,y coordinates of the juggling balls and time as the z coordinate. Then I export these positions to a .obj file and render it using i.e. Blender. Here are just some debug screenshots of early steps of the trail creation.</p>]]></description>
</item><item>
		<title>Summer openFrameworks  freakDay</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>98dce83da57b0395e163467c9dae521bguid</guid>
		<description><![CDATA[<p>
	This Saturday we had a nice small freakDay with Tim of <a href="http://www.blendid.nl">Blendid</a> and Jim from <a href="http://www.strandjutter.net">Strandjutter.net</a>. Tim tweaked his code which creates different kinds of seguences (sin, cos, sawtooth, etc..).&nbsp; I gave a little intro to openFrameworks for Jim and in a couple of minutes he was up and running and creating nice <a href="http://nl.wikipedia.org/wiki/Lissajousfiguur">Lisajous</a> shapes. I dove (again) in some 3D rotation techniques and maths for a small project I&#39;m working on.</p>]]></description>
</item><item>
		<title>First test with new lasers for touch table!</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>92cc227532d17e56e07902b254dfad10guid</guid>
		<description><![CDATA[<p>
	I just tried out the new, 850nm infrared lasers, I received from Aixiz. And wow! The result is just fantastic! I&#39;m getting a 100% match, even with only one laser. The final table will have 4 lasers in each corner so I&#39;m pretty sure the recognition of the fingers is settled now. Next step will be finding a good surface to beam on, and then we can start building our first prototype and start thinking about some nice applications!</p>
<p>
	<img alt="" id="file_568message" src="/assets/uploaded/568-data.jpg" /></p>]]></description>
</item><item>
		<title>Touchtable</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>8613985ec49eb8f757ae6439e879bb2aguid</guid>
		<description><![CDATA[<p>Received some designs from <a href="http://www.heijtmajer.com/">Tim</a> who made sketches for our pre-prototype touch table. Slowly we our first version is coming to a real product. Something went wrong with the shipment of our new lasers so we had to wait for a month. Though it's been quite busy with other work so this wasn't a problem. I hope to have some time this week to hookup the hardware and do some tests; I'm pretty excided about how it's going to be. In the meanwhile I'm researching different methods of blob matching and tracking. I've been reading lots of papers on things like tennis and soccer ball tracking and the results are promosing.</p>]]></description>
</item><item>
		<title>Blob tracking and labelling</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>54229abfcfa5649e7003b83dd4755294guid</guid>
		<description><![CDATA[<p>Silently I'm working on a project for which I need some stable blob tracking and labelling. I googled around but didn't find blob trackers and labelling code which takes into account different matching algorithms. I'm working on this piece of code which will follow blobs and try to rematch them even when the blob went out of the frame for a couple of frames.  It uses openCV and the blob tracking code is created as an addon for openFrameworks. It still needs some tweaking, though when the blob detection / segmentation is good I, almost all blobs are labelled correctly. I tested this with a video of around 1000 frames and I didn't find a mismatch!</p>

<p><img src="/assets/uploaded/567-tracker_ids.png" alt="tracker_ids.png" class="" title="tracker_ids.png"></p>]]></description>
</item><item>
		<title>Twitter.. the final frontier</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>7647966b7343c29048673252e490f736guid</guid>
		<description><![CDATA[<p>Wow, it's been a couple of weeks since I did my last post.  I've been busy working on lots of websites for clients. Though this weekend I dove into text rendering with openFrameworks. I'd never expected that rendering text is such an advanced topic.  After searching for a good text rendering engine I found actually just two good open source rendering libraries which have features for laying out (unicode) text.  There is a library called FTGL which I tested first, though it seemed outdated. Therefore I searched for another text rendering library and found a library called Pango which is extremely nice! It's much more active developed than FTGL and used by a couple of big open source projects (such as Firefox on Linux).  Currently I'm working on an addon for openFrameworks which working nicely atm.</p>

<p>Besides a text-rendering addon I created addon for the streaming twitter server... I'm still working on this and need to fine tune some things before I can make it publicly avaible in such a way it can be used by others.</p>

<p>Below are some images of little projects I'm working on.</p>]]></description>
</item><item>
		<title>Etching a pcb for a display</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>2a38a4a9316c49e5a833517c45d31070guid</guid>
		<description><![CDATA[<p>Together with Martin and Thijs we've tried to etch a PCB using the toner transfer method. Yesterday we tried but had no luck. Somehow you cannot use a Brother printer for the toner transfer method. Luckily, after trying lots of different things, I found a post where someone said the Brother printers make the toner and so the plastic too hot which makes it very hard to transfer the ink to the pcb.  Martin had a Samsung laser printer which we used today, and it just worked directly!</p>

<p>We created a design to drive a shiftregister. The PCB is okay, though not the best ever quality, but for a first time we're really happy.  Next step is to solder it nicely and make it work to drive our 7-segmented LEDs.</p>]]></description>
</item><item>
		<title>Clock and counter display</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>c7e1249ffc03eb9ded908c236bd1996dguid</guid>
		<description><![CDATA[<p>For a small weekend project we're working on a display for in our office. We use a couple of big 7-segmented LEDs we bought at farnell. <a href="http://www.heijtmajer.com/">Tim</a> was so nice to make the wooden frame for us! Thanks a lot Tim. Together with Martin we'll fix the hardware this weekend. We're going to create our first custom made PCB as well! Then maybe, when we've some time left, I'll try and create our first <a href="/blog/entry/66/womby-0.1/">Womby</a> produced project, which will be a great test case.</p>]]></description>
</item><item>
		<title>Screenshots from Breda Graphic Design Festival</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>93db85ed909c13838ff95ccfa94cebd9guid</guid>
		<description><![CDATA[<p>Forgot to post a couple of screenshots from the application I created at the <a href="http://www.graphicdesignfestival.nl/nl/?sid=b9fb2b6607f3d0bf91ff4efd5b38da6b">Graphic Design Festival Breda</a> during the openFrameworks Lab. As I've mentioned before... it was a great week, meeting lots of nice and enthusiastic people working at the field of code and art!</p>

<p><img alt="" src="/assets/uploaded/518-screenshot20100608at10.47.44pm.jpg" width="600"></p>

<p><img alt="" src="/assets/uploaded/519-screenshot20100608at10.47.31pm.jpg" width="600"></p>]]></description>
</item><item>
		<title>Curles with openFrameworks</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>3ef815416f775098fe977004015c6193guid</guid>
		<description><![CDATA[<p>After reading a paper on <a href="http://www.gmrv.es/Publications/2009/AL09/SCCG09_final.pdf">Physically based animation of sea anemones in Real-Time</a>,  I had a math++ moment. I can tell you that I'm not very fond of the way math has been taught to me and well.. actually everyone else I know.  Math is teached abstract, though also very practical, but always taught in a theoretical way. I've always wondered why institutions arent trying to find other ways to teach about math. I image a math teacher, not only explaining the theoretical and practical parts, but relates math to something visual. Visual-information is much more suited for learning than just plain abstract theoretical 
information... at least it is for me but I'm sure others can back me up on this one.</p>

<p><img src="/assets/uploaded/510-dcurle_0001.png" title="Curly" width="500"></p>

<p>About my "Math++" moment... the sea anemones paper talks about the locality of a change. What's that, I hear you say. Imagine a grass stalk (stalk A) with a tiny curle at the very end of the stalk. Imagine another stalk (stalk B) where the curle starts at the root and finishes at the tip.  You can say that the curliness of the the stalk A is more local than the one of stalk B. The nice thing is that you can use the C++/math function pow(base, exponent) to define this "localness".</p>

<p><img src="/assets/uploaded/511-dcurle_0002.png" title="Curly" width="500"></p>

<p>In the images below you can see a stem which uses around 40 separate segments. Each segment gets an index value and the more towards the tip of the stalk the higher this index value gets. We use the index number of a segment for the base component of pow(base,component) to specify the position/range of the specific segment in relation to the whole stem. So the base value changes from 0.1 to 0.2, 0.3, 0.4, etc... but the component stays the same which results in the images below!</p>

<pre class="c"><span style="color: #339933;"># --------------------- Stem.cpp -----------------------</span>
<span style="color: #339933;">#include &quot;Stem.h&quot;</span>
<span style="color: #339933;">#include &quot;Segment.h&quot;</span>
&nbsp;
Stem::<span style="color: #202020;">Stem</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> nNumParts<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// create segments.</span>
    Segment* parent = <span style="color: #000000; font-weight: bold;">NULL</span>;
    Segment* segment = <span style="color: #000000; font-weight: bold;">NULL</span>;
    <span style="color: #993333;">float</span> radius = <span style="color: #cc66cc;">55</span>;
    ofxVec2f pos<span style="color: #66cc66;">&#40;</span>ofGetWidth<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>/<span style="color: #cc66cc;">2</span>, ofGetHeight<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">-100</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #993333;">float</span> angle = -HALF_PI;
    <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i &lt; nNumParts; ++i<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        bool is_head = <span style="color: #66cc66;">&#40;</span>i == nNumParts<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span>;
        pos.<span style="color: #202020;">x</span> += cos<span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span> * radius;
        pos.<span style="color: #202020;">y</span> += sin<span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span> * radius;
        radius *= <span style="color: #cc66cc;">0.90</span>;
        segment = new Segment<span style="color: #66cc66;">&#40;</span>pos, angle, i<span style="color: #cc66cc;">+1</span>,is_head, parent<span style="color: #66cc66;">&#41;</span>;
        segments.<span style="color: #202020;">push_back</span><span style="color: #66cc66;">&#40;</span>segment<span style="color: #66cc66;">&#41;</span>;
        parent = segment;
        angle *= <span style="color: #cc66cc;">1.05</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Stem::<span style="color: #202020;">draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    vector&lt;Segment*&gt;::<span style="color: #202020;">iterator</span> it = segments.<span style="color: #202020;">begin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>it != segments.<span style="color: #202020;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;draw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        ++it;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Stem::<span style="color: #202020;">update</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    vector&lt;Segment*&gt;::<span style="color: #202020;">iterator</span> it = segments.<span style="color: #202020;">begin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>it != segments.<span style="color: #202020;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;update<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        ++it;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Stem::<span style="color: #202020;">curle</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span> fAngle<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    vector&lt;Segment*&gt;::<span style="color: #202020;">iterator</span> it = segments.<span style="color: #202020;">begin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>it != segments.<span style="color: #202020;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;curle<span style="color: #66cc66;">&#40;</span>fAngle<span style="color: #66cc66;">&#41;</span>;
        ++it;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Stem::<span style="color: #202020;">setIndexDiv</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span> fDiv<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    vector&lt;Segment*&gt;::<span style="color: #202020;">iterator</span> it = segments.<span style="color: #202020;">begin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>it != segments.<span style="color: #202020;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;setIndexDiv<span style="color: #66cc66;">&#40;</span>fDiv<span style="color: #66cc66;">&#41;</span>;
        ++it;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Stem::<span style="color: #202020;">setPow</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span> fPow<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    vector&lt;Segment*&gt;::<span style="color: #202020;">iterator</span> it = segments.<span style="color: #202020;">begin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>it != segments.<span style="color: #202020;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;setPow<span style="color: #66cc66;">&#40;</span>fPow<span style="color: #66cc66;">&#41;</span>;
        ++it;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #339933;"># --------------------- Segment.cpp -------------------</span>
<span style="color: #339933;">#include &quot;Segment.h&quot;</span>
Segment::<span style="color: #202020;">Segment</span><span style="color: #66cc66;">&#40;</span>ofxVec2f oPosition, <span style="color: #993333;">float</span> fAngle,  <span style="color: #993333;">float</span> nIndex,bool isHead, Segment* pParent<span style="color: #66cc66;">&#41;</span>
:parent<span style="color: #66cc66;">&#40;</span>pParent<span style="color: #66cc66;">&#41;</span>
,position<span style="color: #66cc66;">&#40;</span>oPosition<span style="color: #66cc66;">&#41;</span>
,angle<span style="color: #66cc66;">&#40;</span>fAngle<span style="color: #66cc66;">&#41;</span>
,index<span style="color: #66cc66;">&#40;</span>nIndex<span style="color: #66cc66;">&#41;</span>
,is_head<span style="color: #66cc66;">&#40;</span>isHead<span style="color: #66cc66;">&#41;</span>
,length<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>
,index_div<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>
,pow_val<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.6</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>parent != <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        length = <span style="color: #66cc66;">&#40;</span>parent-&gt;position - position<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>index &lt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
        index = <span style="color: #cc66cc;">0.001</span>;
    inverse_index = <span style="color: #cc66cc;">1</span>.0f/index;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Segment::<span style="color: #202020;">curle</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span> fAngle<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// At the top of the segment, the index value is higher, so as well</span>
    <span style="color: #808080; font-style: italic;">// as the angle change (due to index/index_div). Besides this proportional</span>
    <span style="color: #808080; font-style: italic;">// change in angle per segment, we define the locality of the change</span>
    <span style="color: #808080; font-style: italic;">// using the exponent we pass to pow(). </span>
    <span style="color: #808080; font-style: italic;">// The bigger the pow_val change the more local the change</span>
    <span style="color: #808080; font-style: italic;">// will .. note that the base value of pow also increases for each</span>
    <span style="color: #808080; font-style: italic;">// segment near the top.</span>
    <span style="color: #993333;">float</span> t = index/index_div;
    angle = <span style="color: #66cc66;">&#40;</span>fAngle<span style="color: #66cc66;">&#41;</span> * pow<span style="color: #66cc66;">&#40;</span>index/index_div,pow_val<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>parent != <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        position.<span style="color: #202020;">x</span> = parent-&gt;position.<span style="color: #202020;">x</span> + cos<span style="color: #66cc66;">&#40;</span>angle - HALF_PI<span style="color: #66cc66;">&#41;</span> * length;
        position.<span style="color: #202020;">y</span> = parent-&gt;position.<span style="color: #202020;">y</span> + sin<span style="color: #66cc66;">&#40;</span>angle - HALF_PI<span style="color: #66cc66;">&#41;</span> * length;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Segment::<span style="color: #202020;">draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>parent != <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>.0f, <span style="color: #cc66cc;">1</span>.0f, <span style="color: #cc66cc;">0</span>.6f,<span style="color: #cc66cc;">0</span>.8f<span style="color: #66cc66;">&#41;</span>;
        ofCircle<span style="color: #66cc66;">&#40;</span>position.<span style="color: #202020;">x</span>, position.<span style="color: #202020;">y</span>,<span style="color: #cc66cc;">2.5</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>.0f, <span style="color: #cc66cc;">1</span>.0f, <span style="color: #cc66cc;">0</span>.2f, <span style="color: #cc66cc;">0</span>.8f<span style="color: #66cc66;">&#41;</span>;
        glBegin<span style="color: #66cc66;">&#40;</span>GL_LINES<span style="color: #66cc66;">&#41;</span>;
            glVertex2fv<span style="color: #66cc66;">&#40;</span>position.<span style="color: #202020;">v</span><span style="color: #66cc66;">&#41;</span>;
            glVertex2fv<span style="color: #66cc66;">&#40;</span>parent-&gt;position.<span style="color: #202020;">v</span><span style="color: #66cc66;">&#41;</span>;
        glEnd<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>is_head<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>.0f, <span style="color: #cc66cc;">1</span>.0f, <span style="color: #cc66cc;">0</span>.6f,<span style="color: #cc66cc;">0</span>.8f<span style="color: #66cc66;">&#41;</span>;
        ofCircle<span style="color: #66cc66;">&#40;</span>position.<span style="color: #202020;">x</span>, position.<span style="color: #202020;">y</span>,<span style="color: #cc66cc;">2.5</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Segment::<span style="color: #202020;">update</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Segment::<span style="color: #202020;">setIndexDiv</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span> fDiv<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    index_div = fDiv;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Segment::<span style="color: #202020;">setPow</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span> fPow<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    pow_val = fPow;
<span style="color: #66cc66;">&#125;</span></pre>]]></description>
</item><item>
		<title>openFrameworks workshop at SETUP Utrecht</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>fe9fc289c3ff0af142b6d3bead98a923guid</guid>
		<description><![CDATA[<p>Today we had a super nice workshop / freakday on openFrameworks at SETUP in Utrecht with lots of nice people! I've been researching different solutions to draw stems which curle in and out based on a external force.  I want to add some extra visuals and create a PDF from the visual output using the ofxCairo addon.</p>

<p><img src="/assets/uploaded/474-screenshot20100523at4.57.48pm.jpg" width="600" alt=""></p>

<p>Some green...</p>

<p><img src="/assets/uploaded/476-screenshot20100523at7.53.49pm.jpg" width="600" alt=""></p>

<p>And with some fishes!</p>

<p><img src="/assets/uploaded/481-screenshot20100523at8.11.27pm.jpg" width="600" alt=""></p>

<p>Read more to see some of the posts we did on <a href="http://www.piratepad.nl/ofrocks">piratepad</a></p>

<pre class="php">SLIDES OF THE MORNING TUTORIAL
http://companje.nl/openframeworks/
&nbsp;
Things learnt during the Open Frameworks workshop at SETUP
&nbsp;
MORNING TUTORIAL
&nbsp;
In the morning we were working on a basic bouncing balls tutorial. Here are the final files that we worked on:
&nbsp;
http://piratepad.nl/testApp-cpp
http://piratepad.nl/testApp-h
&nbsp;
&nbsp;
CONTROL PANEL
&nbsp;
Remember that spiffy control panel?
http://github.com/ofTheo/ofxControlPanel
&nbsp;
&nbsp;
IMAGE PROCESSING
&nbsp;
Did you know there was a guy called Alfred Haar who was an incredible nerd already back in 1909? In Open Frameworks there is an extention of OpenCV's capabilities called OFXCVHaarfinder (Open Frameworks eXtention Computer Vision Haarfinder). This is a general image recognition library. It's general in the sense that you can teach it to recognise anything by training it. Show it a lot of faces, and it will start finding them after the training period.
&nbsp;
When Sebastian told us about it, we thought he was talking about tracking hair..
&nbsp;
Here you can download the extention to the OpenCV addon:
http://code.google.com/p/kyle/
&nbsp;
More about Alfred Haar:
http://en.wikipedia.org/wiki/Alfréd_Haar
&nbsp;
FLOW DETECTION! &lt;-- google this!
&nbsp;
One step further is working with Haar-Cascades. These are XML files that describe how detected objects are related to eachother. This make complicated relatios possible. For example, an arm should be attached to a body, which should be attached to a face, etc.
&nbsp;
A list of XML files:
https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot/opencv/data/haarcascades/
&nbsp;
More on the Open Frameworks Forum:
http://www.openframeworks.cc/forum/viewtopic.php?f=10&amp;t=2006&amp;hilit=haar
&nbsp;
Some piratepads we used:
http://piratepad.nl/haarfinder
http://piratepad.nl/facedetection
&nbsp;
Final code that Sebastian created:
http://www.sendspace.com/file/uws6p9
&nbsp;
AUDIO SYNTHESIS ADD-ON
&nbsp;
http://www.maximilian.strangeloop.co.uk/
Andre Michelle's Pulsate; http://lab.andre-michelle.com/pulsate
&nbsp;
Fancy opengl particle stuff from Sebastian:
http://www.sendspace.com/file/rjgilt
&nbsp;
Basicly an extended opencv example that throws particle at the blobs :-)
To get it running, copy the opencv example and paste the files.
&nbsp;
ShadowFighter
peteruithoven.nl/shadowfighter/</pre>]]></description>
</item><item>
		<title>openFrameworks workshop at SETUP Utrecht (photos)</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>68d30a9594728bc39aa24be94b319d21guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Touch table: mounting the lasers</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>9778d5d219c5080b9a6a17bef029331cguid</guid>
		<description><![CDATA[<p>This week <a href="http://www.heijtmajer.com/">Tim</a> and I worked an a solution to mount the lasers onto the touch table which improves the fine-tuning. When using infra red lasers for a touch table it's extremely important to position the lasers in such a way that the beam is solid and just a little bit above the surface. Tim created a 3D model of the mount for the lasers using some bright solutions to fine tune the position vertically and horizontally.  Next weeks we will work on a couple of prototypes for these mounts.</p>

<p><img src="/assets/uploaded/468-laser3.jpg" width="640" alt="laser mount for multi touch table"></p>]]></description>
</item><item>
		<title>OpenFrameworks LAB @ Graphic Design Festival Breda</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>f033ab37c30201f73f142449d037028dguid</guid>
		<description><![CDATA[<p>Wow.... last two weeks have been amazing! Last week Martin and I went to the OF-Lab in Breda.  The OF-Lab was a workshop given by Zachery Lieberman and Todd Vanderlin, both inspiring creative-code researchers/artist. During this week we generated posters using code... with the awesome openFrameworks library.  I played around with a springy mesh to which I applied a texture.  We were coding around 10 hours a day! Had a great laugh with Tim Olden and Dirk van Oosterbosch.. I hope there will be something like this OF-Lab again soon!</p>

<p>Last Sunday I came back from the OF-lab and went to another workshop at Philips Lighting on Monday and Tuesday for which we are doing a project. We had a room in the fantastic Art Hotel just next the Philips building. They toilet and bath-tub were... well enormous.. like a swimming pool :).  From Wednesday until today (Sunday) Martin and I have been working on our new office (see the other post for some pictures), which is gonna be an amazing place!</p>]]></description>
</item><item>
		<title>New office space for Apollo </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>43ec517d68b6edd3015b3edc9a11367bguid</guid>
		<description><![CDATA[<p>Last week we signed the contract for our new office in Amsterdam! It's an amazing place on the first floor, next to the water on a quite road! We've been repainting everything. Today we painted the floor and our new logo onto the wall. We're looking for one/two other persons who want to share the space as we do have another room for rent!</p>]]></description>
</item><item>
		<title>Barbarian Group: Cinder</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>d1fe173d08e959397adf34b1d77e88d7guid</guid>
		<description><![CDATA[<p>Once in a while something big happens for creative coders.Way back we got <a href="www.processing.org">Processing</a>, then not so long ago we got the amazing <a href="http://www.openframeworks.cc">openFrameworks</a> (of which I'm a huge fan!) and yesterday we got <a href="http://libcinder.org">Cinder</a>, another beautiful c++, creative coding library.</p>

<p>The only comparable library is openFrameworks and it seems that Cinder aims at programmers with a bit more knowledge about openGL and C++.  Event handling seems similar, the general application flow is similar to openFrameworks (prepareSettings() → setup(), draw() → draw(), update() → update(), etc..). Though I notice one big difference; when I look at the Cinder code I see lots of direct openGL calls which one does not see in openFrameworks very often (at least not directly). Personally I like Cinders approach, though this is probably because I've been using openGL calls directly instead of openFrameworks wrapper functions (ofCircle/ofLine, etc..) as I needed to learn openGL.</p>

<p>The examples (46) which are shipped with Cinder are amazing! Some of these examples have been created by Robert Hodgins which are beautiful and it's nice to peek around in his code and learn from the "master".  There are many many more examples with some not-so-basic examples like shaders, voronoi, bump mapping, etc.. which are definitely worth checking out.</p>

<p>So if you're into creative coding make sure you download this library and give it a try!</p>

<p><em>Here are some screenshots of the example applications</em></p>]]></description>
</item><item>
		<title>Touchy Remix</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>35f4a8d465e6e1edc05f3d8ab658c551guid</guid>
		<description><![CDATA[<p>Last Friday Martin and I went to the Bright Night at Pakhuis de Zwijger in Amsterdam to see the touchy remix. The touchy remix is a touch table with with a fiber case. As we're working on a prototype touch table ourselves, I thought it was a good idea to see how the touchy remix looks and feels like. I've to say they Touchy looks nice! The casing is made of fiber kind of plastic which feels just nice. One of the benefits of this touch table is that one can use the touchy as a "real" desk, as in, you can put chairs underneath it.  I think the table is not high enough to use it as a regular desk, so you would probably use it as a standard touch table. The responsiveness of the table is.... not good.  I was dragging a picture around which suddenly jumped across the screen to the hand of someone else who stood on the other side of the table. I've not yet played around with optimizing blob-tracking, as this is what the touch table software does, but responsiveness would be my major concern. Maybe this is as good as it gets, which is not a problem when you don't sell these tables for a price around € 19.000, yes.. that's correct. The Touchy is highly overpriced. For that amount of money one wants to get a 100% working table. Not to mention the minor details in the design like the fans where you see the wires hanging around.  The Touchy is the first (public) release so they will probably need some time to work on these details. Still, the Touchy is one of the nicest touch tables I've seen so far!</p>]]></description>
</item><item>
		<title>Testing with lasers from AIXIZ (2)</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>fbd7939d674997cdb4692d34de8633c4guid</guid>
		<description><![CDATA[<p>I've mailed a couple of times with AIXIZ and I've to say: "Nice guys over there!".  The laser I used to test my setup, was somehow broken and AIXIZ offered to send me a new one! Very nice and good job of AIXIZ! I just did another test with another laser and the result is perfect! The laser is extremely powerfull and bright as you can see in the image. In a couple of days I'll try to hookup the laser to the prototype of the touch table so I can start doing some real tests.</p>

<p>Chuck form AIXIZ told me that one can connect the 780nm 25mW 5VDC infrared laser directly to +5v. When you connect your laser, make sure to use a stabilized power supply, or use a LM7805 to stabilze the input. When you use a LM7805, make sure you set your power supply to a voltage which is a higher than 5v so the LM780 can stabilize it.</p>]]></description>
</item><item>
		<title>openFrameworks freakDay 8 / 9 ? @ Amsterdam</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>28dd2c7955ce926456240b2ff0100bdeguid</guid>
		<description><![CDATA[<p>Last Sunday (18-04-2010) we another openFrameworks freakDay with our newest member <a href="http://www.arttech.nl">Mattijs Kneppers</a> who created an event sequencer while trying openFrameworks for the first time.. really amazing work! In a couple of weeks we'll organize another openFrameworks freakDay in amsterdam. You can contact me if you want to join! of course you're more than welcome!</p>

<p><img src="/assets/uploaded/345-dsc00623.jpg" alt="DSC00623.JPG" class="" title="DSC00623.JPG"></p>]]></description>
</item><item>
		<title>Touch Table inlays for lasers</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>d09bf41544a3365a46c9077ebb5e35c3guid</guid>
		<description><![CDATA[<p><a href="http://www.heijtmajer.com/">Tim</a> created an inlay to keep the lasers in their place for the laser based touch table we are working on. The inlay looks really good even when it's just a prototype and a "quick" solution to test how we can position the laser in the most suitable way. We also did a test with another laser to check if the other laser we were testing with so far, was broken. The new laser seems to be much better and gives an extremely sharp dot.  I've contacted <a href="http://www.aixiz.com/">AIXIZ</a>, where we bought the lasers, and am waiting for some technical specs for the 780nm 25mW laser we want to use. A nice thing to mention is that the ultra cheap Trust webcam (WT-1400), we're using to check if the lasers are working is sensitive to 780nm IR.</p>]]></description>
</item><item>
		<title>Testing with lasers from AIXIZ</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>ad61ab143223efbc24c7d2583be69251guid</guid>
		<description><![CDATA[<p>Working on a touch table project I'm testing 780nm 25mW lasers from AIXIZ at the moment. Though somehow I cannot get a bright line from the lasers. I've tested only with two lasers and got the same result sadly. I'll try to use another laser later, or next week and get better results hopefully.  I found some links which describe the same problem. Also some people wrote very nice posts about using lasers for multi touch.</p>

<ul>
<li>http://nuigroup.com/forums/viewthread/8650/</li>
<li>http://nuigroup.com/forums/viewthread/9386/</li>
</ul>]]></description>
</item><item>
		<title>Edge Bundling v2.</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>d2ddea18f00665ce8623e36bd4e3c7c5guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>openFrameworks Freakday @ Amsterdam</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>e2c420d928d4bf8ce0ff2ec19b371514guid</guid>
		<description><![CDATA[<p>Last sunday we had an openFrameworks meeting at <a href="http://www.blendid.nl">Tim's</a> place near the Bijenkorf in Amsterdam. Theo gave a talk about the newest iPhone version which, again, is great! It simplifies iPhone development and keeps the openFrameworks paradigm! Simple and fast! I did some tests with, as stated by the paper I read about it "Hierachical Edge Bundles: Visualization of Adjacency Relations in Hierarchical Data" and "Force-Directed Edge Bundling for Graph Visualization" by Danny Holten.</p>

<p>Together with Tim, Rick , Martin, Theo and myself we had a very nice, spontaneous oF FreakDay.</p>]]></description>
</item><item>
		<title>Hierachical edge bundling of network data</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>32bb90e8976aab5298d5da10fe66f21dguid</guid>
		<description><![CDATA[<p>Playing with <a href="http://www.win.tue.nl/~dholten/papers/forcebundles_eurovis.pdf">Force-Directed Edge Bundling for Graph Visualization</a>. Not working yet, but the result is nice; as most  unexpected things.</p>]]></description>
</item><item>
		<title>Infrared webcam </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>7cbbc409ec990f19c78c75bd1e06f215guid</guid>
		<description><![CDATA[<p>As I'm still working on my multi-touch table I've created an infrared webcam to do some tests. My table will use IR lasers as this should give the best results. I heard of projects which got the same feeling as the iphone. I have two webcams: an old Logitech Quickcam Pro, and a Trust WT-1400.  I started with the Quickcam but found out that the IR-filter I wanted to remove is a coating on the lens itself.  I don't have the tools to remove that coating and leave the lens intact. Therefore I gave my Trust webcam a try wich was very simple to turn into a IR cam. The only thing you should be careful of when removing the IR filter (the tiny square glass with shiny surface), is that you only remove part of the plastic body so you can put everything back into it's place again. Basically you get a sharp knife and remove a couple of rings from the lens "holder". Then using a sharp thing; I used a screw driver, you popup off the lens, remove the IR filter, create a light blocking filter using a floppy disc and put everying w/o the IR filter back together. I was suprised when I hooked up my cam; the light blocking filter, which I made from a floppy disc, works extremelly well.</p>]]></description>
</item><item>
		<title>Barnes Hut Algorithm</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>14bfa6bb14875e45bba028a21ed38046guid</guid>
		<description><![CDATA[<p>I'm working on a magnetic particle system and got my first version working last week. The next step is to improve the particle system so I can use more than ~300 paticles with a framerate higher then 30fps. The problem with particle systems and particle-particle interaction is that we have O(n²) problem.. This just means that the number of computations increases extremely when adding more particles.  When we have 2 particles, the number of particle-particle computation is 2², when we've got 300 particles, we've got 300² = 90.000 checks we have to perform for each frame.</p>

<p>To get more particles in my system with a reasonable framerate (above 30fps),  we need to find a way to decrease the number of particle-particle interaction without loss losing the visual effect. Well thankfully I don't have to come up with this myself as Barnes Hut created a algorithm which does exactly that!  The general idea behind this solution is described on this <a href="http://www.eecs.berkeley.edu/~demmel/cs267/lecture26/lecture26.html">lecture on Barnes Hut</a>.</p>

<p><a href="http://kylemcdonald.net/">Kyle McDonald</a> created an implemenation of this algorithm that you can <a href="http://code.google.com/p/kyle/source/browse/#svn/trunk/openframeworks/apps/demos/BarnesHut">download from google code</a>.  I need to tune this code in such a way that I can use my Coulomb forces to get the nice magnetic interaction I got in my previous application. I'll start by implementing the Barnes Hut algorithm for 2D which uses a quad tree data structure.</p>

<p>So I got a pencil and paper and started drawing and trying to understand the quad tree class.  The first steps of the Barnes Hut algorithm (BH), is to device all the particles in separate nodes. A node is defined by the positions of the particles. Each node can have a maximum of 4 children which are the sub-squares in a node (as it's called a quad tree, this makes kind of sense). So lets say we got a application with a size of 640x480 and 6 particles randomly positioned in 2D.</p>

<p><em>Like this</em><br />
<img src="/assets/uploaded/303-barneshut_1.png" alt="barneshut_1.png" class="" title="barneshut_1.png"></p>

<p>Next step is to create our "root" tree node. We start by creating a new Tree object and start by finding the min_x, min_y, max_x and max_y positions, which are just the four corners of the space in which the particles are positioned. Therefore we need to get access to all the particles. For convenience I stored them in a vector<Particle*> particles, member in my testApp.cpp (see <a href="http://www.openframeworks.cc">openframeworks</a>).  The outer border in the image below shows the space that is confined by the min_x, min_y and max_x, max_y values.  So okay, we've got our first single quadrant, what now? Well now we need to create continue to create new Tree nodes as long as there are tree nodes that have more than 1 particle in in. So where do start with that? Well, a rough sketch will be something like this:</p>

<p><em>In pseudo code</em></p>

<pre class="c"><span style="color: #993333;">void</span> createTree<span style="color: #66cc66;">&#40;</span>vector&lt;Particle*&gt; particles<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
   - <span style="color: #b1b100;">for</span> each particle P <span style="color: #b1b100;">do</span> 
       - processParticle<span style="color: #66cc66;">&#40;</span>P<span style="color: #66cc66;">&#41;</span>
  - end loop
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// process the particle and check if we need to create subnodes</span>
<span style="color: #993333;">void</span> processParticle<span style="color: #66cc66;">&#40;</span>Particle* P<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
 <span style="color: #66cc66;">&#125;</span></pre>

<p>The processParticle() function is tricky as this is where we implement the recursion. First thing I implement when creating a recursive function is the return or stop rule as we don't want our recursion to go on forever. Well, when is a node "ready"? A node is ready when it's is sub-divided into 4 quadrants. But then when do we divide the current node into 4 quadrants. When we think about what we want to accomplish: implement a divide an conquer like algorithm, we need to divide the particles onto the quadrants.  Why? I hear you thinking.. well placing the particles into sub nodes is what makes the Barnes Hut algorithm so powerful. An example: lets say you have 10.000 particles and you want to have particle-particle interaction and especially a gravitational force. Also imagine that 9.999 of these particles are position at 400,400 (x,y) and only one particle is positioned at 10,10(x,y). Then, you could of course check each particle against each other particle ... .or you just check the particle at 10,10 against one of the other 9.999 particles.. that's a lot less checks you need to perform. This isn't exactly how BH works, though it's a simpler to see it like this. I'll explain more about BH below.</p>

<p><em>pseudo code</em></p>

<pre class="c"><span style="color: #993333;">void</span> ProcessParticle<span style="color: #66cc66;">&#40;</span>Particle* P<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>num_children &gt; MAX_CHILDREN_PER_NODE<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 <span style="color: #66cc66;">&#125;</span>
 <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #808080; font-style: italic;">// okay we are not yet ready, do some work. </span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>

<p>So when we do not have 4 children we start working. But what do we actually need to do? At the end we want each node in the tree to have at least one particle OR no particle  at all. A node will have no particle when it has sub nodes; so when it's subdivided into four.  We need to create subn odes, when we have already 4 particles stored and the 5th particle is given to us. Creating sub nodes involves dividing our space (the min_x, min_y, max_x, max_y) into four separate nodes. For this we need to know what space each of the sub nodes get, well this is not the hardest part so I'll paste the helpers functions down here.</p>

<p><em>Calculating the center x/y and 4 corner positions</em></p>

<pre class="c"><span style="color: #993333;">void</span> Tree::<span style="color: #202020;">squareBoundaries</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #993333;">float</span> center_x = <span style="color: #66cc66;">&#40;</span>min_x + max_x<span style="color: #66cc66;">&#41;</span>/<span style="color: #cc66cc;">2</span>;
    <span style="color: #993333;">float</span> center_y = <span style="color: #66cc66;">&#40;</span>min_y + max_y<span style="color: #66cc66;">&#41;</span>/<span style="color: #cc66cc;">2</span>;
    <span style="color: #993333;">float</span> size_x = max_x - min_x;
    <span style="color: #993333;">float</span> size_y = max_y - min_y;
    <span style="color: #993333;">float</span> size = max<span style="color: #66cc66;">&#40;</span>size_x, size_y<span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;">2</span>;
    min_x = center_x - size;
    max_x = center_x + size;
    min_y = center_y - size;
    max_y = center_y + size;
    setCenter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// Set center and size</span>
<span style="color: #993333;">void</span> Tree::<span style="color: #202020;">setCenter</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    center_x = <span style="color: #66cc66;">&#40;</span>min_x + max_x<span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;">2</span>;
    center_y = <span style="color: #66cc66;">&#40;</span>min_y + max_y<span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;">2</span>;
    size = max_x - min_x;
<span style="color: #66cc66;">&#125;</span></pre>

<p>Now we have these positions and the center of our space, we can create the sub nodes for our children, which is done like this:</p>

<p>**Creating sub nodes (pseude code) **</p>

<pre class="c"><span style="color: #993333;">void</span> ProcessParticle<span style="color: #66cc66;">&#40;</span>Particle* P<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>num_children &gt; MAX_CHILDREN_PER_NODE<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    nw = new Tree<span style="color: #66cc66;">&#40;</span>min_x, min_y, center_x, center_y<span style="color: #66cc66;">&#41;</span>;
    ne = new Tree<span style="color: #66cc66;">&#40;</span>center_x, min_y, max_x, center_y<span style="color: #66cc66;">&#41;</span>;
    sw = new Tree<span style="color: #66cc66;">&#40;</span>min_x, center_y, center_x, max_y<span style="color: #66cc66;">&#41;</span>;
    se = new Tree<span style="color: #66cc66;">&#40;</span>center_x, center_y, max_x, max_y<span style="color: #66cc66;">&#41;</span>;
    has_children = <span style="color: #000000; font-weight: bold;">true</span>;
    <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i &lt; num_particles; ++i<span style="color: #66cc66;">&#41;</span>
        processParticle<span style="color: #66cc66;">&#40;</span>particles<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
    num_particles = <span style="color: #cc66cc;">0</span>;
    processParticle<span style="color: #66cc66;">&#40;</span>pParticle<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
         <span style="color: #808080; font-style: italic;">// okay we are not yet ready, do some work. </span>
     particles<span style="color: #66cc66;">&#91;</span>num_particles<span style="color: #66cc66;">&#93;</span> = pParticle;
     num_children++;
     empty = <span style="color: #000000; font-weight: bold;">false</span>;
 <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>

<p>As you can see, we first keep track of the particles in an array called "particles". Though when we are separated into 4 other nodes, we pass the particles which were given to us, to one of our sub nodes in such a way that they are placed in the correct quadrant based on the position of each particle. This is where the recursion starts working. This is what we will do for each of the particles that is given to use by the createTree() function. For example, the root node has 4 sub nodes, and those sub nodes also have 4 sub nodes. When we get a new particle, we don't want to add it to our self, but we want to pass it through to our sub nodes. We first check which sub node is responsible for this particle which is done by checking the position of the particle against the rectangle/space each of our sub nodes. Then the sub node also checks if it needs to handle this particle etc.. etc... So at the end each particle is passed along to all of the sub nodes until it cant be divided any more. After that we've got a nice tree with particles!</p>

<p>But, when do we know if we need to pass the particle along to our sub nodes? You can do this by simply checking if you have sub nodes. So therefore we first need to have something where we store sub nodes.  As you probably already saw, we have four members called "nw, ne, sw and se" that are of the same type as the main node (Tree). 
In pseudo code, we would add something like this to the processParticle() function:</p>

<p><strong>Pseudo code: check if we need to pass the particle to one of our sub nodes</strong></p>

<pre class="c"><span style="color: #993333;">void</span> ProcessParticle<span style="color: #66cc66;">&#40;</span>Particle* P<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>nw != <span style="color: #000000; font-weight: bold;">NULL</span> &amp;&amp; ne != <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
       <span style="color: #808080; font-style: italic;">// pass the particle to one of the quadrants. Pass it to the quadrant which is responsible for the space where the particle is placed. </span>
       ofxVec3f pos = pParticle-&gt;position;
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>pos.<span style="color: #202020;">x</span> &lt; center_x<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>pos.<span style="color: #202020;">y</span> &lt; center_y<span style="color: #66cc66;">&#41;</span> 
            nw-&gt;addParticle<span style="color: #66cc66;">&#40;</span>pParticle<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">else</span> 
            sw-&gt;addParticle<span style="color: #66cc66;">&#40;</span>pParticle<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>pos.<span style="color: #202020;">y</span> &lt; center_y<span style="color: #66cc66;">&#41;</span>
            ne-&gt;addParticle<span style="color: #66cc66;">&#40;</span>pParticle<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">else</span> 
            se-&gt;addParticle<span style="color: #66cc66;">&#40;</span>pParticle<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #808080; font-style: italic;">// continue to populate ourself</span>
   <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>num_children &gt; MAX_CHILDREN_PER_NODE<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    nw = new Tree<span style="color: #66cc66;">&#40;</span>min_x, min_y, center_x, center_y<span style="color: #66cc66;">&#41;</span>;
    ne = new Tree<span style="color: #66cc66;">&#40;</span>center_x, min_y, max_x, center_y<span style="color: #66cc66;">&#41;</span>;
    sw = new Tree<span style="color: #66cc66;">&#40;</span>min_x, center_y, center_x, max_y<span style="color: #66cc66;">&#41;</span>;
    se = new Tree<span style="color: #66cc66;">&#40;</span>center_x, center_y, max_x, max_y<span style="color: #66cc66;">&#41;</span>;
    has_children = <span style="color: #000000; font-weight: bold;">true</span>;
    <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i &lt; num_particles; ++i<span style="color: #66cc66;">&#41;</span>
        processParticle<span style="color: #66cc66;">&#40;</span>particles<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
    num_particles = <span style="color: #cc66cc;">0</span>;
    processParticle<span style="color: #66cc66;">&#40;</span>pParticle<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
         <span style="color: #808080; font-style: italic;">// okay we are not yet ready, do some work. </span>
     particles<span style="color: #66cc66;">&#91;</span>num_particles<span style="color: #66cc66;">&#93;</span> = pParticle;
     num_children++;
     empty = <span style="color: #000000; font-weight: bold;">false</span>;
 <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>

<p>In Kyles implementation he uses a member "hasChildren" instead of using the sub node members (nw,ne,sw,se) to check if we need to pass the particle to one of our sub nodes. This is totally okay and I only didn't do it here to keep the code as clear as possible.</p>

<p>Pffffeww this was the first part of the algorithm: creating the tree structure.</p>

<p>In a couple of weeks I'll continue with the next steps of the Barnes Hut algorithm.</p>]]></description>
</item><item>
		<title>Exploding MAC battery</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>a3f390d88e4c41f2747bfa2f1b5f87dbguid</guid>
		<description><![CDATA[<p>After 1.5 year the battery of my mac book <strong>puffed</strong> as how they called it. I never heard about it but it seems to be a regular problem. Sadly Apple just ignores this problem which is problem due to heating. I had to buy a new battery ... I hope this one will not puff</p>]]></description>
</item><item>
		<title>Coulombs law</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>735b90b4568125ed6c3f678819b6e058guid</guid>
		<description><![CDATA[<p>Yesterday I was playing around with some real electronics, but today I have been playing with some the simulation of electrostatic particles.</p>

<p><img src="/assets/uploaded/298-attraction_0082.png" alt="attraction_0082.png" class="" title="attraction_0082.png"></p>

<p>I'm using <a href="http://en.wikipedia.org/wiki/Coulomb's_law">Coulomps law</a> to create hundred particles which have a charge. In the center of these particles there's the center of gravity. All particles are attracted to this center point, but they also keep a distance from each other based on the their chage and the force I calculate using Coulomb's law.  Note that this is a my implementation of Coulomb's law, where I use 10 for the constant which you can change if you want more or less attraction.</p>

<pre class="c"><span style="color: #993333;">float</span> c = <span style="color: #cc66cc;">10.0</span> * charge * pMagnet-&gt;getCharge<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #66cc66;">&#40;</span>r*r<span style="color: #66cc66;">&#41;</span>;
ofxVec3f dir_tmp = dir;
<span style="color: #993333;">float</span> aa = c/mass;
dir_tmp.<span style="color: #202020;">normalize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">scale</span><span style="color: #66cc66;">&#40;</span>aa<span style="color: #66cc66;">&#41;</span>;
&nbsp;
velocity.<span style="color: #202020;">x</span> += dir_tmp.<span style="color: #202020;">x</span>;
velocity.<span style="color: #202020;">y</span> += dir_tmp.<span style="color: #202020;">y</span>;</pre>

<p>So in short this effect is created in 3 simple steps:</p>

<ul>
<li>Loop over all particles and let each particle move towards or away from all the other particles based on Coulombs law.</li>
<li>When all particles have reacted on the other particles using the Coulombs law, we gravitate towards a center particle. I'm only using the center particle to get the position of it, so I know towards I need to attract it. It's important that we add a bit of simple drag in this gravitate() function (like velocity *= 0.96) as we want to particles to come to rest slowly. Without this drag the particles will bounce around only.   </li>
<li>Then the last step is to update the position of the particles (position += velocity) and that's it.  </li>
</ul>

<p><strong>The particle class</strong></p>

<pre class="c"><span style="color: #339933;">#include &quot;Particle.h&quot;</span>
Particle::<span style="color: #202020;">Particle</span><span style="color: #66cc66;">&#40;</span>ofxVec3f oPosition, <span style="color: #993333;">float</span> fMass, ofImage oImage, ofImage oShineImage<span style="color: #66cc66;">&#41;</span>
    :position<span style="color: #66cc66;">&#40;</span>oPosition<span style="color: #66cc66;">&#41;</span>
    ,img<span style="color: #66cc66;">&#40;</span>oImage<span style="color: #66cc66;">&#41;</span>
    ,mass<span style="color: #66cc66;">&#40;</span>fMass<span style="color: #66cc66;">&#41;</span> 
    ,attract<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>
    ,enabled<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>
    ,charge<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>.0f<span style="color: #66cc66;">&#41;</span>
    ,shine_img<span style="color: #66cc66;">&#40;</span>oShineImage<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
&nbsp;
    img.<span style="color: #202020;">setAnchorPoint</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #202020;">getWidth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>/<span style="color: #cc66cc;">2</span>,img.<span style="color: #202020;">getHeight</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>/<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>; 
    inverse_mass = <span style="color: #cc66cc;">1</span>/fMass;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">disable</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    enabled = <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">enable</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    enabled = <span style="color: #000000; font-weight: bold;">true</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
bool Particle::<span style="color: #202020;">isEnabled</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> enabled;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    vector&lt;Shine*&gt;::<span style="color: #202020;">iterator</span> it = shines.<span style="color: #202020;">begin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>it != shines.<span style="color: #202020;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;isDead<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            delete <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>;
            it = shines.<span style="color: #202020;">erase</span><span style="color: #66cc66;">&#40;</span>it<span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #66cc66;">&#125;</span>
        <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;position = position;
            <span style="color: #66cc66;">&#40;</span>*it<span style="color: #66cc66;">&#41;</span>-&gt;draw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            ++it;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>charge &lt;= <span style="color: #cc66cc;">2</span>.0f<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>enabled<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.1</span>,<span style="color: #cc66cc;">1</span>.,.<span style="color: #cc66cc;">1</span>,.<span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
        <span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
            glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">0.0</span>,<span style="color: #cc66cc;">0.0</span>,.<span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
        glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.0</span>, <span style="color: #cc66cc;">1.0</span>, <span style="color: #cc66cc;">1.0</span>, .<span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
        glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.1</span>,<span style="color: #cc66cc;">1</span>.,.<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    img.<span style="color: #202020;">draw</span><span style="color: #66cc66;">&#40;</span>position.<span style="color: #202020;">x</span>, position.<span style="color: #202020;">y</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">update</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!enabled<span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">return</span>;
    position += velocity;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">addForce</span><span style="color: #66cc66;">&#40;</span>ofxVec3f oForce<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    forces += <span style="color: #66cc66;">&#40;</span>oForce*inverse_mass<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">float</span> Particle::<span style="color: #202020;">getMass</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> mass;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
ofxVec3f Particle::<span style="color: #202020;">getPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> position;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">setPosition</span><span style="color: #66cc66;">&#40;</span>ofxVec3f oPos<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    position = oPos;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">float</span> Particle::<span style="color: #202020;">getCharge</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> charge;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">setCharge</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span> fCharge<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    charge = fCharge;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">gravitate</span><span style="color: #66cc66;">&#40;</span>Particle* pTo<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// gravitational force</span>
    ofxVec3f dir = pTo-&gt;getPosition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> - position;
    <span style="color: #993333;">float</span> f = <span style="color: #66cc66;">&#40;</span>pTo-&gt;attract<span style="color: #66cc66;">&#41;</span> ? <span style="color: #cc66cc;">0.6</span> : <span style="color: #cc66cc;">-0.3</span>;
    dir.<span style="color: #202020;">normalize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">scale</span><span style="color: #66cc66;">&#40;</span>f<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// the higher gravitational attraction, the faster the particles are attracted to the center. Tested values: 0.1 - 0.8</span>
    velocity *= <span style="color: #cc66cc;">0.91</span>;  <span style="color: #808080; font-style: italic;">// the particles are first attracted by magnetic forces, then gravitated. We need to implement this simple drag force because else the particles will &quot;explode&quot;. Tested values: 0.91 - 0.99</span>
    velocity.<span style="color: #202020;">x</span> += dir.<span style="color: #202020;">x</span>;
    velocity.<span style="color: #202020;">y</span> += dir.<span style="color: #202020;">y</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Particle::<span style="color: #202020;">testMagnet</span><span style="color: #66cc66;">&#40;</span>Particle* pMagnet<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>pMagnet == this<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">return</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #808080; font-style: italic;">// coulombs law</span>
    ofxVec3f dir =  position -  pMagnet-&gt;getPosition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    ofxVec3f dir2 = dir;
    <span style="color: #993333;">float</span> r = dir.<span style="color: #202020;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #993333;">float</span> e = charge/<span style="color: #66cc66;">&#40;</span>r*r<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>e &gt; <span style="color: #cc66cc;">0.01</span><span style="color: #66cc66;">&#41;</span>
        e = <span style="color: #cc66cc;">0.01</span>;
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>e &lt; <span style="color: #cc66cc;">-0.01</span><span style="color: #66cc66;">&#41;</span>
        e = <span style="color: #cc66cc;">-0.01</span>;
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>r &lt; <span style="color: #cc66cc;">20</span> &amp;&amp; shines.<span style="color: #202020;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> &lt; <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        shines.<span style="color: #202020;">push_back</span><span style="color: #66cc66;">&#40;</span>new Shine<span style="color: #66cc66;">&#40;</span>shine_img, <span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* 
    Coulomb law implementation  (roxlu: see thsi page: http://processing.org/discourse/yabb/YaBB.cgi?board=Contribution_Simlation;action=display;num=1082567431, where they talk about electric fields but if I'm correct it's just coulombs law)
    ===========================
    float c = 10.0 * charge * pMagnet-&gt;getCharge() / (r*r);
    ofxVec3f dir_tmp = dir;
    float aa = c/mass;
    dir_tmp.normalize().scale(aa);
&nbsp;
    velocity.x += dir_tmp.x;
    velocity.y += dir_tmp.y;
    */</span>
&nbsp;
    <span style="color: #993333;">float</span> f = charge * e;
    <span style="color: #993333;">float</span> a = f/mass * <span style="color: #cc66cc;">60.0</span>; <span style="color: #808080; font-style: italic;">// the acceleration, the higher the bigger influence the magnetic forces have on each of the particles.s</span>
    dir.<span style="color: #202020;">normalize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">scale</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#41;</span>;
    velocity.<span style="color: #202020;">x</span> += dir.<span style="color: #202020;">x</span>;
    velocity.<span style="color: #202020;">y</span> += dir.<span style="color: #202020;">y</span>;
&nbsp;
&nbsp;
    <span style="color: #808080; font-style: italic;">/*
&nbsp;
    coulomps force
    ==============
    F = k * q1 * q2 / r^2
&nbsp;
    gravity
    =======
    f = G * mass1 * mass2 / distance^2
&nbsp;
&nbsp;
     magnetism (lorentz)
     ====================
&nbsp;
     E = [some constant] * (q / r^2)
     E = electrical field value
     q = charge of particle generating the field.
     r = distance to the charged particle (which is the magnet)
&nbsp;
     Fb = Q * E  
     Fb = magnetic force
     Q = charge of particle itself
&nbsp;
&nbsp;
     for (var i:uint=0; i&lt;totalSent; i++){
            if (i != index){
                    R           = getDistance(particles[i].getX, particles[i].getY, _x, _y);
                    E           = ye[i].getQ/(R*R);
                    if (E &lt; -0.01){
                        E       = -0.01;
                    } else if (E &gt; 0.01){
                        E       = 0.01;
                    }
                    F           = Q * E;
                    A           = F/M * 10;
                    Angle       = getAngle(particles[i].getX, particles[i].getY, _x, _y);
&nbsp;
                    xv          += Math.cos(Angle) * A;
                    yv          += Math.sin(Angle) * A;
            }
        }
*/</span>   
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre>

<p><strong>Flights 404 code</strong></p>

<pre class="java"><span style="color: #000000; font-weight: bold;">class</span> MagneticParticle <span style="color: #66cc66;">&#123;</span>
  GravityField gravity;
  <span style="color: #993333;">int</span> index;
  <span style="color: #993333;">float</span> x, y;
  <span style="color: #993333;">float</span> xv, yv;
  <span style="color: #993333;">float</span> E, R, F, P, A, Angle, Q, M;
  <span style="color: #993333;">float</span> gAngle;
  <span style="color: #993333;">float</span> gTheta;
  <span style="color: #993333;">float</span> gxv;
  <span style="color: #993333;">float</span> gyv;
&nbsp;
  MagneticParticle <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> indexSent, <span style="color: #993333;">float</span> xSent, <span style="color: #993333;">float</span> ySent, GravityField gravitySent<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    index      = indexSent;
    x          = xSent;
    y          = ySent;
    gravity    = gravitySent;
    M          = <span style="color: #cc66cc;">1.0</span>;
    Q          = <span style="color: #cc66cc;">1.0</span>;
    xv         = random<span style="color: #66cc66;">&#40;</span>-.<span style="color: #cc66cc;">5</span>, .<span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;
    yv         = random<span style="color: #66cc66;">&#40;</span>-.<span style="color: #cc66cc;">5</span>, .<span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #993333;">void</span> field<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i=<span style="color: #cc66cc;">0</span>; i&lt;totalParticles; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>i != index<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        R          = dist<span style="color: #66cc66;">&#40;</span>particles<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">x</span>, particles<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">y</span>, x, y<span style="color: #66cc66;">&#41;</span>;
        E          = constrain<span style="color: #66cc66;">&#40;</span>particles<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">Q</span>/<span style="color: #66cc66;">&#40;</span>R*R<span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">-0.01</span>, <span style="color: #cc66cc;">0.01</span><span style="color: #66cc66;">&#41;</span>;
        F          = Q * E;
        A          = F/M * <span style="color: #cc66cc;">10.0</span>;
&nbsp;
        Angle      = atan2<span style="color: #66cc66;">&#40;</span>y - particles<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">y</span>, x - particles<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        xv         += cos<span style="color: #66cc66;">&#40;</span>Angle<span style="color: #66cc66;">&#41;</span> * A;
        yv         += sin<span style="color: #66cc66;">&#40;</span>Angle<span style="color: #66cc66;">&#41;</span> * A;
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    xv *= .<span style="color: #cc66cc;">96</span>;
    yv *= .<span style="color: #cc66cc;">96</span>;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
  <span style="color: #993333;">void</span> applyGravity<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    gAngle         = atan2<span style="color: #66cc66;">&#40;</span>gravity.<span style="color: #006600;">y</span> - y, gravity.<span style="color: #006600;">x</span> - x<span style="color: #66cc66;">&#41;</span>;
    gxv            = cos<span style="color: #66cc66;">&#40;</span>gAngle<span style="color: #66cc66;">&#41;</span> * gravity.<span style="color: #006600;">Q</span>;
    gyv            = sin<span style="color: #66cc66;">&#40;</span>gAngle<span style="color: #66cc66;">&#41;</span> * gravity.<span style="color: #006600;">Q</span>;
    xv            += gxv;
    yv            += gyv;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #993333;">void</span> move<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    x             += xv;
    y             += yv;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #993333;">void</span> render<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    stroke<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
    line<span style="color: #66cc66;">&#40;</span>x<span style="color: #cc66cc;">-1</span>, y, x<span style="color: #cc66cc;">+1</span>, y<span style="color: #66cc66;">&#41;</span>;
    line<span style="color: #66cc66;">&#40;</span>x, y<span style="color: #cc66cc;">-1</span>, x, y<span style="color: #cc66cc;">+1</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>]]></description>
</item><item>
		<title>Womby 0.1</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>3295c76acbf4caaed33c36b1b5fc2cb1guid</guid>
		<description><![CDATA[<p>Together with Bas Pijls, we're working on a simple prototype shield for the <a href="http://www.arduino.cc">Arduino</a>. With our shield, code-named Womby, you can use your Arduino to program another AVR chip. We're using an Attiny2313. You can use this board, for example, when you're working on a project where you need more than one arduino/avr.</p>

<p>Using this board you can program as much attinies as you want and use those in your project. Programming an attiny2313 is kind of similar as programming the Arduino. The nice thing about this design is that you can create your own "arduino" like board for a 10th of the costs. You can also program those nice attiny45.</p>]]></description>
</item><item>
		<title>Photoshop layers to PNG</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>fc490ca45c00b1249bbe3554a4fdf6fbguid</guid>
		<description><![CDATA[<p>I had to export around 100 layers to transparent PNG images and created an addon for Photoshop CS 4 which exports layers to transparent PNG images.  There is a export layers script in photoshop by default, though this did not work on my Mac 10.6 as all files were overwritten. Therefore I created a simple addon that does this job.</p>

<h2>How it works</h2>

<p>You create a group with a name like "footer", then in that group you create layers with names like "logo", "counter" etc.. The addon will export the layers to files, which get the name from the group and the layer, so: "footer_logo.png", "footer_counter.png" etc.  The addon only works for one level deep layers. So when you don't want to export some layers put them in a 2nd level layer set.</p>

<h2>Installation (Mac, will also work on Windows)</h2>

<p>Download the file below and copy it to your <strong>Applications\Adobe Photoshop CS4\Presets\Scripts</strong> directory and restart photoshop.</p>

<p>Download <a href="/assets/uploaded/234-export_to_png.zip">export_layer_to_png.zip</a></p>]]></description>
</item><item>
		<title>Sphere, particles and billboarding</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>ea5d2f1c4608232e07d3aa3d998e5135guid</guid>
		<description><![CDATA[<p>Implemented (cheating) billboards into the particle sphere application. While playing the openGL games I'm making some progress. I've attached some screenshots of my current work.
All credits should go to Robert Hodging of flight404 as I'm solely trying to rebuild his work to learn openGL.</p>]]></description>
</item><item>
		<title>Brother 2030 toner problem</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>44f683a84163b3523afe57c2e008bc8cguid</guid>
		<description><![CDATA[<p>A year ago I bought a Brother 2030HL printer... after a year I needed to replace my toner which I did.  After printer like 100 pages in 3 months the toner light went on again, indicating I had to replace my toner again. I checked my toner but couldn't find anything strange so I called the tech support which walked me through a couple of steps and tada! I can print again. I went googling and found an other post where someone describes what his tech guy told him. It's a little different as I needed to press 6 times instead of 5..</p>

<ul>
<li>Turn power off</li>
<li>Make sure the paper tray is full and the toner+drum are in the printer</li>
<li>Push the GO button and turn on the device</li>
<li>Wait until all 3 lights are lit, then release the GO button</li>
<li>Press the GO button twice</li>
<li>All lights turn solid</li>
<li>With all solid, press GO 6 times</li>
<li>Ready light goes red</li>
<li>Close front panel and you're ready</li>
<li>Not necessary:  press 3 times to get a print page with statistics.</li>
</ul>]]></description>
</item><item>
		<title>3D Billboarding</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>03afdbd66e7929b125f8597834fa83a4guid</guid>
		<description><![CDATA[<p>Currently I'm reading up on billboarding in openGL. Billboarding is a method to create 3D shapes, mostly QUADS which face the camera so the appear 2D. This technique is used to draw particles for example. To understand billboarding one has to know about openGL rotation matrices, vector math and how openGL projects 3D coordinates to your screen.</p>

<p>Some articles on 3D billboarding:</p>

<ul>
<li><a href="http://nehe.gamedev.net/data/articles/article.asp?article=19">NeHe billboarding</a></li>
<li><a href="http://www.lighthouse3d.com/opengl/billboarding/">LightHouse billboarding</a> </li>
</ul>]]></description>
</item><item>
		<title>glRotatef</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>7f39f8317fbdb1988ef4c628eba02591guid</guid>
		<description><![CDATA[<p>glRotatef(angle, x,y,z) is used to rotate vertices around the axes defined by x,y,z where the values come from a normalized vector3.  I used this to rotated the textures that are drawn into a GL_QUAD on the sphere. I'm talking about the nebula textures.  I need to figure out how to rotate the QUAD because I want to draw a couple of nebula images into a quad that is drawn like a billboard (google on opengl billboarding). This creates the foggy effect in this video on Vimeo: <a href="http://vimeo.com/634725">http://vimeo.com/634725</a></p>

<p>Of course when one knows how to do this it's easy... but you have to understand the concept.  A big mistake I made was using 'world' values for the position of the particles when I rotated them. This  was easily solved by removing the particle position from the four vec3 positions of the QUAD and then using something like:</p>

<pre class="c"><span style="color: #993333;">void</span> Particle::<span style="color: #202020;">draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
glPushMatrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
  glTranslatef<span style="color: #66cc66;">&#40;</span>particle_position.<span style="color: #202020;">x</span>, particle_position.<span style="color: #202020;">y</span>, particle_position.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
  glRotate<span style="color: #66cc66;">&#40;</span>angle, normal.<span style="color: #202020;">x</span>, normal.<span style="color: #202020;">y</span>, normal.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
  glVertex3f<span style="color: #66cc66;">&#40;</span>p1.<span style="color: #202020;">x</span>, p1.<span style="color: #202020;">y</span>, p1.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
  glVertex3f<span style="color: #66cc66;">&#40;</span>p2.<span style="color: #202020;">x</span>, p2.<span style="color: #202020;">y</span>, p2.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
  glVertex3f<span style="color: #66cc66;">&#40;</span>p3.<span style="color: #202020;">x</span>, p3.<span style="color: #202020;">y</span>, p3.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
  glVertex3f<span style="color: #66cc66;">&#40;</span>p4.<span style="color: #202020;">x</span>, p4.<span style="color: #202020;">y</span>, p4.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
glPopMatrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>

<p>When you look at the code and the image, these are the values what the variable represent (they are mostly vector3 objects):</p>

<ul>
<li><em>p1 - p4</em>: The yellow dots</li>
<li><em>normal</em>: The green arrow</li>
<li><em>particle_position</em>: The red dot </li>
</ul>

<p>The code above rotates the p1-p4 vertices around the given angle and normal axis. So <strong>what i learned</strong> from this is probably what I already knew ... Use one vector3 member for a 3D object (could be a particle used to draw a texture, a sphere, trail of particles to create a creature for your flocking). when you want to draw something at the position of this vector3 use glTranslate to move towards this position and glRotatef to rotate your object. After calling glTranslate/glRotate draw your 3D object using the local coordinates of your 3D model.</p>

<p>Below is an image I used to get make it a bit more clear for me.</p>

<p><img src="/assets/uploaded/223-screenshot20100315at10.56.45pm.png"></p>]]></description>
</item><item>
		<title>Sphere and particles</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>072b030ba126b2f4b2374f342be9ed44guid</guid>
		<description><![CDATA[<p>While learning openGL I try to recreate stunning visualisations I found here, on Vimeo. Now, it's time for flight404. Flight404 videos are awesome! Technically impressive and just beautiful. In this video I've tried to add physics to the particles, which are textured quads, that face the center of a sphere. I've used perlin noise for the motion, added some trails and random forces. I've had some help from Robert, but I'm not sure how he implements his gravitational/magnetism physics. I tried to use <a href="http://en.wikipedia.org/wiki/Newton's_law_of_universal_gravitation">Newtons law of gravitation</a> but this didn't gave me the results I wanted. When <a href="http://vimeo.com/646107">Roberts video</a> is all magnetism based I definitely want to find out how he did it ;-). Especially if the particles rotate based on attraction. Im using standard Euler based particles and stiff springs to keep the particles on the sphere.</p>

<p><object width="572" height="429"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9978869&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00ADEF&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=9978869&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00ADEF&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="572" height="429"></embed></object></p>]]></description>
</item><item>
		<title>Attiny2313, AVRdude and Arduino & AVRisp</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>093f65e080a295f8076b1c5722a46aa2guid</guid>
		<description><![CDATA[<p>Today I've tested the avrdude, avrisp and arduino &amp; avrisp toolchain (AAAA-toolchain) to program avr chips, especially the attiny2313 chip.  <a href="http://www.arduino.cc">Arduino</a> is a very robust board used in various hardware projects. Using the arduino programming environment you can easily program the chip.  With the AAAA-toolchain you can use your arduino board to program other AVR chips.  Below I'll describe the steps necessary to program an attiny2313 chip to blink a led.</p>

<h3>What you need</h3>

<ul>
<li><a href="http://www.arduino.cc/">arduino ide</a> version 0.018 - <a href="http://www.arduino.cc/">download</a>    </li>
<li><a href="http://mega-isp.googlecode.com/">mega-isp</a> version 0.3 - <a href="http://mega-isp.googlecode.com/files/avrisp.03.zip">download</a>     </li>
<li><a href="http://savannah.nongnu.org/projects/avrdude/">avrdude</a> version 5.10. <a href="http://sourceforge.net/projects/winavr/files/WinAVR/20100110/WinAVR-20100110-install.exe/download">Download WinAVR version 2010.01.10</a> which includes avrdude for windows.</li>
</ul>

<h3>Installation</h3>

<p><strong>Arduino</strong><br />
Simply unpack the arduino zip file. Copy the arduino-0018 directory to a place you like, I used C:\Program Files\arduino-0018</p>

<p><strong>Mega-isp</strong><br />
Unpack the zip which contains the avrisp.pde file. This is the Arduino project file which you need to burn to your Arduino.</p>

<p><strong>WinAVR</strong></p>

<ul>
<li>Follow the installation wizard    </li>
<li>Add the binary path to your system PATH variable. On windows, I used the default installation directory (C:\WinAVR-20100110\bin). By adding this to your PATH environment variable you're able to execute the "avrdude" command from any CMD window, in any path. <a href="http://www.google.nl/search?q=windows+path+environment+variable&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:nl:official&amp;client=firefox-a">Google</a> for a description on how to set your PATH environment variable.</li>
</ul>

<h3>The hardware</h3>

<p>Okay, when you've downloaded and installed all necessary files you're ready to create your circuit. But first some info, so you know what you're doing. Using the AAAA-toolchain you use the arduino to program another AVR chip. The arduino uses ICSP (in circuit serial programming) for this.  Basically this means that you need to connect a couple of wires <strong>from</strong> the arduino <strong>to</strong> your AVR chip (attiny2313).  We need to connect the standard MOSI, MISO, SCK, RST wires for ICSP. Use this wiring:</p>

<p><strong>Programming wires</strong></p>

<table border="0">
<tr><th>Arduino</th><th>Attiny2313</th></tr>
<tr><td>Pin 10 </td><td>Pin 1 - RST</td></tr>
<tr><td>Pin 11</td><td>Pin 17 - MOSI</td></tr>
<tr><td>Pin 12</td><td>Pin 18 - MISO</td></tr>
<tr><td>Pin 13</td><td>Pin 19 - SCK</td></tr>
<tr><td>Vcc (+5V)</td><td>Pin 20 - Vcc </td></tr>
<tr><td>Gnd</td><td>Pin 10</td></tr>
</table>

<h3>Prepping the Arduino</h3>

<p>Start the Arduino IDE and open the avrisp.pde file you <a href="http://mega-isp.googlecode.com/files/avrisp.03.zip">downloaded</a> before. Connect your Arduino, select the correct board and COM port and upload the avr-isp code to the arduino. I'll not explain this more thoroughly as it's basic arduino programming. When you've uploaded avrisp to the arduino you're ready to create the "hello world", blinking led application to test this avr-isp programming method.</p>

<h3>Programming the attiny2313</h3>

<p>When you want to program your attiny2313, you need to understand that we use different steps to get the program-code on the chip. To program the attiny2313 you need to use "avrdude", which is also used by Arduino (under the hood, if I'm correct).  AVRDude is able to put the program-code on the chip using the avrisp programming method.  WinAVR is set of tools you need to program an attiny (or other avr) without Arduino, using avrdude.  The steps you need to take are:</p>

<p>● write the application code in C<br />
● compile the code for the attiny2313 chip using avr-gcc<br />
● upload the compiled code (hex file) to your attiny2313 using avrdude</p>

<p><strong>Application code</strong><br />
I just googled for a attiny2313 blinking led example that I'll use. Connect pin 12 of your attiny2313 to a led with a current limiting resistor.
Copy and paste this code in a file named <strong>blinking_led_2313.c</strong>.</p>

<pre class="c"><span style="color: #339933;">#define F_CPU 1000000UL</span>
<span style="color: #339933;">#include &lt;avr/io.h&gt;</span>
<span style="color: #339933;">#include &lt;util/delay.h&gt;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    DDRB |= <span style="color: #cc66cc;">1</span>&lt;&lt;PB0; <span style="color: #808080; font-style: italic;">/* set PB0 to output */</span>
    <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        PORTB &amp;= ~<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>&lt;&lt;PB0<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* LED on */</span>
        _delay_ms<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>;
        PORTB |= <span style="color: #cc66cc;">1</span>&lt;&lt;PB0; <span style="color: #808080; font-style: italic;">/* LED off */</span>
        _delay_ms<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">900</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;
<span style="color: #66cc66;">&#125;</span></pre>

<p><strong>Compile the code to a hex file</strong><br />
Create a new file in the same directory of your blinking_led_2313.c file with the name "Makefile" and put this code in it (see below). You can easily reuse this makefile for other projects by changing the  "PRJSRC" variable.</p>

<pre class="bash"><span style="color: #808080; font-style: italic;"># See: http://electrons.psychogenic.com/modules/arms/view.php?<span style="color: #007800;">w=</span>art&amp;<span style="color: #007800;">idx=</span><span style="color: #000000;">8</span>&amp;<span style="color: #007800;">page=</span><span style="color: #000000;">2</span></span>
<span style="color: #808080; font-style: italic;">##### This Makefile will <span style="color: #c20cb9; font-weight: bold;">make</span> compiling Atmel AVR </span>
<span style="color: #808080; font-style: italic;">##### micro controller projects simple with Linux </span>
<span style="color: #808080; font-style: italic;">##### or other Unix workstations and the AVR-GCC </span>
<span style="color: #808080; font-style: italic;">##### tools.</span>
<span style="color: #808080; font-style: italic;">#####</span>
<span style="color: #808080; font-style: italic;">##### It supports C, C++ and Assembly <span style="color: #7a0874; font-weight: bold;">source</span> files.</span>
<span style="color: #808080; font-style: italic;">#####</span>
<span style="color: #808080; font-style: italic;">##### Customize the values <span style="color: #c20cb9; font-weight: bold;">as</span> indicated below and :</span>
<span style="color: #808080; font-style: italic;">##### make</span>
<span style="color: #808080; font-style: italic;">##### <span style="color: #c20cb9; font-weight: bold;">make</span> disasm </span>
<span style="color: #808080; font-style: italic;">##### <span style="color: #c20cb9; font-weight: bold;">make</span> stats </span>
<span style="color: #808080; font-style: italic;">##### <span style="color: #c20cb9; font-weight: bold;">make</span> hex</span>
<span style="color: #808080; font-style: italic;">##### <span style="color: #c20cb9; font-weight: bold;">make</span> writeflash</span>
<span style="color: #808080; font-style: italic;">##### <span style="color: #c20cb9; font-weight: bold;">make</span> gdbinit</span>
<span style="color: #808080; font-style: italic;">##### or <span style="color: #c20cb9; font-weight: bold;">make</span> clean</span>
<span style="color: #808080; font-style: italic;">#####</span>
<span style="color: #808080; font-style: italic;">##### See the http://electrons.psychogenic.com/ </span>
<span style="color: #808080; font-style: italic;">##### website <span style="color: #000000; font-weight: bold;">for</span> detailed instructions</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">####################################################</span>
<span style="color: #808080; font-style: italic;">#####                                          #####</span>
<span style="color: #808080; font-style: italic;">#####              Configuration               #####</span>
<span style="color: #808080; font-style: italic;">#####                                          #####</span>
<span style="color: #808080; font-style: italic;">##### Customize the values <span style="color: #000000; font-weight: bold;">in</span> this section <span style="color: #000000; font-weight: bold;">for</span> #####</span>
<span style="color: #808080; font-style: italic;">##### your project. MCU, PROJECTNAME and       #####</span>
<span style="color: #808080; font-style: italic;">##### PRJSRC must be setup <span style="color: #000000; font-weight: bold;">for</span> all projects,   #####</span>
<span style="color: #808080; font-style: italic;">##### the remaining variables are only         #####</span>
<span style="color: #808080; font-style: italic;">##### relevant to those needing additional     #####</span>
<span style="color: #808080; font-style: italic;">##### include <span style="color: #7a0874; font-weight: bold;">dirs</span> or libraries and those      #####</span>
<span style="color: #808080; font-style: italic;">##### <span style="color: #c20cb9; font-weight: bold;">who</span> wish to use the avrdude programmer   #####</span>
<span style="color: #808080; font-style: italic;">#####                                          #####</span>
<span style="color: #808080; font-style: italic;">##### See http://electrons.psychogenic.com/    #####</span>
<span style="color: #808080; font-style: italic;">##### <span style="color: #000000; font-weight: bold;">for</span> further details.                     #####</span>
<span style="color: #808080; font-style: italic;">#####                                          #####</span>
<span style="color: #808080; font-style: italic;">####################################################</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#####         Target Specific Details          #####</span>
<span style="color: #808080; font-style: italic;">#####     Customize these <span style="color: #000000; font-weight: bold;">for</span> your project     #####</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Name of target controller </span>
<span style="color: #808080; font-style: italic;"># <span style="color: #7a0874; font-weight: bold;">&#40;</span>e.g. </span><span style="color: #ff0000;">'at90s8515'</span>, see the available avr-<span style="color: #c20cb9; font-weight: bold;">gcc</span> mmcu 
<span style="color: #808080; font-style: italic;"># options <span style="color: #000000; font-weight: bold;">for</span> possible values<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
<span style="color: #007800;">MCU=</span>attiny2313
&nbsp;
<span style="color: #808080; font-style: italic;"># Name of our project</span>
<span style="color: #808080; font-style: italic;"># <span style="color: #7a0874; font-weight: bold;">&#40;</span>use a single word, e.g. </span><span style="color: #ff0000;">'myproject'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">PROJECTNAME=</span>blinking_led_2313
&nbsp;
<span style="color: #808080; font-style: italic;"># Source files</span>
<span style="color: #808080; font-style: italic;"># List C/C++/Assembly <span style="color: #7a0874; font-weight: bold;">source</span> files:</span>
<span style="color: #808080; font-style: italic;"># <span style="color: #7a0874; font-weight: bold;">&#40;</span>list all files to compile, e.g. </span><span style="color: #ff0000;">'a.c b.cpp as.S'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>:
<span style="color: #808080; font-style: italic;"># Use .<span style="color: #c20cb9; font-weight: bold;">cc</span>, .<span style="color: #c20cb9; font-weight: bold;">cpp</span> or .C suffix <span style="color: #000000; font-weight: bold;">for</span> C++ files, use .S </span>
<span style="color: #808080; font-style: italic;"># <span style="color: #7a0874; font-weight: bold;">&#40;</span>NOT .s !!!<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> assembly <span style="color: #7a0874; font-weight: bold;">source</span> code files.</span>
<span style="color: #007800;">PRJSRC=</span>blinking_led_2313.c
&nbsp;
<span style="color: #808080; font-style: italic;"># additional includes <span style="color: #7a0874; font-weight: bold;">&#40;</span>e.g. -I/path/to/mydir<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
<span style="color: #007800;">INC=</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># libraries to <span style="color: #c20cb9; font-weight: bold;">link</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>e.g. -lmylib<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
<span style="color: #007800;">LIBS=</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Optimization level, </span>
<span style="color: #808080; font-style: italic;"># use s <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">size</span> opt<span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span>, <span style="color: #000000;">3</span> or <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>off<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
<span style="color: #007800;">OPTLEVEL=</span>s
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#####      AVR Dude </span><span style="color: #ff0000;">'writeflash'</span> options       <span style="color: #808080; font-style: italic;">#####</span>
<span style="color: #808080; font-style: italic;">#####  If you are using the avrdude program</span>
<span style="color: #808080; font-style: italic;">#####  <span style="color: #7a0874; font-weight: bold;">&#40;</span>http://www.bsdhome.com/avrdude/<span style="color: #7a0874; font-weight: bold;">&#41;</span> to write</span>
<span style="color: #808080; font-style: italic;">#####  to the MCU, you can <span style="color: #000000; font-weight: bold;">set</span> the following config</span>
<span style="color: #808080; font-style: italic;">#####  options and use </span><span style="color: #ff0000;">'make writeflash'</span> to program
<span style="color: #808080; font-style: italic;">#####  the device.</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># programmer id--check the avrdude <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">complete</span> list</span>
<span style="color: #808080; font-style: italic;"># of available opts.  These should include stk500,</span>
<span style="color: #808080; font-style: italic;"># avr910, avrisp, bsd, pony and <span style="color: #c20cb9; font-weight: bold;">more</span>.  Set this to</span>
<span style="color: #808080; font-style: italic;"># one of the valid </span><span style="color: #ff0000;">&quot;-c PROGRAMMER-ID&quot;</span> values 
<span style="color: #808080; font-style: italic;"># described <span style="color: #000000; font-weight: bold;">in</span> the avrdude info page.</span>
<span style="color: #808080; font-style: italic;"># </span>
<span style="color: #007800;">AVRDUDE_PROGRAMMERID=</span>avrisp
&nbsp;
<span style="color: #808080; font-style: italic;"># port--serial or parallel port to <span style="color: #c20cb9; font-weight: bold;">which</span> your </span>
<span style="color: #808080; font-style: italic;"># hardware programmer is attached</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #007800;">AVRDUDE_PORT=</span>com12
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">####################################################</span>
<span style="color: #808080; font-style: italic;">#####                Config Done               #####</span>
<span style="color: #808080; font-style: italic;">#####                                          #####</span>
<span style="color: #808080; font-style: italic;">##### You should not need to edit anything      #####</span>
<span style="color: #808080; font-style: italic;">##### below to use the makefile but may wish   #####</span>
<span style="color: #808080; font-style: italic;">##### to override a few of the flags           #####</span>
<span style="color: #808080; font-style: italic;">##### nonetheless                              #####</span>
<span style="color: #808080; font-style: italic;">#####                                          #####</span>
<span style="color: #808080; font-style: italic;">####################################################</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">##### Flags ####</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># HEXFORMAT -- format <span style="color: #000000; font-weight: bold;">for</span> .hex <span style="color: #c20cb9; font-weight: bold;">file</span> output</span>
<span style="color: #007800;">HEXFORMAT=</span>ihex
&nbsp;
<span style="color: #808080; font-style: italic;"># compiler</span>
<span style="color: #007800;">CFLAGS=</span>-I. $<span style="color: #7a0874; font-weight: bold;">&#40;</span>INC<span style="color: #7a0874; font-weight: bold;">&#41;</span> -g -<span style="color: #007800;">mmcu=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>MCU<span style="color: #7a0874; font-weight: bold;">&#41;</span> -O$<span style="color: #7a0874; font-weight: bold;">&#40;</span>OPTLEVEL<span style="color: #7a0874; font-weight: bold;">&#41;</span> \
    -fpack-struct -fshort-enums             \
    -funsigned-bitfields -funsigned-char    \
    -Wall -Wstrict-prototypes               \
    -Wa,-<span style="color: #007800;">ahlms=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>firstword                  \
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.lst, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>&lt;:.<span style="color: #007800;">c=</span>.lst<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">c++</span> specific flags</span>
<span style="color: #007800;">CPPFLAGS=</span>-fno-exceptions               \
    -Wa,-<span style="color: #007800;">ahlms=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>firstword         \
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.lst, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>&lt;:.<span style="color: #007800;">cpp=</span>.lst<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>\
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.lst, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>&lt;:.<span style="color: #007800;">cc=</span>.lst<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> \
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.lst, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>&lt;:.<span style="color: #007800;">C=</span>.lst<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># assembler</span>
ASMFLAGS =-I. $<span style="color: #7a0874; font-weight: bold;">&#40;</span>INC<span style="color: #7a0874; font-weight: bold;">&#41;</span> -<span style="color: #007800;">mmcu=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>MCU<span style="color: #7a0874; font-weight: bold;">&#41;</span>        \
    -x assembler-with-<span style="color: #c20cb9; font-weight: bold;">cpp</span>            \
    -Wa,-gstabs,-<span style="color: #007800;">ahlms=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>firstword   \
        $<span style="color: #7a0874; font-weight: bold;">&#40;</span>&lt;:.<span style="color: #007800;">S=</span>.lst<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>&lt;.<span style="color: #007800;">s=</span>.lst<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># linker</span>
<span style="color: #007800;">LDFLAGS=</span>-Wl,-Map,$<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>.map -<span style="color: #007800;">mmcu=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>MCU<span style="color: #7a0874; font-weight: bold;">&#41;</span> \
    -lm $<span style="color: #7a0874; font-weight: bold;">&#40;</span>LIBS<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">##### executables ####</span>
<span style="color: #007800;">CC=</span>avr-<span style="color: #c20cb9; font-weight: bold;">gcc</span>
<span style="color: #007800;">OBJCOPY=</span>avr-objcopy
<span style="color: #007800;">OBJDUMP=</span>avr-objdump
<span style="color: #007800;">SIZE=</span>avr-<span style="color: #c20cb9; font-weight: bold;">size</span>
<span style="color: #007800;">AVRDUDE=</span>avrdude
<span style="color: #007800;">REMOVE=</span>rm -f
&nbsp;
<span style="color: #808080; font-style: italic;">##### automatic target names ####</span>
<span style="color: #007800;">TRG=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>PROJECTNAME<span style="color: #7a0874; font-weight: bold;">&#41;</span>.out
<span style="color: #007800;">DUMPTRG=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>PROJECTNAME<span style="color: #7a0874; font-weight: bold;">&#41;</span>.s
&nbsp;
<span style="color: #007800;">HEXROMTRG=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>PROJECTNAME<span style="color: #7a0874; font-weight: bold;">&#41;</span>.hex 
<span style="color: #007800;">HEXTRG=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>HEXROMTRG<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>PROJECTNAME<span style="color: #7a0874; font-weight: bold;">&#41;</span>.ee.hex
<span style="color: #007800;">GDBINITFILE=</span>gdbinit-$<span style="color: #7a0874; font-weight: bold;">&#40;</span>PROJECTNAME<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Define all object files.</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Start by splitting <span style="color: #7a0874; font-weight: bold;">source</span> files by type</span>
<span style="color: #808080; font-style: italic;">#  C++</span>
<span style="color: #007800;">CPPFILES=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.<span style="color: #c20cb9; font-weight: bold;">cpp</span>, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>PRJSRC<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">CCFILES=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.<span style="color: #c20cb9; font-weight: bold;">cc</span>, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>PRJSRC<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">BIGCFILES=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.C, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>PRJSRC<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #808080; font-style: italic;">#  C</span>
<span style="color: #007800;">CFILES=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.c, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>PRJSRC<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #808080; font-style: italic;">#  Assembly</span>
<span style="color: #007800;">ASMFILES=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.S, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>PRJSRC<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># List all object files we need to create</span>
<span style="color: #007800;">OBJDEPS=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>CFILES:.<span style="color: #007800;">c=</span>.o<span style="color: #7a0874; font-weight: bold;">&#41;</span>    \
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CPPFILES:.<span style="color: #007800;">cpp=</span>.o<span style="color: #7a0874; font-weight: bold;">&#41;</span>\
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>BIGCFILES:.<span style="color: #007800;">C=</span>.o<span style="color: #7a0874; font-weight: bold;">&#41;</span> \
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CCFILES:.<span style="color: #007800;">cc=</span>.o<span style="color: #7a0874; font-weight: bold;">&#41;</span>  \
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>ASMFILES:.<span style="color: #007800;">S=</span>.o<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Define all lst files.</span>
<span style="color: #007800;">LST=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.lst, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJDEPS:.<span style="color: #007800;">o=</span>.lst<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># All the possible generated assembly </span>
<span style="color: #808080; font-style: italic;"># files <span style="color: #7a0874; font-weight: bold;">&#40;</span>.s files<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
<span style="color: #007800;">GENASMFILES=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>filter %.s, $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJDEPS:.<span style="color: #007800;">o=</span>.s<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> 
&nbsp;
&nbsp;
.SUFFIXES : .c .<span style="color: #c20cb9; font-weight: bold;">cc</span> .<span style="color: #c20cb9; font-weight: bold;">cpp</span> .C .o .out .s .S \
    .hex .ee.hex .h .hh .hpp
&nbsp;
&nbsp;
.PHONY: writeflash clean stats gdbinit stats
&nbsp;
<span style="color: #808080; font-style: italic;"># Make targets:</span>
<span style="color: #808080; font-style: italic;"># all, disasm, stats, hex, writeflash/<span style="color: #c20cb9; font-weight: bold;">install</span>, clean</span>
all: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
disasm: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>DUMPTRG<span style="color: #7a0874; font-weight: bold;">&#41;</span> stats
&nbsp;
stats: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJDUMP<span style="color: #7a0874; font-weight: bold;">&#41;</span> -h $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>SIZE<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
&nbsp;
hex: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>HEXTRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
&nbsp;
writeflash: hex
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>AVRDUDE<span style="color: #7a0874; font-weight: bold;">&#41;</span> -c $<span style="color: #7a0874; font-weight: bold;">&#40;</span>AVRDUDE_PROGRAMMERID<span style="color: #7a0874; font-weight: bold;">&#41;</span>   \
     -p $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MCU<span style="color: #7a0874; font-weight: bold;">&#41;</span> -P $<span style="color: #7a0874; font-weight: bold;">&#40;</span>AVRDUDE_PORT<span style="color: #7a0874; font-weight: bold;">&#41;</span> -e        \
     -b <span style="color: #000000;">19200</span> \
     -U flash:<span style="color: #c20cb9; font-weight: bold;">w</span>:$<span style="color: #7a0874; font-weight: bold;">&#40;</span>HEXROMTRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">install</span>: writeflash
&nbsp;
$<span style="color: #7a0874; font-weight: bold;">&#40;</span>DUMPTRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJDUMP<span style="color: #7a0874; font-weight: bold;">&#41;</span> -S  $&lt; &gt; $@
&nbsp;
&nbsp;
$<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJDEPS<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CC<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>LDFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> -o $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJDEPS<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#### Generating assembly ####</span>
<span style="color: #808080; font-style: italic;"># asm from C</span>
%.s: %.c
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CC<span style="color: #7a0874; font-weight: bold;">&#41;</span> -S $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> $&lt; -o $@
&nbsp;
<span style="color: #808080; font-style: italic;"># asm from <span style="color: #7a0874; font-weight: bold;">&#40;</span>hand coded<span style="color: #7a0874; font-weight: bold;">&#41;</span> asm</span>
%.s: %.S
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CC<span style="color: #7a0874; font-weight: bold;">&#41;</span> -S $<span style="color: #7a0874; font-weight: bold;">&#40;</span>ASMFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> $&lt; &gt; $@
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># asm from C++</span>
.<span style="color: #c20cb9; font-weight: bold;">cpp</span>.s .<span style="color: #c20cb9; font-weight: bold;">cc</span>.s .C.s :
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CC<span style="color: #7a0874; font-weight: bold;">&#41;</span> -S $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CPPFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> $&lt; -o $@
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#### Generating object files ####</span>
<span style="color: #808080; font-style: italic;"># object from C</span>
.c.o: 
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CC<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> -c $&lt;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># object from C++ <span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #c20cb9; font-weight: bold;">cc</span>, .<span style="color: #c20cb9; font-weight: bold;">cpp</span>, .C files<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
.<span style="color: #c20cb9; font-weight: bold;">cc</span>.o .<span style="color: #c20cb9; font-weight: bold;">cpp</span>.o .C.o :
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CC<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CPPFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> -c $&lt;
&nbsp;
<span style="color: #808080; font-style: italic;"># object from asm</span>
.S.o :
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>CC<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>ASMFLAGS<span style="color: #7a0874; font-weight: bold;">&#41;</span> -c $&lt; -o $@
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#### Generating hex files ####</span>
<span style="color: #808080; font-style: italic;"># hex files from elf</span>
<span style="color: #808080; font-style: italic;">#####  Generating a <span style="color: #c20cb9; font-weight: bold;">gdb</span> initialisation <span style="color: #c20cb9; font-weight: bold;">file</span>    #####</span>
.out.hex:
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJCOPY<span style="color: #7a0874; font-weight: bold;">&#41;</span> -j .text                    \
        -j .data                       \
        -O $<span style="color: #7a0874; font-weight: bold;">&#40;</span>HEXFORMAT<span style="color: #7a0874; font-weight: bold;">&#41;</span> $&lt; $@
&nbsp;
.out.ee.hex:
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJCOPY<span style="color: #7a0874; font-weight: bold;">&#41;</span> -j .eeprom                  \
        --change-section-lma .<span style="color: #007800;">eeprom=</span><span style="color: #000000;">0</span> \
        -O $<span style="color: #7a0874; font-weight: bold;">&#40;</span>HEXFORMAT<span style="color: #7a0874; font-weight: bold;">&#41;</span> $&lt; $@
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#####  Generating a <span style="color: #c20cb9; font-weight: bold;">gdb</span> initialisation <span style="color: #c20cb9; font-weight: bold;">file</span>    #####</span>
<span style="color: #808080; font-style: italic;">##### Use by launching simulavr and avr-<span style="color: #c20cb9; font-weight: bold;">gdb</span>:   #####</span>
<span style="color: #808080; font-style: italic;">#####   avr-<span style="color: #c20cb9; font-weight: bold;">gdb</span> -x gdbinit-myproject           #####</span>
gdbinit: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
$<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span>: $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    @<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;file $(TRG)&quot;</span> &gt; $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
    @<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;target remote localhost:1212&quot;</span> \
                        &gt;&gt; $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
    @<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;load&quot;</span>        &gt;&gt; $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
    @<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;break main&quot;</span>  &gt;&gt; $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    @<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;continue&quot;</span>    &gt;&gt; $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    @<span style="color: #7a0874; font-weight: bold;">echo</span>
    @<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Use 'avr-gdb -x $(GDBINITFILE)'&quot;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#### Cleanup ####</span>
clean:
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>REMOVE<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>TRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>.map $<span style="color: #7a0874; font-weight: bold;">&#40;</span>DUMPTRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>REMOVE<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>OBJDEPS<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>REMOVE<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>LST<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GDBINITFILE<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>REMOVE<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>GENASMFILES<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    $<span style="color: #7a0874; font-weight: bold;">&#40;</span>REMOVE<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>HEXTRG<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#####                    EOF                   #####</span></pre>

<p>After you've created this Makefile in the same directory as your blinking_led_2313.c file, open a CMD window and go to that directory where the makefile is located. Then type <strong>make</strong> (but be sure you've closed the Arduino-IDE before doing so!!).</p>

<p><strong>Upload the code to the chip</strong></p>

<p>In the same CMD window type: <strong>make install</strong> and you should see a blinking LED in a couple of seconds.</p>

<h2>Some helpfull links</h2>

<p><a href="http://dddanmar.net/?p=5">http://dddanmar.net/</a><br />
<a href="http://peterstuifzand.nl/i-programmed-my-first-attiny2313.html">blinking led</a></p>

<h2>Extra</h2>

<p>MCU names for avr-gcc</p>

<pre class="bash">avr2
at90s2313
at90s2323
at90s2333
at90s2343
attiny22
attiny26
at90s4414
at90s4433
at90s4434
at90s8515
at90c8534
at90s8535
at86rf401
attiny13
attiny2313
avr3
atmega103
atmega603
at43usb320
at43usb355
at76c711
avr4
atmega8
atmega48
atmega88
atmega8515
atmega8535
avr5
atmega16
atmega161
atmega162
atmega163
atmega165
atmega168
atmega169
atmega32
atmega323
atmega325
atmega3250
atmega64
atmega645
atmega6450
atmega128
at90can128
at94k
avr1
at90s1200
attiny11
attiny12
attiny15
attiny28</pre>]]></description>
</item><item>
		<title>3D Math </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>66f041e16a60928b05a7e228a89c3799guid</guid>
		<description><![CDATA[<p>I've been reading up with 3D math, openGL, physics etc.. for a while now and yes, finally I think I'm getting somewhere. The first results, although still extremely basic, but quite fun are ready to be shown.  I've created a sphere from ofxVec3f objects (3d vector objects, in C++), which get randomly distributed using a <a href="http://local.wasp.uwa.edu.au/~pbourke/geometry/spherepoints/">simple spatial algorithm</a>.</p>

<p>Then, after I've calculated the positions for the points I create rectangles, actually just openGL GL_QUADS, but using the crossproduct to get the perpendicular lines/positions that make up de quad. When I've got the positions of the QUADs I use an alpha transparent image and put that as a texture on it.</p>

<p><strong>Calculating the points for the quad</strong><br />
Below is the code I've used to calculate the vertices for the QUAD. I'm not sure if this is the best solution, but it works perfect!</p>

<pre class="c"><span style="color: #993333;">void</span> TestQuad::<span style="color: #202020;">draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    ofEnableAlphaBlending<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
    glBegin<span style="color: #66cc66;">&#40;</span>GL_LINE_STRIP<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i &lt; tail.<span style="color: #202020;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; ++i<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #993333;">float</span> a = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span><span style="color: #66cc66;">&#41;</span>tail.<span style="color: #202020;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-i<span style="color: #66cc66;">&#41;</span>/<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">float</span><span style="color: #66cc66;">&#41;</span>tail.<span style="color: #202020;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> * .<span style="color: #cc66cc;">2</span>;
        glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.0</span>, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">0.6</span>,a<span style="color: #66cc66;">&#41;</span>;
        glVertex3f<span style="color: #66cc66;">&#40;</span>tail.<span style="color: #202020;">at</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">x</span>, tail.<span style="color: #202020;">at</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">y</span>, tail.<span style="color: #202020;">at</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    glEnd<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    ofxVec3f normal = position - center;
    ofxVec3f up_vec<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
    ofxVec3f p1 = normal.<span style="color: #202020;">getCrossed</span><span style="color: #66cc66;">&#40;</span>up_vec<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">normalize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">scale</span><span style="color: #66cc66;">&#40;</span>size<span style="color: #66cc66;">&#41;</span>;
    ofxVec3f p2 = normal.<span style="color: #202020;">getCrossed</span><span style="color: #66cc66;">&#40;</span>p1<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">normalize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">scale</span><span style="color: #66cc66;">&#40;</span>size<span style="color: #66cc66;">&#41;</span>;
    ofxVec3f p3 = normal.<span style="color: #202020;">getCrossed</span><span style="color: #66cc66;">&#40;</span>p2<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">normalize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">scale</span><span style="color: #66cc66;">&#40;</span>size<span style="color: #66cc66;">&#41;</span>;
    ofxVec3f p4 = normal.<span style="color: #202020;">getCrossed</span><span style="color: #66cc66;">&#40;</span>p3<span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">normalize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #202020;">scale</span><span style="color: #66cc66;">&#40;</span>size<span style="color: #66cc66;">&#41;</span>;
    ofxVec3f pp1 = position+p1;
    ofxVec3f pp2 = position+p2;
    ofxVec3f pp3 = position+p3;
    ofxVec3f pp4 = position+p4;
&nbsp;
&nbsp;
    glColor4f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.0</span>,<span style="color: #cc66cc;">1.0</span>,<span style="color: #cc66cc;">1.0</span>,<span style="color: #cc66cc;">0</span>.9f<span style="color: #66cc66;">&#41;</span>;
    glEnable<span style="color: #66cc66;">&#40;</span>GL_TEXTURE_2D<span style="color: #66cc66;">&#41;</span>;
    glBindTexture<span style="color: #66cc66;">&#40;</span>GL_TEXTURE_2D,texture_id<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    glBegin<span style="color: #66cc66;">&#40;</span>GL_QUADS<span style="color: #66cc66;">&#41;</span>;
        glTexCoord2f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>.0f, <span style="color: #cc66cc;">0</span>.0f<span style="color: #66cc66;">&#41;</span>; glVertex3f<span style="color: #66cc66;">&#40;</span>pp1.<span style="color: #202020;">x</span>, pp1.<span style="color: #202020;">y</span>, pp1.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
        glTexCoord2f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>.0f, <span style="color: #cc66cc;">0</span>.0f<span style="color: #66cc66;">&#41;</span>; glVertex3f<span style="color: #66cc66;">&#40;</span>pp2.<span style="color: #202020;">x</span>, pp2.<span style="color: #202020;">y</span>, pp2.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
        glTexCoord2f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>.0f, <span style="color: #cc66cc;">1</span>.0f<span style="color: #66cc66;">&#41;</span>; glVertex3f<span style="color: #66cc66;">&#40;</span>pp3.<span style="color: #202020;">x</span>, pp3.<span style="color: #202020;">y</span>, pp3.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
        glTexCoord2f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>.0f, <span style="color: #cc66cc;">1</span>.0f<span style="color: #66cc66;">&#41;</span>; glVertex3f<span style="color: #66cc66;">&#40;</span>pp4.<span style="color: #202020;">x</span>, pp4.<span style="color: #202020;">y</span>, pp4.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>; 
    glEnd<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    glDisable<span style="color: #66cc66;">&#40;</span>GL_TEXTURE_2D<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>

<p><strong>Distributing points on a sphere</strong></p>

<pre class="c"><span style="color: #808080; font-style: italic;">// from: http://local.wasp.uwa.edu.au/~pbourke/geometry/spherepoints/</span>
<span style="color: #339933;">#include &quot;stdio.h&quot;</span>
<span style="color: #339933;">#include &quot;stdlib.h&quot;</span>
<span style="color: #339933;">#include &quot;math.h&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*
   Create N points on a sphere aproximately equi-distant from each other
   Basically, N points are randomly placed on the sphere and then moved
   around until then moved around until the minimal distance between the
   closed two points is minimaised.
   Paul Bourke, July 1996
*/</span>
&nbsp;
<span style="color: #339933;">#define ABS(x) (x &lt; 0 ? -(x) : (x))</span>
&nbsp;
<span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #993333;">double</span> x,y,z;
<span style="color: #66cc66;">&#125;</span> XYZ;
&nbsp;
<span style="color: #993333;">void</span> Normalise<span style="color: #66cc66;">&#40;</span>XYZ *,<span style="color: #993333;">double</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333;">double</span> Distance<span style="color: #66cc66;">&#40;</span>XYZ,XYZ<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">/*
   Called with three arguments, the number of points to distribute, the
   radius of the sphere, and the maximum number of iterations to perform.
*/</span>
<span style="color: #993333;">int</span> main<span style="color: #66cc66;">&#40;</span>argc,argv<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333;">int</span> argc;
<span style="color: #993333;">char</span> **argv;
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #993333;">int</span> i,j,n;
   <span style="color: #993333;">int</span> counter = <span style="color: #cc66cc;">0</span>,countmax = <span style="color: #cc66cc;">100</span>;
   <span style="color: #993333;">int</span> minp1,minp2;
   <span style="color: #993333;">double</span> r,d,mind,maxd;
   XYZ p<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#93;</span>,p1,p2;
&nbsp;
   <span style="color: #808080; font-style: italic;">/* Check we have the right number of arguments */</span>
   <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>argc &lt; <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      fprintf<span style="color: #66cc66;">&#40;</span>stderr,<span style="color: #ff0000;">&quot;Usage: %s npoints radius niterations<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>,argv<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
      exit<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #66cc66;">&#125;</span>
   <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>n = atoi<span style="color: #66cc66;">&#40;</span>argv<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> &lt; <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
      n = <span style="color: #cc66cc;">3</span>;
   <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>r = atof<span style="color: #66cc66;">&#40;</span>argv<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> &lt; <span style="color: #cc66cc;">0.001</span><span style="color: #66cc66;">&#41;</span>
      r = <span style="color: #cc66cc;">0.001</span>;
   <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>countmax = atoi<span style="color: #66cc66;">&#40;</span>argv<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> &lt; <span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
      countmax = <span style="color: #cc66cc;">100</span>;
&nbsp;
   <span style="color: #808080; font-style: italic;">/* Create the initial random cloud */</span>
   <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>;i&lt;n;i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
       p<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">x</span> = <span style="color: #66cc66;">&#40;</span>rand<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>%<span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">-500</span>;
       p<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">y</span> = <span style="color: #66cc66;">&#40;</span>rand<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>%<span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">-500</span>;
       p<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">z</span> = <span style="color: #66cc66;">&#40;</span>rand<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>%<span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">-500</span>;
       Normalise<span style="color: #66cc66;">&#40;</span>&amp;p<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>,r<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>counter &lt; countmax<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* Find the closest two points */</span>
        minp1 = <span style="color: #cc66cc;">0</span>;
        minp2 = <span style="color: #cc66cc;">1</span>;
        mind = Distance<span style="color: #66cc66;">&#40;</span>p<span style="color: #66cc66;">&#91;</span>minp1<span style="color: #66cc66;">&#93;</span>,p<span style="color: #66cc66;">&#91;</span>minp2<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
        maxd = mind;
        <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>;i&lt;n<span style="color: #cc66cc;">-1</span>;i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>j=i<span style="color: #cc66cc;">+1</span>;j&lt;n;j++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>d = Distance<span style="color: #66cc66;">&#40;</span>p<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>,p<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> &lt; mind<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                   mind = d;
                   minp1 = i;
                   minp2 = j;
                <span style="color: #66cc66;">&#125;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>d &gt; maxd<span style="color: #66cc66;">&#41;</span>
                   maxd = d;
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/*
           Move the two minimal points apart, in this case by 1%
           but should really vary this for refinement
        */</span>
        p1 = p<span style="color: #66cc66;">&#91;</span>minp1<span style="color: #66cc66;">&#93;</span>;
        p2 = p<span style="color: #66cc66;">&#91;</span>minp2<span style="color: #66cc66;">&#93;</span>;
        p<span style="color: #66cc66;">&#91;</span>minp2<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">x</span> = p1.<span style="color: #202020;">x</span> + <span style="color: #cc66cc;">1.01</span> * <span style="color: #66cc66;">&#40;</span>p2.<span style="color: #202020;">x</span> - p1.<span style="color: #202020;">x</span><span style="color: #66cc66;">&#41;</span>;
        p<span style="color: #66cc66;">&#91;</span>minp2<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">y</span> = p1.<span style="color: #202020;">y</span> + <span style="color: #cc66cc;">1.01</span> * <span style="color: #66cc66;">&#40;</span>p2.<span style="color: #202020;">y</span> - p1.<span style="color: #202020;">y</span><span style="color: #66cc66;">&#41;</span>;
        p<span style="color: #66cc66;">&#91;</span>minp2<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">z</span> = p1.<span style="color: #202020;">z</span> + <span style="color: #cc66cc;">1.01</span> * <span style="color: #66cc66;">&#40;</span>p2.<span style="color: #202020;">z</span> - p1.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
        p<span style="color: #66cc66;">&#91;</span>minp1<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">x</span> = p1.<span style="color: #202020;">x</span> - <span style="color: #cc66cc;">0.01</span> * <span style="color: #66cc66;">&#40;</span>p2.<span style="color: #202020;">x</span> - p1.<span style="color: #202020;">x</span><span style="color: #66cc66;">&#41;</span>;
        p<span style="color: #66cc66;">&#91;</span>minp1<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">y</span> = p1.<span style="color: #202020;">y</span> - <span style="color: #cc66cc;">0.01</span> * <span style="color: #66cc66;">&#40;</span>p2.<span style="color: #202020;">y</span> - p1.<span style="color: #202020;">y</span><span style="color: #66cc66;">&#41;</span>;
        p<span style="color: #66cc66;">&#91;</span>minp1<span style="color: #66cc66;">&#93;</span>.<span style="color: #202020;">z</span> = p1.<span style="color: #202020;">z</span> - <span style="color: #cc66cc;">0.01</span> * <span style="color: #66cc66;">&#40;</span>p2.<span style="color: #202020;">z</span> - p1.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span>;
        Normalise<span style="color: #66cc66;">&#40;</span>&amp;p<span style="color: #66cc66;">&#91;</span>minp1<span style="color: #66cc66;">&#93;</span>,r<span style="color: #66cc66;">&#41;</span>;
        Normalise<span style="color: #66cc66;">&#40;</span>&amp;p<span style="color: #66cc66;">&#91;</span>minp2<span style="color: #66cc66;">&#93;</span>,r<span style="color: #66cc66;">&#41;</span>;
&nbsp;
        counter++;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Write out the points in your favorite format */</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> Normalise<span style="color: #66cc66;">&#40;</span>p,r<span style="color: #66cc66;">&#41;</span>
XYZ *p;
<span style="color: #993333;">double</span> r;
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #993333;">double</span> l;
&nbsp;
   l = r / sqrt<span style="color: #66cc66;">&#40;</span>p-&gt;x*p-&gt;x + p-&gt;y*p-&gt;y + p-&gt;z*p-&gt;z<span style="color: #66cc66;">&#41;</span>;
   p-&gt;x *= l;
   p-&gt;y *= l;
   p-&gt;z *= l;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #993333;">double</span> Distance<span style="color: #66cc66;">&#40;</span>p1,p2<span style="color: #66cc66;">&#41;</span>
XYZ p1,p2;
<span style="color: #66cc66;">&#123;</span>
   XYZ p;
&nbsp;
   p.<span style="color: #202020;">x</span> = p1.<span style="color: #202020;">x</span> - p2.<span style="color: #202020;">x</span>;
   p.<span style="color: #202020;">y</span> = p1.<span style="color: #202020;">y</span> - p2.<span style="color: #202020;">y</span>;
   p.<span style="color: #202020;">z</span> = p1.<span style="color: #202020;">z</span> - p2.<span style="color: #202020;">z</span>;
   <span style="color: #b1b100;">return</span><span style="color: #66cc66;">&#40;</span>sqrt<span style="color: #66cc66;">&#40;</span>p.<span style="color: #202020;">x*p</span>.<span style="color: #202020;">x</span> + p.<span style="color: #202020;">y*p</span>.<span style="color: #202020;">y</span> + p.<span style="color: #202020;">z*p</span>.<span style="color: #202020;">z</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>]]></description>
</item><item>
		<title>Buttons... buttons.... buttons...</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>9f61408e3afb633e50cdf1b20de6f466guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Trees</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>72b32a1f754ba1c09b3695e0cb6cde7fguid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Compiling Code::Blocks from source on Mac</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>b53b3a3d6ab90ce0268229151c9bde11guid</guid>
		<description><![CDATA[<p>Finally, after trying like 100 times to get a working installation/build script for the latest CodeBlocks version I managed to get it working!  Now, I've got a script which I can simply run and which compiles the latest Code::Blocks version (from svn) into a application bundle for the Mac. Below I'll describe the steps I had to make to get it all working. First some of the things which are important</p>

<p>● I've been using the wxWidgets 2.8 branch and Code::Blocks revision 6135<br />
 ● I first installed XCode on my MacOS 10.6 (xcode probably sets up the developer tools you need, but I'm not sure)<br />
 ● take care of the dynamic libraries and their locations<br />
 ● some paths and files need to be copied to the bundle location which is not described anywhere (untill now)</p>

<p><strong>Compiling and configuring</strong><br />
There wasn't really something special while compiling Code::Blocks, the only thing you should know, is that you run "./bootstrap" before you can configure it. (See the script below that I used).</p>

<p><strong>Creating a bundle</strong><br />
When you've compiled Code::Blocks and wxWidgets using shared/dynamic libraries you need to tell the libraries and executables where they can find these. Normally they try to find the libraries in /usr/local/lib for example. This information is stored in the libraries and executables. Using "otool -L [file]" you can check which libraries are used by that file. With another util, called <strong>intall_name_tool</strong> you can change the paths to the dynamic libraries that a file uses. As you're creating an application bundle, it's wise to put all the necessary libraries in the bundle directory. If you don't know what an application bundle is, here is a quick summary.  MacOS has a nice system to manage applications. When you open the Application directory in Finder you see all the applications with an icon. Though, under the hood, on the file system, these applications (or at least 99% of them), are named "Application.app", so with the ".app" extension. Finder removes these and creates a clickable application.  Under this Application.app are a couple of other directories (Google for MacOS application bundle directories for more info). So, back to the libraries. It's wise to put the libraries you've compiled into the application bundle director and tell them about eachother so they will use the local libs instead of the system libs.  See the script where we use install_name_tool for this. install_name_tool, works like this:  install_name_tool [/path/to/library/which/is/used/now] [change/to/other/path] [change for this file].  When all paths have changed, the libraries and executables are set to go. When I did this I could run Code::Blocks but the  plugins weren't installed which is something that must be done to use Code::Blocks (i.e. the project wizard is based on a plugin).  For this I had to copy the [plugin].so files to the application bundle. At the bottom of the script you can see which files I had to copy as well. But here is a short list
<strong>BTW: you need to bundle CodeBlocks into an application because else you can't focus or activate CodeBlocks, this is a wxWidgets thingie</strong></p>

<p>● The icons can be found in C::B (svn dir)/src/src/resources/icons/*.icns and need to be moved to ${application_dir}/Contents/Resources<br />
 ● The Info.plist file should be created, this can be found in the C::B build directory (so after compiling), named codeblocks.plist<br />
 ● Make sure you use the --with-contribs=all flag when you compile Code::Blocks as it needs the plugins<br />
 ● The plugin shared libraries should be copied to your application.app directory (see script for the location)<br />
 ● Change the paths to the dynamic libraries that are used by your plugins (see the loop at the bottom of the script where we use install_name_tool)<br />
 ● Make sure you configure with the CC/GCC etc.. flags set to "-arch 386": CFLAGS="-arch i386" CXXFLAGS="-arch i386" CPPFLAGS="-arch i386" LDFLAGS="-arch i386" OBJCFLAGS="-arch i386" OBJCXXFLAGS="-arch i386"</p>

<p><strong>The script to create a CodeBlocks application on Mac form source</strong><br />
This script downloads the latest SVN version of Code::Blocks, the 2.8 branch of wxWidgets, creates some directories, configures wxWidgets/Code::Blocks and creates the CodeBlocks.app application bundle. The directories that are created:</p>

<p>● ./app: here you'll find your CodeBlocks.app<br />
 ● ./codeblocks_svn<br />
 ● ./wxwidgets_svn</p>

<p>The script will ask you a couple of questions, answer them by entering only a 'y' and make sure that you at least configured and compiled wxWidgets and C::B using the script at least once, before you answer something different than 'y'.</p>

<p>I hope this will help you to build a custom CodeBlocks application for Mac!</p>

<pre class="bash"><span style="color: #808080; font-style: italic;">#!/bin/sh</span>
<span style="color: #808080; font-style: italic;">#set -x</span>
<span style="color: #007800;">root_dir=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>PWD<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -d wxwidgets_svn <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Remove wxWidgets 2.8 directory to start clean install? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span> ;    <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> -r wxwidgets_svn
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> wxwidgets_svn
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> wxwidgets_svn
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -d codeblocks_svn <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Remove CodeBlocks directory to start clean install? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>;  <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #c20cb9; font-weight: bold;">rm</span> -r codeblocks_svn
                <span style="color: #c20cb9; font-weight: bold;">mkdir</span> codeblocks_svn
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> codeblocks_svn
<span style="color: #000000; font-weight: bold;">fi</span> 
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Download CodeBlocks from svn? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> codeblocks_svn
    svn <span style="color: #c20cb9; font-weight: bold;">co</span> http://svn.berlios.de/svnroot/repos/codeblocks/trunk .
    <span style="color: #7a0874; font-weight: bold;">cd</span> ..
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Download wxWidgets 2.8 from svn? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> wxwidgets_svn
    svn <span style="color: #c20cb9; font-weight: bold;">co</span> http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH .
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#------------------------- wxWidgets ---------------------------------------</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Configure wxWidgets 2.8? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> ! -d <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/wxwidgets_svn <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No wxWidgets directory found&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/wxwidgets_svn
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -d build_custom <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> -r build_custom
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> build_custom
    <span style="color: #7a0874; font-weight: bold;">cd</span> build_custom
    ./../configure --enable-shared \
     --enable-monolithic \
     --enable-unicode \
     --with-<span style="color: #007800;">png=</span>builtin \
     --with-<span style="color: #007800;">jpeg=</span>builtin \
     --with-<span style="color: #007800;">tiff=</span>builtin \
     --with-<span style="color: #007800;">expat=</span>builtin/configure \
     --enable-shared \
     --enable-monolithic \
     --enable-unicode \
     --with-mac \
     --with-<span style="color: #007800;">expat=</span>builtin \
     <span style="color: #007800;">CFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> <span style="color: #007800;">CXXFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> <span style="color: #007800;">CPPFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> \
     <span style="color: #007800;">LDFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> <span style="color: #007800;">OBJCFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> <span style="color: #007800;">OBJCXXFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Compile wxWidgets 2.8 [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/wxwidgets_svn/build_custom
    <span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Bootstrap Code::Blocks [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn
    ./bootstrap
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Configure Code::Blocks [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> ! -d <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No CodeBlocks directory found&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -d custom_build <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> -r custom_build
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> custom_build
    <span style="color: #7a0874; font-weight: bold;">cd</span> custom_build
    ./../configure \
        --<span style="color: #007800;">prefix=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build/ \
        --with-<span style="color: #007800;">wxdir=</span>./../../wxwidgets28_from_svn/custom_build/ \
        <span style="color: #007800;">CFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> <span style="color: #007800;">CXXFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> \
        <span style="color: #007800;">CPPFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> <span style="color: #007800;">LDFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> \
        <span style="color: #007800;">OBJCFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> \
        <span style="color: #007800;">OBJCXXFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386&quot;</span> \
        --with-contrib-<span style="color: #007800;">plugins=</span>all \
        --enable-static \
        --enable-debug \
        --with-macosx \
        --with-<span style="color: #007800;">wxdir=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/wxwidgets_svn/build_custom/ \
        --with-wx-<span style="color: #007800;">config=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/wxwidgets_svn/build_custom/wx-config \
        --with-wx-<span style="color: #007800;">prefix=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/wxwidgets_svn/build_custom/ 
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Compile and make Code::Blocks [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build
    <span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Create CodeBlocks.app bundle? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -d <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;An Codeblocks.app bundle already exists, remove first? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #c20cb9; font-weight: bold;">rm</span> -r <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #007800;">app_dir=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app
    <span style="color: #007800;">cb_dir=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn
    <span style="color: #007800;">wx_dir=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/wxwidgets_svn
&nbsp;
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> -p <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/MacOS
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> -p <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/Resources/share/codeblocks
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>cb_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/custom_build/codeblocks.plist <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/Info.plist
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>cb_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/src/src/resources/icons/*.icns <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/Resources/
    <span style="color: #c20cb9; font-weight: bold;">cp</span> -r <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>cb_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/custom_build/share/codeblocks/* <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/Resources/share/codeblocks/
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>cb_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/custom_build/bin/codeblocks <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/MacOS/CodeBlocks
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>cb_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/custom_build/lib/libcodeblocks<span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/MacOS/
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>cb_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/custom_build/lib/libwxsmithlib<span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/MacOS/
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>wx_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/build_custom/lib/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/MacOS/
    <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">777</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>app_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/Contents/MacOS/CodeBlocks  
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">read</span> -p <span style="color: #ff0000;">&quot;Change dynamic lib paths? [y/n]: &quot;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${continue}&quot;</span> == <span style="color: #ff0000;">&quot;y&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># copy the plugins <span style="color: #7a0874; font-weight: bold;">&#40;</span>original version<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build/src/plugins
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> -p <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app/Contents/Resources/share/codeblocks/plugins/
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">dir</span> <span style="color: #000000; font-weight: bold;">in</span> `<span style="color: #c20cb9; font-weight: bold;">find</span> -<span style="color: #7a0874; font-weight: bold;">type</span> d . -mindepth <span style="color: #000000;">1</span> -maxdepth <span style="color: #000000;">1</span>`; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">name=</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>dir<span style="color: #808080; font-style: italic;">##*/<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>
        <span style="color: #007800;">plugin_libs=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build/src/plugins/<span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>name<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/.libs/
        <span style="color: #000000; font-weight: bold;">for</span> plugin_lib <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>plugin_libs<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>*.so; <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -f <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>plugin_lib<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>    
                    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>plugin_lib<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app/Contents/Resources/share/codeblocks/
                <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">done</span>
    <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># copy the other plugins <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">which</span> one <span style="color: #000000; font-weight: bold;">do</span> I need to choose<span style="color: #7a0874; font-weight: bold;">&#41;</span></span>
    <span style="color: #808080; font-style: italic;">#<span style="color: #007800;">cb_plugin_dir=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build/lib/codeblocks/plugins</span>
    <span style="color: #808080; font-style: italic;">#for <span style="color: #c20cb9; font-weight: bold;">dir</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>cb_plugin_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/*.so; do</span>
    <span style="color: #808080; font-style: italic;"># <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">dir</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app/Contents/Resources/share/codeblocks/</span>
    <span style="color: #808080; font-style: italic;">#done</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">dir</span> <span style="color: #000000; font-weight: bold;">in</span> `<span style="color: #c20cb9; font-weight: bold;">find</span> --<span style="color: #7a0874; font-weight: bold;">type</span> d <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build/src/plugins/contrib -mindepth <span style="color: #000000;">1</span> -maxdepth <span style="color: #000000;">1</span>`; <span style="color: #000000; font-weight: bold;">do</span>
            <span style="color: #007800;">name=</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>dir<span style="color: #808080; font-style: italic;">##*/<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>
            <span style="color: #007800;">libdir=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">dir</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/.libs
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -d <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libdir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">so_file=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libdir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/*.so<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                    <span style="color: #808080; font-style: italic;">#if <span style="color: #7a0874; font-weight: bold;">&#91;</span> -f <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so_file<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; then</span>
                        <span style="color: #808080; font-style: italic;">#echo <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so_file<span style="color: #7a0874; font-weight: bold;">&#125;</span></span></span>
                        <span style="color: #808080; font-style: italic;">#cp <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so_file<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app/Contents/Resources/share/codeblocks/</span>
                    <span style="color: #808080; font-style: italic;">#fi</span>
                <span style="color: #808080; font-style: italic;">#echo <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libdir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span></span>
            <span style="color: #000000; font-weight: bold;">fi</span>
            <span style="color: #808080; font-style: italic;">#<span style="color: #007800;">plugin=</span><span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build/src/plugins/contrib/<span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>name<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/.libs/lib<span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>name<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>.so</span>
        <span style="color: #808080; font-style: italic;"># <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -f <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>plugin<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; then</span>
            <span style="color: #808080; font-style: italic;">#        <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>plugin<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app/Contents/Resources/share/codeblocks/</span>
            <span style="color: #808080; font-style: italic;">#fi</span>
    <span style="color: #000000; font-weight: bold;">done</span>
    <span style="color: #808080; font-style: italic;">#cp /Users/diederickhuijbers/Documents/programming/_tests/cb1/codeblocks_svn/custom_build/src/plugins/compilergcc/.libs/libcompiler.so <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app/Contents/Resources/share/codeblocks/ </span>
&nbsp;
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/app/CodeBlocks.app/Contents
    install_name_tool -<span style="color: #c20cb9; font-weight: bold;">id</span> @executable_path/libcodeblocks<span style="color: #000000;">.0</span>.dylib MacOS/libcodeblocks<span style="color: #000000;">.0</span>.dylib
    install_name_tool -<span style="color: #c20cb9; font-weight: bold;">id</span> @executable_path/libwxsmith<span style="color: #000000;">.0</span>.dylib MacOS/libwxsmithlib<span style="color: #000000;">.0</span>.dylib
&nbsp;
    install_name_tool -change <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build/lib/libcodeblocks<span style="color: #000000;">.0</span>.dylib @executable_path/libcodeblocks<span style="color: #000000;">.0</span>.dylib MacOS/CodeBlocks    
    install_name_tool -change <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>root_dir<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>/codeblocks_svn/custom_build//lib/libcodeblocks<span style="color: #000000;">.0</span>.dylib @executable_path/libcodeblocks<span style="color: #000000;">.0</span>.dylib MacOS/CodeBlocks
    install_name_tool -change /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/libcodeblocks<span style="color: #000000;">.0</span>.dylib @executable_path/libcodeblocks<span style="color: #000000;">.0</span>.dylib MacOS/libwxsmithlib<span style="color: #000000;">.0</span>.dylib
    install_name_tool -change /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib @executable_path/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib MacOS/CodeBlocks
    install_name_tool -change /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib @executable_path/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib MacOS/libcodeblocks<span style="color: #000000;">.0</span>.dylib 
    install_name_tool -change /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib @executable_path/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib MacOS/libwxsmithlib<span style="color: #000000;">.0</span>.dylib
&nbsp;
    <span style="color: #000000; font-weight: bold;">for</span> so <span style="color: #000000; font-weight: bold;">in</span> Resources/share/codeblocks/*.so; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">libcodeblocks=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>otool -L <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> | <span style="color: #c20cb9; font-weight: bold;">grep</span> libcodeblocks<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #007800;">libcodeblocks=</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libcodeblocks%%<span style="color: #7a0874; font-weight: bold;">&#40;</span>*<span style="color: #7a0874; font-weight: bold;">&#125;</span>
        install_name_tool -change <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libcodeblocks<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> @executable_path/libcodeblocks<span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>
&nbsp;
        <span style="color: #007800;">libwxsmith=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>otool -L <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> | <span style="color: #c20cb9; font-weight: bold;">grep</span> libwxsmithlib<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #007800;">libwxsmith=</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libwxsmith%%<span style="color: #7a0874; font-weight: bold;">&#40;</span>*<span style="color: #7a0874; font-weight: bold;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${libwxsmith}&quot;</span> != <span style="color: #ff0000;">&quot;&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            install_name_tool -change <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libwxsmith<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> @executable_path/libwxsmithlib<span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #007800;">libwx=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>otool -L <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> | <span style="color: #c20cb9; font-weight: bold;">grep</span> libwx_macu<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #007800;">libwx=</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libwx%%<span style="color: #7a0874; font-weight: bold;">&#40;</span>*<span style="color: #7a0874; font-weight: bold;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">&quot;${libwx}&quot;</span> != <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            install_name_tool -change <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>libwx<span style="color: #7a0874; font-weight: bold;">&#125;</span></span> @executable_path/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#install_name_tool -change /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/libcodeblocks<span style="color: #000000;">.0</span>.dylib @executable_path/libcodeblocks<span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span></span>
        <span style="color: #808080; font-style: italic;">#install_name_tool -change /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/libwxsmithlib<span style="color: #000000;">.0</span>.dylib @executable_path/libwxsmithlib<span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span></span>
        <span style="color: #808080; font-style: italic;">#install_name_tool -change /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib @executable_path/libwx_macu<span style="color: #000000;">-2.8</span><span style="color: #000000;">.0</span>.dylib <span style="color: #007800;">$<span style="color: #7a0874; font-weight: bold;">&#123;</span>so<span style="color: #7a0874; font-weight: bold;">&#125;</span></span></span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre>]]></description>
</item><item>
		<title>Touchtable prototype</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>d82c8d1619ad8176d665453cfb2e55f0guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>3D Math continued </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>a684eceee76fc522773286a895bc8436guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Parsing the maillogs ....</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>9a1158154dfa42caddbd0694a4e9bdc8guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>3D Math, HD video creation</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>2838023a778dfaecdc212708f721b788guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Perlin noise for vortex like animation</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>c0c7c76d30bd3dcaefc96f40275bdc0aguid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>LSystem update</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>f457c545a9ded88f18ecee47145a72c0guid</guid>
		<description><![CDATA[<p>I did a tiny update on my animated LSystem code... Created a LSystem generator and parser to create nice tree like structures.</p>]]></description>
</item><item>
		<title>Kerstboom-kast version 2.0 </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>642e92efb79421734881b53e1e1b18b6guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Animating LSystems </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>67c6a1e7ce56d3d6fa748ab6d9af3fd7guid</guid>
		<description><![CDATA[<p>I found an amazing article on animating LSystems which uses physics to apply forces to the trunk, branches and leafes of a tree. In the <a href="http://nccastaff.bournemouth.ac.uk/jmacey/MastersProjects/MSc09/Hampshire/userGuideFull.pdf">thesis of Nicholas Hampshire</a> one can find a full description of the algorithm used to create some realistic motion. Interesting on this solution is the use of physics, particles and bend forces to create a tree which keeps its shape. When using regular particle systems, you need to create lots of springs to keep the shape together. In this thesis Nicholas describes a way to create this spring forces just from geometric data.</p>]]></description>
</item><item>
		<title>openFrameworks FreakDay #1</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>d9d4f495e875a2e075a1a4a6e1b9770fguid</guid>
		<description><![CDATA[<p>Last weekend we had our first openFrameworks FreakDay with a group of ~14 creative-developers. Some did already amazing things with oF others just came to learn to use it. After a wonderful introduction on oF by Theo everyone started with examples applications or their own projects. This was our first meeting so we had to figure out the format.. for the next meeting we're thinking to create interest-groups where you can participate on a certain subject and work as a group on a problem and try to help/figure out how to create things with oF. You can think of a interest-group "hardware&lt;>of" or visualisation/3D/openGL. We'll think about this format and start a mailing list where everyone can participate on this discussion.</p>]]></description>
</item><item>
		<title>Electricity plan + closet design</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>f7177163c833dff4b38fc8d2872f1ec6guid</guid>
		<description><![CDATA[<p>Just some images so I know where to put the electricty ;-) I'm currently working on my house and puttng all the electricity back into it's place; I'm also working on a closet design.</p>]]></description>
</item><item>
		<title>Exportscript for Illustrator</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>17e62166fc8586dfa4d1bc0e1742c08bguid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Creating a separate preloader for your Flash website</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>d67d8ab4f4c10bf22aa353e27879133cguid</guid>
		<description><![CDATA[<h3>What you need to about preloaders</h3>

<p><em>What you need to know about preloaders when you create  a separate preloader.swf for your site.</em></p>

<p>I'll explain a couple of things which are important when you create a preloader for your Flash based website. First of all: use a separate preloader.swf, do not put your preloader code in your site.swf.  When I talk about site.swf, I'm talking about your big fat 2MB Flash based website and the preloader.swf is your slim and shiny tiny 2KB preloader.</p>

<h3>In your site.swf (pseude code)</h3>

<p>The important part is the ADDED_TO_STAGE event listener. Put this in de constructor of your Document class.  This event is fired when the preloader.swf loads in site.swf and adds it as a child.</p>

<pre class="actionscript"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageAlign</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageScaleMode</span>;
package <span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Site <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Site<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
        addEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ADDED_TO_STAGE</span>, init<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
   <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #808080; font-style: italic;">//  create your children here!</span>
        <span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = StageScaleMode.<span style="color: #006600;">NO_SCALE</span>;
        <span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</span>;
   <span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>

<h3>In your preloader.swf (pseudo code)</h3>

<p>After you've loaded your site.swf, you can start the intro tweens etc..</p>

<p>When you need to call a function on the loaded swf use:</p>

<pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> myLoader:Loader = <span style="color: #000000; font-weight: bold;">new</span> Loader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> myUrlReq:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>”<span style="color: #0066CC;">data</span>.<span style="color: #006600;">swf</span>”<span style="color: #66cc66;">&#41;</span>;
myLoader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>myUrlReq<span style="color: #66cc66;">&#41;</span>;
myLoader.<span style="color: #006600;">contentLoaderInfo</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, onLoaded<span style="color: #66cc66;">&#41;</span>;</pre>

<p>...and the complete handler...</p>

<pre class="actionscript"><span style="color: #000000; font-weight: bold;">function</span> onLoaded<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> Square:<span style="color: #000000; font-weight: bold;">Class</span> = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">applicationDomain</span>.<span style="color: #006600;">getDefinition</span><span style="color: #66cc66;">&#40;</span>”Square”<span style="color: #66cc66;">&#41;</span> as <span style="color: #000000; font-weight: bold;">Class</span>
    <span style="color: #000000; font-weight: bold;">var</span> mySquare:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> Square<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">MovieClip</span>;
    addChild<span style="color: #66cc66;">&#40;</span>mySquare<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>]]></description>
</item><item>
		<title>Blender scripting</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>3416a75f4cea9109507cacd8e2f2aefcguid</guid>
		<description><![CDATA[<p>Scripting a 3D object in Blender</p>

<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> Blender 
<span style="color: #ff7700;font-weight:bold;">from</span> Blender.<span style="color: black;">Object</span> <span style="color: #ff7700;font-weight:bold;">import</span> *
<span style="color: #ff7700;font-weight:bold;">from</span> Blender <span style="color: #ff7700;font-weight:bold;">import</span> Window,Scene,Material
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">math</span> <span style="color: #ff7700;font-weight:bold;">import</span> *
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
scn = Scene.<span style="color: black;">GetCurrent</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
num_rows = <span style="color: #ff4500;">10</span>
num_objects = <span style="color: #ff4500;">19</span>
angle_per_obj = <span style="color: black;">&#40;</span>pi * <span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>/num_objects
radius = <span style="color: #ff4500;">10.4</span>
angle = <span style="color: #ff4500;">0</span> 
z = <span style="color: #ff4500;">0</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>num_rows<span style="color: black;">&#41;</span>:
    angle += angle_per_obj/<span style="color: #ff4500;">2</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>num_objects<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> x
        Blender.<span style="color: black;">Object</span>.<span style="color: black;">Duplicate</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        active = scn.<span style="color: black;">objects</span>.<span style="color: black;">active</span>
        x = cos<span style="color: black;">&#40;</span>angle<span style="color: black;">&#41;</span> * radius
        y = sin<span style="color: black;">&#40;</span>angle<span style="color: black;">&#41;</span> * radius
        active.<span style="color: black;">LocX</span> = x
        active.<span style="color: black;">LocY</span> = y  
        active.<span style="color: black;">LocZ</span> = z
        active.<span style="color: black;">RotZ</span> = angle + pi/<span style="color: #ff4500;">2</span>
        angle += angle_per_obj
    z+= <span style="color: #ff4500;">3</span></pre>]]></description>
</item><item>
		<title>Creating  a GUI for openFrameworks</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>a5771bce93e200c36f7cd9dfd0e5deaaguid</guid>
		<description><![CDATA[<p>Just a note to myself:</p>

<p>When defining a bounding box it's wise to use members variables like:</p>

<pre class="c">min_x  
min_y  
max_x  
max_y</pre>

<p>and <strong>not</strong> variable like</p>

<pre class="c">x  
y  
width  
height</pre>

<p><strong>Why not?</strong><br />
Because using the min_x/max_x variant reduces the number of calculations you have to do for both collision detection and drawing; For example this is how we check the bounding box collision using the min_x variant:</p>

<pre class="c"><span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>nX &gt; min_x<span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>nX &lt; max_x<span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>nY &gt; min_y<span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>nY &lt; max_y<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre>

<p>where this is the x/y/width/height variant:</p>

<pre class="c"><span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>tx &gt; x<span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>tx &lt; x + width<span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>ty &gt; y<span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>ty &lt; y + height<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre>

<p>Do you see we need to accumulate a couple of things over there? Well these are just 2  calculations which are dont around 60 times per second when you've a framerate of 60 for each visual object you have.</p>]]></description>
</item><item>
		<title>Making Electronic Thingies In Amsterdam</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>a5bfc9e07964f8dddeb95fc584cd965dguid</guid>
		<description><![CDATA[<p>Yesterday was the first time I visited META; a group of developers, designers, artists, mediatechnologists who get-together and talk about interesting projects and hardware related thingies. I've to say it was really fantastic to meet up with other people who dream about interactive/electronic installations.  Adriaan of <a href="http://fourcelabs.com/waterleven/">Waterleven</a> had a small talk about his project; you can see some <a href="http://fourcelabs.com/waterleven/beeld.html">photos over here</a>.</p>

<p><a href="http://www.blendid.nl">Tim Olden</a> showed us some pictures of his "light installation" (what's the name?) he showed at LowLands 2009.</p>

<p>Just as a reminder, this book, <a href="http://www.amazon.com/Code-Language-Computer-Hardware-Software/dp/073560505X">The Hidden Language of Computer Hardware and Software</a>  passed along; maybe or probably it's interesting to read.</p>]]></description>
</item><item>
		<title>Export your Illustrator work to separate PDF files</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>1c383cd30b7c298ab50293adfecb7b18guid</guid>
		<description><![CDATA[<p>This weekend I had to create a user interface design for which I used Illustrator. The document has about 200 layers separated over ~30 pages. For each page I created a main layer that contains all the elements for that specific page. Well, after I finished the UID I wanted to export the pages to a PDF. I couldn't find  a multi page option for the export and therefore I had to export each layer (the page layers) one at a time. By default the settings of the PDF printer exports everything, even hidden layers. <strong>You should disable this option</strong> when you want to export your pages.  Another thing I did was to create a crop area around the visuals in my document that I wanted to export. Using this crop area only the visible/necessary elements are exported. Then I tweaked the size properties in such a way that the page size of the pdf matches exactly the size of the crop area.</p>

<p><em>Have a look at the screenshots for the important settigns I changed after doing File > Print ...</em></p>]]></description>
</item><item>
		<title>3D math</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>19ca14e7ea6328a42e0eb13d585e4c22guid</guid>
		<description><![CDATA[<p>Playing around with 3D rotations.. I'm rotating vertices around several axis to create a peristaltic movement in the figures you can see in the image below. They just use basic sin/cos functions.</p>]]></description>
</item><item>
		<title>YouCube at Lowlands 2009 Biddinghuizen, The Netherlands</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>e369853df766fa44e1ed0ff613f563bdguid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Tidy rules</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>6364d3f0f495b6ab9dcf8d3b5c6e0b01guid</guid>
		<description><![CDATA[<p>Yes, Tidy rules!</p>

<p>I'm working on lot's of projects at the moment which is why this blog hasn't been updated in a while. Though I haven't been doing nothing ;-). As you maybe know I'm building my house and we just finished the kitchen! Besides working on my house I'm working on the YouCube project which is due at 20 august when we go to LowLands 2009! Before we go to LowLands I want to finish a website for some clients. After these projects I will start working on my house again ;-) .. and hopefully I'm ready at the end of september when I can start working on some really nice projects I'm looking forwarrd to.</p>

<p>I've been working on some features for our companies (<a href="http://www.apollomedia.nl">ApolloMedia</a>) internally used Flash library. It now has some nice plugin system which is able to load assets files from different locations and initializes a website based on a XML file. All transisitions between the states in the site can be defined in the XML file. Using this "recursive state model" (as how I called it) we will be able to create flash websites in a flash ;-)  To make these websites maintainable I've been working on a new module for our CMS which is able to administrate things like menu/menu-items, images, videos, carousels etc..</p>

<p>.. for this module I used tidy to format the XML.. so just as a reminder for myself:</p>

<pre class="php"><span style="color: #808080; font-style: italic;">// tidy rules!!</span>
<span style="color: #0000ff;">$a_config</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>
    <span style="color: #ff0000;">'indent'</span>       =&gt; <span style="color: #000000; font-weight: bold;">true</span>
    ,<span style="color: #ff0000;">'input-xml'</span>   =&gt; <span style="color: #000000; font-weight: bold;">true</span>
    ,<span style="color: #ff0000;">'output-xml'</span>  =&gt; <span style="color: #000000; font-weight: bold;">true</span>
    ,<span style="color: #ff0000;">'wrap'</span>        =&gt; <span style="color: #cc66cc;">200</span>
<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$o_tidy</span> = <span style="color: #000000; font-weight: bold;">new</span> tidy;
<span style="color: #0000ff;">$o_tidy</span>-&gt;<span style="color: #006600;">parseString</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s_xml</span>, <span style="color: #0000ff;">$a_config</span>, <span style="color: #ff0000;">'utf8'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$o_tidy</span>-&gt;<span style="color: #006600;">cleanRepair</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$s_xml</span> = <span style="color: #66cc66;">&#40;</span>string<span style="color: #66cc66;">&#41;</span><span style="color: #0000ff;">$o_tidy</span></pre>]]></description>
</item><item>
		<title>In progress: YouCube </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>c16a5320fa475530d9583c34fd356ef5guid</guid>
		<description><![CDATA[<p>I've been too busy the last couple of days... I'm still trying to finish my home but received lots of new clients and projects last week so I've been writing proposals en doing bits of work on my house whenever possible. Meanwhile we at <a href="http://www.apollomedia.nl">ApolloMedia</a> are working on a tetris-like game that will be controlled using a physical installation at <a href="http://www.lowlands.nl">LowLands 2009</a>.  These screenshots are just rough sketches that give you some idea of how it's going to look like.</p>]]></description>
</item><item>
		<title>Glowies</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>6ea9ab1baa0efb9e19094440c317e21bguid</guid>
		<description><![CDATA[<p>Today I created a video to visualize a concept of us at <a href="http://www.apollomedia.nl">ApolloMedia</a> for interactive garbage cans. We want to create a second version of our interactive garbage cans called "Brullenbakken". These garbage cans should light up when someone throws something into them. Hopefully we will start building these "Glowies" in a short time.</p>

<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5450790&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5450790&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>

<p><a href="http://vimeo.com/5450790">Glowies</a> from <a href="http://vimeo.com/user1790965">roxlu</a> on <a href="http://vimeo.com">Vimeo</a>.</p>]]></description>
</item><item>
		<title>openFrameworks.info</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>02e74f10e0327ad868d138f2b4fdd6f0guid</guid>
		<description><![CDATA[<p>Recently I created a website where I can publish articles on the framework to which I got addicted <a href="http://www.openframeworks.cc">openFrameworks</a>. It's really an amazing frameworks which removes barriers to get started with C++. Although I had some experience with C++, openFrameworks was just that little step I wanted to start using it for visualisations / applications.</p>]]></description>
</item><item>
		<title>Flocking a la Craig Reynolds</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>33e75ff09dd601bbe69f351039152189guid</guid>
		<description><![CDATA[<p>Created my first article on flocking at  <a href="http://openframeworks.info/prog_tech/flocking/28">openframeworks.info</a> based on the paper by <a href="http://www.red3d.com/cwr/">Graig Reynolds</a>. I really like the natural motion of these tiny boids. This was also an experiment on blending with openGL.</p>

<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5352863&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5352863&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>

<p><a href="http://vimeo.com/5352863">Flocking with openFrameworks</a> from <a href="http://vimeo.com/user1790965">roxlu</a> on <a href="http://vimeo.com">Vimeo</a>.</p>]]></description>
</item><item>
		<title>Inverse kinematics</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>8e296a067a37563370ded05f5a3bf3ecguid</guid>
		<description><![CDATA[<p><a href="http://www.flickr.com/photos/hahakid/3186279816/">Movie of inverse kinematics on Flickr</a>, seems interesting to use for some nice motion of maybe flowers when used together with perlin noise (?!) If you click through the <a href="http://www.flickr.com/photos/hahakid/">photos of hahakid</a> you see some other interestings topics like <strong>super quick optical flow test</strong>.</p>]]></description>
</item><item>
		<title>Rol Je Rot Rolstoel Race back from Paramaribo</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>4e732ced3463d06de0ca9a15b6153677guid</guid>
		<description><![CDATA[<p>Our <a href="http://www.roljerot.nl">Rol Je Rot</a> project is back from Paramaribo.  It was lot's of fun as you can see on the photos!</p>]]></description>
</item><item>
		<title>Those sweet jellies</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>1ff1de774005f8da13f42943881c655fguid</guid>
		<description><![CDATA[<p>Tried some different techniques to simulate soft bodies. Basically there are a couple of ways to create soft bodies. I found a paper <a href="http://panoramix.ift.uni.wroc.pl/~maq/soft2d/howtosoftbody.pdf">describing soft bodies using a pressure force</a> which was worked quite nice. Other techniques describe point masses/particles which are connected with spring forces. The particles technique looks more natural to me as the pressure force is more like a ... hmm very soft plastic thing. Maybe I used the incorrect properties, but I had lot's of fun anyway ;-)</p>

<p>Next thing I want to do is adding a force which follows a person when walking in front of the webcam.  When you walk by you're followed by these sweet jellies!</p>

<p>BTW, the best results I found using a somewhat adjusted ofxBox2dSoftBody object; see <a href="http://www.openframeworks.info/addons">www.openframeworks.info</a> for a spring based soft body which seemed to work very well.</p>]]></description>
</item><item>
		<title>Busy Busy Busy.... </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>b6d767d2f8ed5d21a44b0e5886680cb9guid</guid>
		<description><![CDATA[<p>Hi there, haven't added something to this blog in a week now, though I've been very busy with <a href="http://www.sugarcity.com">sugarcity</a>.  Last monday the site went online which I designed and developed. Together with <a href="http://www.brandwriters.nl">BrandWriters</a> with whom I worked together we're very happy with the result. <a href="http://www.brandwriters.nl">BrandWriters</a> is responsible for the texts and social media around the website.</p>

<p><img src="/assets/uploaded/34-sugarcity_screenshot.png" alt="sugarcity_screenshot.png" class="" title="sugarcity_screenshot.png"></p>]]></description>
</item><item>
		<title>Physics engines & openFrameworks</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>37693cfc748049e45d87b8c7d8b9aacdguid</guid>
		<description><![CDATA[<p>Working on  a demo using openCV to detect motion in openFrameworks. When motion is detected I apply a force on a couple of "posters".  Users are able to wave around and make the posters spin.
I've done some tests with ofxMSAPhysics, ofxRuiPhysics2d and ofxBox2d.  All engines are easily integrated in a oF project, though Box2d gave me the best natural result. ofxMSAPhysics and ofxRuiPhysics2d are also great btw!</p>

<p><strong>Rigid bodies</strong></p>

<p><img src="/assets/uploaded/36-box2d_2.jpg" alt="box2d_2.jpg" class="" title="box2d_2.jpg"></p>

<p><strong>Demo (I only use T-Mobile as an example; I'm not (yet) hired by T-Mobile</strong></p>

<p><img src="/assets/uploaded/35-box2d_1.jpg" alt="box2d_1.jpg" class="" title="box2d_1.jpg"></p>]]></description>
</item><item>
		<title>OpenGL</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>3c59dc048e8850243be8079a5c74d079guid</guid>
		<description><![CDATA[<p>I spent some time playing around with OpenGL. Some notes to myself:</p>

<pre class="c">gluLookAt<span style="color: #66cc66;">&#40;</span>camX, camY, camZ, eyeX, eyeY, eyeZ, upX, upY, upZ<span style="color: #66cc66;">&#41;</span></pre>

<blockquote><p><strong>camX/Y/Z</strong>: Position of the camera<br />
  <strong>eyeX/Y/Z</strong>: Camera looks at this position<br />
   <strong>upX/Y/Z</strong>: The up vector, mostly use: 0,1,0 (what's the top of the camera</p>
</blockquote>]]></description>
</item><item>
		<title>Brullenbakken on place</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>98f13708210194c475687be6106a3b84guid</guid>
		<description><![CDATA[<p>Today we've "installed" our brullenbakken project at location.</p><p><img src="/modules/files/uploaded/31-brullenbakken0092.jpg" alt="" class="" title=""></p>]]></description>
</item><item>
		<title>Brullenbakken</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>1f0e3dad99908345f7439f8ffabdffc4guid</guid>
		<description><![CDATA[<p>Working on some interactive garbage cans.  Using light we create a time based game.</p><p><img src="/modules/files/uploaded/27-brullenbakkenadobe052.jpg" alt="Brullenbakken " class="" title="Brullenbakken "></p><p><img src="/modules/files/uploaded/28-brullenbakkenadobe031.jpg" alt="Brullenbakken " class="" title="Brullenbakken "></p><p><img src="/modules/files/uploaded/29-brullenbakkenadobe032.jpg" alt="Brullenbakken " class="" title="Brullenbakken "></p><p><img src="/modules/files/uploaded/30-brullenbakkenadobe035.jpg" alt="Brullenbakken " class="" title="Brullenbakken "></p>]]></description>
</item><item>
		<title>Grass animation</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>6f4922f45568161a8cdf4ad2299f6d23guid</guid>
		<description><![CDATA[<p>My first vimeo movie :>. (not really happy with the quality though)</p><p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4773265&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4773265&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p><p><a href="http://vimeo.com/4773265">Experimenting with Grass animation</a> from <a href="http://vimeo.com/user1790965">roxlu</a> on <a href="http://vimeo.com">Vimeo</a>.</p>]]></description>
</item><item>
		<title>Perlin noise </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>70efdf2ec9b086079795c442636b55fbguid</guid>
		<description><![CDATA[<p>I finally took my chance to do some tests with perlin noise and I'm happy I did. Perlin noise gives you a natural random number that I use to create some smooth and natural motion.  Below you see some screenshots from the application I've created to do some tests with perlin noise an natural motion.</p><p><img src="/modules/files/uploaded/23-screenshot211.png" alt="" class="" title=""></p><p><img src="/modules/files/uploaded/24-screenshot210.png" alt="" class="" title=""></p><p><img src="/modules/files/uploaded/25-screenshot209.png" alt="" class="" title=""></p><p><img src="/modules/files/uploaded/26-screenshot208.png" alt="" class="" title=""></p>]]></description>
</item><item>
		<title>Choosing a transistor</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>c74d97b01eae257e44aa9d5bade97bafguid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Rol Je Rot Rolstoel Race goes to Paramaribo!!</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>9bf31c7ff062936a96d3c8bd1f8f2ff3guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Rol Je Rot Rolstoel Race & 3D</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>aab3238922bcc25a6f606eb525ffdc56guid</guid>
		<description><![CDATA[<p>Currently I'm doing some tests with a great 3D engine called <a href="http://www.ogre3d.org">Ogre3D</a> and the <a href="http://www.bulletphysics.com/Bullet/wordpress/">Bullet</a> physics engine <a href="http://www.roljerot.nl">Rol Je for Rot Rolstoel Race</a> and other interactive installation we're working on. Below you see an image of my first test with Bullet and Ogre</p><p><img src="/modules/files/uploaded/22-ninja.png" alt="Ninja" class="" title="Ninja"></p><p>While googling on Bullet I found these sites which seems interesting:</p>

<ul>
<li><a href="http://www.rchoetzlein.com/art/index.htm">http://www.rchoetzlein.com/art/index.htm</a></li>
</ul><p>Video of an algoritm found on above site
<object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3899908&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3899908&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p><p><a href="http://vimeo.com/3899908">water simulation</a> from <a href="http://vimeo.com/user856298">arturo</a> on <a href="http://vimeo.com">Vimeo</a>.</p>]]></description>
</item><item>
		<title>Springs</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>c51ce410c124a10e0db5e4b97fc2af39guid</guid>
		<description><![CDATA[<p>It was a very busy week but finally got some time to continue my expirments with <a href="http://www.openframeworks.cc">openframeworks</a> and programming motion.
<img src="/modules/files/uploaded/21-screenshot191.png" alt="Sentinel" class="" title="Sentinel"></p><p>This images show a couple of springs tied up. The squares have multiple springs connected so the stay in their 'square like' shape. This could be used to create jelly like surfaces.</p><p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/SvqY_pgA6DU&hl=nl&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/SvqY_pgA6DU&hl=nl&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>]]></description>
</item><item>
		<title>Steering behaviors</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>d3d9446802a44259755d38e6d163e820guid</guid>
		<description><![CDATA[<p>A couple of weeks ago I bought the book <a href="http://www.friendsofed.com/book.html?isbn=9781430216087">Advanced Actionscript 3 Animation</a> and currently I'm playing around with with some of the fancy techniques like steering behavior.</p><p>As a reminder for myself these are some things I'm working on:</p>

<ul>
<li>Center of mass (visualisation)</li>
<li>Angle between two vectors (visualisation)</li>
<li>Steering behavior: separation</li>
<li>Steering behavior: cohesion</li>
<li>Steering behavior: alignment</li>
</ul>]]></description>
</item><item>
		<title>Mixed media part 2</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>c20ad4d76fe97759aa27a0c99bff6710guid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Opentoko</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>6512bd43d9caa6e02c990b0a82652dcaguid</guid>
		<description><![CDATA[]]></description>
</item><item>
		<title>Natural motion</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>45c48cce2e2d7fbdea1afc51c7c6ad26guid</guid>
		<description><![CDATA[<p>One of the things which get's me excited are visualisations with some sort of natural motion.  I'm playing with different ways to visualize 'natural' motion. 
<img src="/modules/files/uploaded/15-screenshot187.png" alt="Grass" class="" title="Grass"></p><p>Above you can see an example of grass which I created using Spring physics. It's a quick sketch using <a href="http://www.processing.org">processing</a>.  When I've played
around with enough visualization techniques I'll continue on my "Flickr Hunt" application.</p><p>Some interesting project I found while googling for natural algorithms is Carnival Aquarium. See <a href="http://www.flickr.com/photos/51035749109@N01/3364454826">carnival @ flickr</a></p>]]></description>
</item><item>
		<title>Reactivision Fiducial markers</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>c9f0f895fb98ab9159f51fd0297e236dguid</guid>
		<description><![CDATA[<p>Reactivision created a new kind of fiducial marker for their <a href="http://www.reactable.com">reactable</a>. After reading their paper and videos it seemed like a solid solution for marker recognition. Though after doing some tests with it, using custom code created using <a href="http://www.openframeworks.cc">OpenFrameworks</a> the results didn't seem so wonderful.</p><p>I can probably improve the results when I use infrared and a table like reatable with better lightning conditions. But, it would be very nice to use these marker on my iphone and the x/y/z sensor.... (this will be continued)</p><p><img src="/modules/files/uploaded/14-screenshot135.png" alt="Reactivision" class="" title="Reactivision"></p>]]></description>
</item><item>
		<title>Mixed media research (part 2)</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>8f14e45fceea167a5a36dedd4bea2543guid</guid>
		<description><![CDATA[<p>Ah that's nice. You probably also into mixed media like I do. Therefore you can admire some of my works below.  <strong>Do you think you can make a better mixed media project?  Please show me :></strong></p><p><img src="/modules/files/uploaded/9-007.jpg" alt="Mixed Media Research 1" class="" title="Mixed Media Research 1">
<img src="/modules/files/uploaded/10-008.jpg" alt="Mixed Media Research 2" class="" title="Mixed Media Research 2">
<img src="/modules/files/uploaded/11-009.jpg" alt="Mixed Media Research 3" class="" title="Mixed Media Research 3">
<a href=""
                                     title=""></a>
<img src="/modules/files/uploaded/13-012.jpg" alt="Mixed Media Research 5" class="" title="Mixed Media Research 5"></p>]]></description>
</item><item>
		<title>Mixed media research</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>1679091c5a880faf6fb5e6087eb1b2dcguid</guid>
		<description><![CDATA[<p>I'm diving into the wonderful world of <a href="http://nl.wikipedia.org/wiki/Mixed_media">mixed media</a>. Currently I've been doing some research into a very interesting combination of two or more media. I'll post an update tomorrow and show you one of the incredible amazing projects I'm working on. I'm sure you'll be amazed by the way I'm combining <a href="http://nl.wikipedia.org/wiki/Mixed_media">multiple media</a>.</p><p>Stay tuned....</p>]]></description>
</item><item>
		<title>Rol Je Rot Rolstoel Race at Cinekid </title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>e4da3b7fbbce2345d7772b0674a318d5guid</guid>
		<description><![CDATA[<p>I'm happy to announce that <a href="http://www.sparkl.nu">our</a> Rol Je Rot Rolstoel Race (RJRRR) is featured at <a href="http://www.cinekid.nl/nl">Cinekid Zoetermeer</a>.  RJRRR is a game which is controlled by wheelchairs.<br />
<a href=""
                                     title=""></a></p><p>Another very interesting and funny project called <a href="http://www.blockblazers.com">BlockBlazers</a> is presented. In this pervasive game you use Wii remotes to control a 2D platform game which is spread over two screens. The screens are positioned with their back against each other. When your game character runs to the left of the screen it pops up in the other screen and you've to run around the screen. See <a href="http://fourcelabs.com/">FourceLabs</a> for more information about the creators of BlockBlazers.</p><p><img src="/modules/files/uploaded/8-bb_4blocks_250px.png" alt="Cinekid Blockblazers" class="" title="Cinekid Blockblazers"></p><p>Next to <a href="http://www.blockblazers.com">BlockBlazers</a> you can try out <a href="http://julianoliver.com/levelhead">LevelHead</a> which is a augmented reality game. You control a cube with <a href="http://www.hitl.washington.edu/artoolkit/">ARToolkit</a> markers. Best way to explain this is to have a look at this video:</p><p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/5ks1u0A8xdU&hl=nl&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/5ks1u0A8xdU&hl=nl&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p><p>A picture of the installation at <a href="http://www.cinekid.nl/nl">Cinekid Zoetermeer</a>.
<img src="/modules/files/uploaded/7-cinekid_levelhead.jpg" alt="Cinekid levelHead" class="" title="Cinekid levelHead"></p><p>And if this wasnt enough, we have <a href="http://www.globe4d.com/">Globe4D</a>.  Globe4D is a project of <a href="http://www.companje.nl">Rick Companje</a>, Nico van Dijk, Hanco Hogenbirk, Danica Mast and Dirk Jansen.  Globe4D is an interactive, four-dimensional globe. It’s a projection of the Earth’s surface on a physical sphere. It shows the historical movement of the continents as its main feature, but it is also capable of displaying all kinds of other geographical data such as climate changes, plant growth, radiation, rainfall, forest fires, seasons, airplane routes, and more.</p><p><img src="/modules/files/uploaded/5-cinekid_globe4d.jpg" alt="Cinekid Globe4D" class="" title="Cinekid Globe4D"></p>

<h1>Rol Je Rot Rolstoel Race</h1><p>And of course some pictures of our project:</p><p><img src="/modules/files/uploaded/2-cinekid_roljerot.jpg" alt="Cinekid RJRR " class="" title="Cinekid RJRR ">
<img src="/modules/files/uploaded/3-cinekid_roljerot2.jpg" alt="Cinekid RJRR " class="" title="Cinekid RJRR ">
<img src="/modules/files/uploaded/4-cinekid_roljerot3.jpg" alt="Cinekid RJRR " class="" title="Cinekid RJRR "></p>]]></description>
</item><item>
		<title>Finally</title>
		<link>http://www.roxlu.com</link>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
		<guid>a87ff679a2f3e71d9181a67b7542122cguid</guid>
		<description><![CDATA[<p>It's been a while since I had my own site though I'll give it a shot again. I hope I'll blog longer than a couple of months this time :></p><p>I'll try to post on a two daily basis about internet, design, marketing, technology, science and my favorite <a href="http://mediatechnology.leiden.edu/">Media Technology</a> related topics.</p>]]></description>
</item></channel>
</rss>
