kestas.kuliukas.com

Java Processing apps

The apps I've done for the Java Processing API; simple useless stuff either to learn about computer graphics during a computer graphics unit or just to see something interesting.

Each applet can be opened and viewed live in a seperate page, but Java is required to do so.


Evolution sandbox

This is the only applet which doesn't use the Processing API; it uses regular Java Swing instead, to give a normal form instead of something visual.
It is partly to learn Java Swing, but also as a demo tool to allow my dad to demonstrate that small selection pressures will still result in the favoured alleles becoming dominant.

In the above screen the favoured "DNA" is AAAAAAAAAA, and after running for a while the total frequency of favoured alleles has risen to ~30% from the random starting point of 20%. This is despite a bonus per favoured allele of 0.05% and a 0.5% chance of drowning (an advantage so small that of ~220,000 dying/sec only ~15 are saved as a result of having a genetic advantage).

Even lower advantages still result in the favoured alleles becoming dominant given enough time, and the batch queue lets you run many configurations in a row and log the output.

See this page for more details on how it works.

Open this applet


Particle motion demo

This one has no point; a bunch of red dots eat, breed, run around and die. There is grey food and predators can be added, but the only reason for this existing is that it's fun to watch. The fluid motion of the red groups hopping around from grey blob to grey blob is more fun to look at than you'd think from looking at the still image.

Pressing Q releases some white predator squares which eat the red blobs, and the red blobs run away from them. Watching the population rise and fall is quite fun.

Open this applet


3D projection view pipeline demo

A full 3D transform/viewing pipeline. No 3D API is used, just line-drawing, but using matrix transforms for each stage in the viewing pipeline 3D coordinates are projected onto a 2D viewport. A few 3D shapes such as a sphere, house, axes, etc, spin and can be moved around.

The view coordinates, view vector and view-up angle (the three main vectors which control the viewport's orientation) can be changed using the keyboard. It takes some time to get your head around it, but having a view pipeline to play with is definitely useful if you're trying to learn about them. You can't guess by looking at the applet the number of calculations involved in converting a simple 3D wire frame to a 2D projection.

Open this applet


Raster/bitmap demo

A raster demo; line & circle drawing algorithms drawing on a custom bitmap grid. In the one above lines have drawn across the frame without supersampling, and in the one below supersampling is turned on.

The most common line/circle drawing algorithms are implemented in the code and work "pixel" by "pixel", instead of using the Processing API itself. This may only find any use/interest as a learning aid.

Open this applet