Friday, June 13, 2008

Status report: week 3

This week I devoted to rotation. To test it I added cubic shape.

I use quaternions to represent orientation of body in space (see Quaternions and spatial rotation).

To integrate orientation of body over time, numerical methods of solving differential equations are used. Currently I use Euler method, but it can be easily replaced by any other, see Hpysics.ODE. Differential equation itself is produced by Hpysics.Simulation.rotationDE.

Finally, I added rotation visualization, so if you compile vis.hs, you can watch falling rotating cube.

Next, I need to handle collisions properly with respect to rotation. So, I'll need to implement collision detection for cubic shape, and when bodies collide, angular momentum should be added in addition to linear.

I also think about documentation, which should be added at some point. On the one hand, haddock is convenient with its hyperlinks. On the other, literate haskell is interesting alternative. It can be less formal and more descriptive then haddock.

7 comments:

alogic said...

If you put Make file, it would be easy to compile vis.hs.

Roman Cheplyaka said...

It is as easy as typing "ghc --make vis".
Also you'll need to install additional libraries (OpenGL+GLUT Haskell bindings and maybe GHC.PArr if it isn't shipped with your GHC distribution).

Roman Cheplyaka said...

I'll cabalize it, but a bit later...

chak said...

Please use Haddock and not literate Haskell. The GHC source code is a good example of how the literate style just doesn't work in a typical open source project.

Roman Cheplyaka said...

Interesting. I haven't looked at GHC source yet; what's wrong with it?

alogic said...

I compiled it but discover that I haven't glx support in Xserver. OMG:)

Roman Cheplyaka said...

alogic: me too. I think it can be enabled somehow...
Anyway, vis should work (although with some performance problems).