<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Lachlan Phillips (Posts about simulation)</title><link>https://lachlanap.me/</link><description></description><atom:link href="https://lachlanap.me/tags/simulation.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2023 &lt;a href="mailto:blog@lachlanap.me"&gt;Lachlan Phillips&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-NC-SA"
style="border-width:0; margin-bottom:12px;"
src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Sat, 12 Aug 2023 12:12:21 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Rigid-body physics using particles</title><link>https://lachlanap.me/blog/2014/01/16/rigid-body-physics-using-particles/</link><dc:creator>Lachlan Phillips</dc:creator><description>&lt;p&gt;Towards the end of last year, I worked on a prototype physics engine based on a &lt;a href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch29.html"&gt;GPU Gems chapter&lt;/a&gt; --- a realtime physics simulation running on the GPU. So far I've only written it for the CPU as I've never done any GPU work before. (judging by the problems I've had with the physics side of things, it was probably a good idea not to heap on an order of magnitude more GPU problems...)&lt;/p&gt;
&lt;!-- TEASER_END --&gt;

&lt;p&gt;Here's a video of it in action:&lt;/p&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/klRfMgyOWwM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;After I managed to get rotation pretty much working' --- it still does odd things --- it worked pretty well. It's operating on the pixel/metre scale, because I was lazy... so everything here is massive skyscraper-sized entities. Quite by accident, it appears to have 'conservation of momentum' --- if I draw a 'C', and fill it with particles it will accelerate like a ~rocket~ snail.&lt;/p&gt;
&lt;p&gt;Eventually, I'll work out how to port it to GPU, hook it up with OpenGL, and make it 3D... but that'll be a while.&lt;/p&gt;
&lt;p&gt;In the meanwhile, &lt;a href="http://github.com/ThorinII/particle-physics"&gt;read the code at Github&lt;/a&gt;, and... I've not got the build properly set up on Jenkins so you can't download it.&lt;/p&gt;
&lt;p&gt;EDIT: another video from some time later:&lt;/p&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/UPK-lzMAUNo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</description><category>java</category><category>physics</category><category>simulation</category><guid>https://lachlanap.me/blog/2014/01/16/rigid-body-physics-using-particles/</guid><pubDate>Wed, 15 Jan 2014 17:58:07 GMT</pubDate></item><item><title>Growing Trees with Space Colonisation in 2D</title><link>https://lachlanap.me/blog/2013/09/06/growing-trees-with-space-colonisation-in-2d/</link><dc:creator>Lachlan Phillips</dc:creator><description>&lt;p&gt;Yesterday, I quickly hacked up an implementation of the Space Colonisation
algorithm, for growing trees. By trees, I don't mean the binary trees – the
living sort, just represented by segments and forks.&lt;/p&gt;
&lt;!-- TEASER_END --&gt;

&lt;p&gt;My inspiration was from
&lt;a href="http://procworld.blogspot.com.au/2011/02/space-colonization.html"&gt;Procedural World&lt;/a&gt;
and &lt;a href="http://web.archive.org/web/20180908163301/http://www.sea-of-memes.com/LetsCode26/LetsCode26.html"&gt;this article&lt;/a&gt;. The
idea of Space Colonisation is to colonise/fill a limited area. A tree like this
would grow from the bottom up (as they usually do), gradually taking up all the
available space. Trees generated by this algorithm (as far as I know) rarely
have intersecting branches, and look organic.&lt;/p&gt;
&lt;p&gt;I started coding from the top (as usual I didn't plan much beforehand, but it
didn't turn out too bad) – a Main class that creates a Point Cloud in a
spherical shape, grows a tree in that cloud, and renders the tree out to an
image. Later I added a GUI for faster feedback.&lt;/p&gt;
&lt;p&gt;After some work, I got this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://lachlanap.me/images/2013-09-06%2001-basic-tree.png" class="image-reference"&gt;&lt;img src="https://lachlanap.me/images/2013-09-06%2001-basic-tree.thumbnail.png" alt="A basic tree" title="A basic tree" class=" align-center"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The green points are the Point Cloud, and the black dots with the yellow lines
are the generated tree (segments).&lt;/p&gt;
&lt;p&gt;When I constructed the GUI, I added the option of scaling the point cloud
horizontally, which can give me trees like:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://lachlanap.me/images/2013-09-06%2002-xscalable-gui.png" class="image-reference"&gt;&lt;img src="https://lachlanap.me/images/2013-09-06%2002-xscalable-gui.thumbnail.png" alt="A tree that has been scaled horizontally by 0.6" title="A tree that has been scaled horizontally by 0.6" class=" align-center"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here's a quick shot of the GUI:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://lachlanap.me/images/2013-09-06%2003-gui.png" class="image-reference"&gt;&lt;img src="https://lachlanap.me/images/2013-09-06%2003-gui.thumbnail.png" alt="The GUI" title="The GUI" class=" align-center"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I've still got more work to do, things like&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add different point cloud shapes&lt;ul&gt;
&lt;li&gt;Generate from an image?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Support for multiple trees growing in the same space&lt;/li&gt;
&lt;li&gt;Biases&lt;ul&gt;
&lt;li&gt;Bias upwards&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rendering more tree-like&lt;ul&gt;
&lt;li&gt;Trunk should be thicker than topmost twigs&lt;/li&gt;
&lt;li&gt;Very close branches could be merged&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The code is available on Github.&lt;/p&gt;</description><category>java</category><category>simulation</category><guid>https://lachlanap.me/blog/2013/09/06/growing-trees-with-space-colonisation-in-2d/</guid><pubDate>Fri, 06 Sep 2013 01:50:27 GMT</pubDate></item></channel></rss>