Tuesday, May 12, 2009

LambdaCube accepted to JSSP

LambdaCube render engine by Csaba Hruska is accepted as Jane Street Summer Project this year. Congratulations, Csaba!

Friday, April 3, 2009

Hpysics + GrapeFruit (and hackathon)

The 5th Haskell Hackathon will be the place where Hpysics will meet Grapefruit — a library for Functional Reactive Programming with a focus on user interfaces. It means that one of our goal on Hac5 is integrating Grapefruit with Hpysics.

Tonight we held an IRC meeting where this and other goals of Grapefruit were discussed. The main points (regarding Hpysics) are:

  • There are people interested in Hpysics (and particularly in Hpysics+Grapefruit)
  • There should be no problems to integrate Hpysics with Grapefruit. However, in the new version of Grapefruit there are no means of visualization yet. We'll need to tackle this at Hackathon, too.

Friday, March 27, 2009

Recent activity

For now, I rewrote Hpysics to use plain lists instead of parallel arrays. I will investigate DPH applicability a bit later, when I fix some other things.

Also, there's now an issue tracker for Hpysics.

Tuesday, December 2, 2008

DPH docs and project status

DPH devs finally updated the documentation on using Data Parallel Haskell!

To talk about Hpysics, as I've figured out the code was not properly vectorised, and this is probably the main reason of bad performance. Working on it.

Thursday, November 20, 2008

The Monad Reader, SoC special

The Monad.Reader Issue 12 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.

Thanks to Thomas Schilling and Roman Leshchinskiy for help with the article.

Tuesday, August 12, 2008

Status report: week 11-12

As I wrote before, I added complete support for polyhedra and fixed collision handler.

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's center of mass, it's rotationally invariant.

Then I spent some time trying to compile head GHC and DPH. My (not so pleasant) experience is described here.

When I succeeded, I wrote simple benchmark to evaluate gains from using bounding volumes. Result was disappointing -- 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.

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.

Also, I'll be writing SoC report for the Monad Reader soon. If you'd like some particular issue to be explained or highlighted there, feel free to tell me!

Wednesday, August 6, 2008

Physics and polyhedra

Thanks to my fellow physicist, Oleg Matveychuk, I've done with the collision handler bug I said in the last status report. That was indeed a mistake in the paper (Collision Detection and Response for Computer Animation).

One of the collision equation in that paper looks like

Here, is linear and is angular velocity of each of two bodies, is the vector pointing from center of mass to collision point, and is normal to collision plane. The expression in parens, let's call it , is relative velocity of collision points of two bodies. So, Moore and Wilhelms propose to set to 0.

It appears that this corresponds to completely unelastic collision (with restitution coefficient equal to 0), and that's why it doesn't look too realistic.

If we have coefficient of restitution , then proper equation is , where is taken after collision and before.

Another thing I've done is support of generic polyhedra. For example, now we can experiment not just with cubes, but with parallelepipeds or tetrahedra. And in future this will help us to handle arbitrary shapes by approximating them with polyhedra, using point repulsion algorithm which I'm going to implement (it's also needed for semi-adjusting BSP trees).