<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://planet-soc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Planet SoC - </title>
 <link>http://planet-soc.com/organization/haskell.org/planet</link>
 <description>Planet view per organization</description>
 <language>en</language>
<item>
 <title>The Monad Reader, SoC special</title>
 <link>http://planet-soc.com/node/4561</link>
 <description>&lt;p&gt;&lt;a href=&quot;http://www.haskell.org/sitewiki/images/f/f0/TMR-Issue12.pdf&quot;&gt;The Monad.Reader Issue 12&lt;/a&gt; is now out. It contains my article on physics engine implementation as well as articles from other SoCers, Max Bolingbroke and Neil Mitchell, and wonderful poetry by Wouter Swierstra, the editor.&lt;br /&gt;
Thanks to Thomas Schilling and Roman Leshchinskiy for help with the article.&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/4561#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Thu, 20 Nov 2008 08:41:00 +0100</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">4561 at http://planet-soc.com</guid>
</item>
<item>
 <title>Status report: week 11-12</title>
 <link>http://planet-soc.com/node/3462</link>
 <description>&lt;p&gt;As I wrote before, I added complete support for polyhedra and fixed collision handler.&lt;br /&gt;
Also, I made a little optimization to collision detector: bounding spheres. The idea is that testing spheres for collision is faster than testing polyhedra. Also, if we consider sphere with center in body&amp;#8217;s center of mass, it&amp;#8217;s rotationally invariant.&lt;br /&gt;
Then I spent some time trying to compile head GHC and DPH. My (not so pleasant) experience is described &lt;a href=&quot;http://ro-che.blogspot.com/2008/08/compiling-ghc.html&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
When I succeeded, I wrote simple benchmark to evaluate gains from using bounding volumes. Result was disappointing &amp;#8212; simple 2-step simulation with 10 bodies took 9 seconds and almost 1Gb of memory to complete. After consulting with my mentors we concluded that vectoriser is not ready yet (delay is due to issues with GHC build system) and that I should postpone benchmarks for a while.&lt;br /&gt;
So, my plans for nearest future is to implement static bodies and BSP trees (I already started the latter). Until 21 of August I will be teaching at summer math. school, and then I will continue the work.&lt;br /&gt;
Also, I&amp;#8217;ll be writing SoC report for &lt;a href=&quot;http://www.haskell.org/haskellwiki/The_Monad.Reader&quot;&gt;the Monad Reader&lt;/a&gt; soon. If you&amp;#8217;d like some particular issue to be explained or highlighted there, feel free to tell me!&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/3462#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Tue, 12 Aug 2008 14:35:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">3462 at http://planet-soc.com</guid>
</item>
<item>
 <title>Physics and polyhedra</title>
 <link>http://planet-soc.com/node/3358</link>
 <description>&lt;p&gt;Thanks to my fellow physicist, Oleg Matveychuk, I&amp;#8217;ve done with the collision&lt;br /&gt;
handler bug I said in the last status report. That was indeed a mistake in the&lt;br /&gt;
paper (&lt;a href=&quot;http://www.cs.cornell.edu/Courses/cs667/2005sp/readings/moore88.pdf&quot;&gt;Collision&lt;br /&gt;
 Detection and Response for Computer Animation&lt;/a&gt;).&lt;br /&gt;
One of the collision equation in that paper looks like&lt;br /&gt;
&lt;img src=&quot;http://www.codecogs.com/eq.latex?(v_2+\omega_2\times\rho_2-v_1-\omega_1\times\rho_1)\cdot k=0.&quot; /&gt;&lt;br /&gt;
Here, &lt;img src=&quot;http://www.codecogs.com/eq.latex?v_i&quot; /&gt; is linear and &lt;img src=&quot;http://www.codecogs.com/eq.latex?\omega_i&quot; /&gt; is angular velocity of each of two bodies,&lt;br /&gt;
&lt;img src=&quot;http://www.codecogs.com/eq.latex?\rho_i&quot; /&gt; is the vector pointing from center of mass to collision point, and &lt;img src=&quot;http://www.codecogs.com/eq.latex?k&quot; /&gt;&lt;br /&gt;
is normal to collision plane. The expression in parens, let&amp;#8217;s call it &lt;img src=&quot;http://www.codecogs.com/eq.latex?V&quot; /&gt;, is&lt;br /&gt;
relative velocity of collision points of two bodies. So, Moore and Wilhelms&lt;br /&gt;
propose to set &lt;img src=&quot;http://www.codecogs.com/eq.latex?V&quot; /&gt; to 0.&lt;br /&gt;
It appears that this corresponds to completely unelastic collision (with&lt;br /&gt;
restitution coefficient equal to 0), and that&amp;#8217;s why it doesn&amp;#8217;t look too&lt;br /&gt;
realistic.&lt;br /&gt;
If we have coefficient of restitution &lt;img src=&quot;http://www.codecogs.com/eq.latex?\alpha&quot; /&gt;, then proper equation is&lt;br /&gt;
&lt;img src=&quot;http://www.codecogs.com/eq.latex?V&amp;#039;=\alpha V&quot; /&gt;, where &lt;img src=&quot;http://www.codecogs.com/eq.latex?V&amp;#039;&quot; /&gt; is taken after collision and &lt;img src=&quot;http://www.codecogs.com/eq.latex?V&quot; /&gt; before.&lt;br /&gt;
Another thing I&amp;#8217;ve done is support of generic polyhedra. For example, now we&lt;br /&gt;
can experiment not just with cubes, but with parallelepipeds or tetrahedra. And&lt;br /&gt;
in future this will help us to handle arbitrary shapes by approximating them&lt;br /&gt;
with polyhedra, using point repulsion algorithm which I&amp;#8217;m going to implement&lt;br /&gt;
(it&amp;#8217;s also needed for semi-adjusting BSP trees).&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/3358#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Wed, 06 Aug 2008 07:55:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">3358 at http://planet-soc.com</guid>
</item>
<item>
 <title>Status report: week 9-10</title>
 <link>http://planet-soc.com/node/3270</link>
 <description>&lt;p&gt;I&amp;#8217;m back from &lt;a href=&quot;http://imc-math.org/&quot;&gt;IMC&lt;/a&gt; at Bulgaria with second prize, and ready to work!&lt;/p&gt;

&lt;p&gt;While I was away I thought about generic convex polyhedra and actually&lt;br /&gt;
started implementing them. I hope to finish that in a few days. This&lt;br /&gt;
not only makes engine practically more useful but also makes some&lt;br /&gt;
computations more cheap and robust.&lt;/p&gt;

&lt;p&gt;Also I discovered some problem with my last collision handler. It&lt;br /&gt;
conforms to one paper, and now I doubt that paper is correct. I&amp;#8217;ll&lt;br /&gt;
consult local physicists in the nearest time.&lt;/p&gt;

&lt;p&gt;Finally, I read several papers on broad-phase collision detection. The&lt;br /&gt;
one I liked most is &lt;a href=&quot;http://www.inf.ufrgs.br/~comba/papers/2005/sabsp-i3d05.pdf&quot;&gt;Broad-Phase Collision Detection Using Semi-Adjusting&lt;br /&gt;
BSP-trees&lt;/a&gt;. So I&amp;#8217;ll start implementing it as soon as possible.&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/3270#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Sat, 02 Aug 2008 20:46:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">3270 at http://planet-soc.com</guid>
</item>
<item>
 <title>Status report: week 7-8</title>
 <link>http://planet-soc.com/node/3074</link>
 <description>&lt;p&gt;Last week I&amp;#8217;ve implemented full handling of rigid bodies collision. When two&lt;br /&gt;
bodies collide, not just they velocities, but also their angular velocities are&lt;br /&gt;
modified, as it is in real world.&lt;br /&gt;
Now, supposing engine is correct (it needs more testing, though), need to&lt;br /&gt;
make it fast (after all, this is what Data Parallel Haskell is about).&lt;br /&gt;
One of the obvious optimization is to perform broad-phase collision&lt;br /&gt;
detection, that is, to filter out pairs of bodies which certainly cannot collide&lt;br /&gt;
and run collision detection algorithm (which is then called narrow-phase) on the&lt;br /&gt;
pair of bodies left.&lt;br /&gt;
So, I&amp;#8217;ll need to study the subject and choose algorithm which is best&lt;br /&gt;
suitable for nested data parallelism. And there will be good chance for&lt;br /&gt;
that&amp;nbsp;&amp;mdash; I&amp;#8217;m leaving to participate in &lt;a href=&quot;http://imc-math.org/&quot;&gt;IMC&lt;/a&gt;.&lt;br /&gt;
I&amp;#8217;ve printed four papers describing broad-phase collision detection and will&lt;br /&gt;
study them while I&amp;#8217;m away (well, maybe I&amp;#8217;ll even find time to code&lt;br /&gt;
something).&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/3074#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Tue, 22 Jul 2008 19:32:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">3074 at http://planet-soc.com</guid>
</item>
<item>
 <title>Double buffering &amp; demo</title>
 <link>http://planet-soc.com/node/2723</link>
 <description>&lt;p&gt;With help and patches from kpierre and excid, Hpysics&amp;#8217; visulization code now performs double buffering, which makes it much more pleasant for eyes. Also this allowed me to record a demo.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://code.haskell.org/~feuerbach/hpysics-cubes.ogv&quot;&gt;Ogg Theora version&lt;/a&gt; [2.1M]&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=uziCn2SBbxs&quot;&gt;YouTube version&lt;/a&gt; (but their player doesn&amp;#8217;t go well on this video for some reason)&lt;/li&gt;
&lt;/ul&gt;
</description>
 <comments>http://planet-soc.com/node/2723#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Tue, 08 Jul 2008 13:34:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">2723 at http://planet-soc.com</guid>
</item>
<item>
 <title>QuickCheck puzzle: the answer</title>
 <link>http://planet-soc.com/node/2721</link>
 <description>&lt;p&gt;Some time ago I &lt;a href=&quot;http://physics-dph.blogspot.com/2008/06/status-report-week-5.html&quot;&gt;mentioned&lt;/a&gt; a problem I&amp;#8217;ve run into with QuickCheck: the following code, intended for generation of non-zero random vectors, does not terminate:&lt;/p&gt;

&lt;pre&gt;nonzero :: Gen Vec
nonzero = do
  v &amp;lt;- arbitrary
  if norm v &amp;gt; 0 then return v else nonzero&lt;/pre&gt;&lt;p&gt;
Now it&amp;#8217;s time to give the answer to this puzzle, which was found by Dmitry Astapov (ADEpt). Test data generators have an implicit size parameter, which is passed down in monadic computation. So if we got zero size, we will always get zero vectors &amp;#8212; &amp;#8220;arbitrary&amp;#8221; vectors with components from interval [0;0]. So, solution may look like &lt;/p&gt;
&lt;pre&gt;nonzero = do
  v &amp;lt;- arbitrary
  if norm v &amp;gt; 0 then return v else resize 1 nonzero&lt;/pre&gt;
</description>
 <comments>http://planet-soc.com/node/2721#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Tue, 08 Jul 2008 11:56:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">2721 at http://planet-soc.com</guid>
</item>
<item>
 <title>Status report: week 6</title>
 <link>http://planet-soc.com/node/2705</link>
 <description>&lt;p&gt;Well, it was too optimistic to think that V-Clip is working properly. Number of bugs, errors and just stupid mistakes was sufficient to keep me busy till now. (Although they were not only related to my V-Clip implementation, but to simulation algorithm too, and also I found &amp;#8212; and fixed in my implementation &amp;#8212; an error in V-Clip paper itself &amp;#8212; I&amp;#8217;ll probably write about this later.) But I have good news :)&lt;/p&gt;

&lt;p&gt;{- Here a demo video supposed to be, but unfortunately I can&amp;#8217;t get it of acceptable quality, so you&amp;#8217;re encouraged to build and run &lt;code&gt;vis.hs&lt;/code&gt;. -}&lt;/p&gt;

&lt;p&gt;As you can see, V-Clip isn&amp;#8217;t only consuming CPU time, but really detects collisions. Although this demo might seem physically realistic, it isn&amp;#8217;t &amp;#8212; only linear, but not angular velocities are updated during collisions. This is what I&amp;#8217;m going to do this week.&lt;/p&gt;

&lt;p&gt;Aside from fixing bugs, I also improved simulation code &amp;#8212; now it guarantees that during collision &lt;em&gt;opposite&lt;/em&gt; impulses are applied to bodies, and also makes twice as little collision checks.&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/2705#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Tue, 08 Jul 2008 00:40:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">2705 at http://planet-soc.com</guid>
</item>
<item>
 <title>V-Clip seems to work!</title>
 <link>http://planet-soc.com/node/2600</link>
 <description>&lt;p&gt;Finally, I&amp;#8217;ve got V-Clip working. At least now (after one bugfix) it always terminates &amp;#8212; quite encouraging for such algorithm!&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;*Properties&amp;gt; quickCheck prop_VClipTerminates 
OK, passed 100 tests.
32% Done, (&quot;Edge&quot;,&quot;Edge&quot;).
14% Done, (&quot;Edge&quot;,&quot;Vertex&quot;).
11% Done, (&quot;Vertex&quot;,&quot;Edge&quot;).
10% Done, (&quot;Face&quot;,&quot;Vertex&quot;).
8% Penetration, (&quot;Face&quot;,&quot;Vertex&quot;).
8% Done, (&quot;Vertex&quot;,&quot;Face&quot;).
7% Done, (&quot;Vertex&quot;,&quot;Vertex&quot;).
5% Penetration, (&quot;Vertex&quot;,&quot;Face&quot;).
3% Penetration, (&quot;Face&quot;,&quot;Edge&quot;).
2% Penetration, (&quot;Edge&quot;,&quot;Face&quot;).
&lt;/pre&gt;&lt;p&gt;The next step in testing will be visualizing cubes collisions &amp;#8212; and I&amp;#8217;m still moving towards rotation!&lt;/p&gt;&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/2600#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Wed, 02 Jul 2008 00:15:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">2600 at http://planet-soc.com</guid>
</item>
<item>
 <title>Status report: week 5</title>
 <link>http://planet-soc.com/node/2546</link>
 <description>&lt;p&gt;This week I was implementing Mirtich&amp;#8217;s V-Clip algorithm for collision detection.&lt;br /&gt;
Also I found several bugs in my functions, which took some time to fix. To check the code I used QuickCheck properties. I expect to finish V-Clip during the first half of the following week, if everthing goes fine.&lt;br /&gt;
I also found time to cabalize and haddockize Hpysics. Note that you need haddock 2 to build docs, because earlier versions don&amp;#8217;t like parallel arrays syntax.&lt;br /&gt;
Also, there was an interesting challenge with QuickCheck. To test some things I need to generate non-zero vectors. I tried the following:&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;nonzero :: Gen Vec
nonzero = do { v &amp;lt;- arbitrary; if norm v &amp;gt; 0 then v else nonzero }&lt;/pre&gt;&lt;p&gt;(i.e. if we got zero vector, just generate another one until we get what we want), but for some reason this code doesn&amp;#8217;t terminate. To understand why, I probably should learn more about how QuickCheck&amp;#8217;s rng works, but I won&amp;#8217;t complain if someone explains this effect :)&lt;/p&gt;&lt;/p&gt;
</description>
 <comments>http://planet-soc.com/node/2546#comments</comments>
 <category domain="http://planet-soc.com/taxonomy/term/52">haskell.org</category>
 <category domain="http://planet-soc.com/taxonomy/term/181">Planet SoC</category>
 <pubDate>Sat, 28 Jun 2008 18:16:00 +0200</pubDate>
 <dc:creator>ro-che</dc:creator>
 <guid isPermaLink="false">2546 at http://planet-soc.com</guid>
</item>
</channel>
</rss>
