beltoforion.de
 Impressum |  CSS |  XHTML

Fishtank simulation

This applet is based on a simple N-body problem. To be exact a badly written N-Body Problem since it uses an explicit Euler integration scheme which is terribly inaccurate. Nevertheless the inaccuracy is what makes it interesting. And after all this justifies putting a badly written N-Body problem on this page.

Details

We start with N-Bodies. Half of them are positively charged the other half is negatively charged. They attract or repel one another according to Colombs law. If they come close to each other the explicit euler scheme fails miserably which allows them to gain lot of additional energy out of nothing. So with a bit of phantasy it looks like red and blue fish are mating.

java plugin is missing
This code is pretty old and I'm using the euler scheme here and it is so bad that there is not even the slightest hint of energy conservation in this simulation. Thats why fish seem to literally explode away after getting really close to one another. But i like the effect so i never fixed it.

Download and Useage


Download icon  Download jar file
Download icon  Download source code (requires Netbeans)

In order to use the applet add the following lines to your html code:

  <object classid="java:fishes.class" type="application/x-java-applet" width="400" height="400">
    <param name="code" value="fishes.class"/>
    <param name="archive" value="JFishtank.jar"/>
    <param name="number" value="500"/>
    <param name="sleep" value="5"/>
    <param name="preview" value="false"/>
  </object>
    

The following table lists the applet parameters and their meaning.

Parameter Meaning
number The number of fish involved
sleep time to wait after each frame (in milli seconds)
preview If this value is true the applet looks like an image only moving when the mouse is over the applet.