FEMS – Finite Element Material Simulation


(Screenshot) HAVE you ever wondered what it looks like to suspend a cube of jelly from one corner, let it swing a bit, then let it go and watch it land and bounce, and try the same thing with different amounts of gelatine?

Quite possibly not, but here is the chance to try it anyway. Download and extract the zip-file below, and run ‘fems.exe’. With any luck, you should see a lightsource-shaded cube drop down from the top of the screen, with one corner stretching out as it is attached to some imaginary fixed point, and eventually start to swing back and forth, much like it is shown in the picture on the right.

To release the cube, press Space. It will either bounce on the ground or collapse depending on how strong the jelly is, and how high it was dropped from. There is an invisible ledge to the left of the cube: if you let it go at the right time, it will either fall straight down or land and topple over the edge - in both cases it will continue to fall into a bottomless pit.

The effect of the demo can be changed by editing the lines of ‘world.txt’. The important lines are the ones labelled `k' and `damping' - making them higher will produce stiffer jelly, lowering them makes the jelly somewhat runnier (and less bouncy). The program ignores whatever is written after the number on a line, but don't add or remove any extra lines. If the `k' and damping are set too high, the jelly has a tendancy to explode (I don't know where the extra energy comes from ... perhaps from the carbohydrate). To remedy this, increase the `time resolution', though this will slow the demo down.

The still pictures here don't really do the demo justice, so I recommend you download it and run it, preferably on a fast machine with a 3D graphics card. My P200 with Voodoo1 will show it at 60fps.


Physics


(Screenshot)

Physics is a simple solid-body physics simulator. The demo program features two balls, each fixed at a single point. Pressing the space-bar releases further balls to rain down, providing mild amusement as all the balls dance around.

It’s a simple simulation based half on A-Level mechanics and half on guesswork, but I have provided the source code for anyone to look at. The simulation works by having a set of spherical bodies with: a mass; a moment of interia vector[1]; a radius (for when the balls collide); a position as a displacement vector; a rotation as a quarternion; a velocity vector; an angular velocity vector (i.e. angular momentum).

The fixed points of the spheres are produced by applying a strong restoring force to the particular point on the sphere, essentially it’s just a thick rubber connection. Two fixed points on a line will give a fixed axis, and three points would make it completely fixed to another body. There is a static Earth body, which in the demo is what the spheres are attached to, which simply ignores any force applied to it.

[1] Since writing the program I have learnt that the moment of inertia should be a matrix and not a vector, although since all the bodies in the program have complete symmetry, it makes no difference anyway.


Instructions

The following keys are useful in both programs:

←↓↑→Walk around
< >Sidestep left and right
PageUp, PageDownClimb up and down
A, ZLook up and down
FTurn fog-effect on or off
Space-barDrop jelly (FEMS) or another ball (Physics)

All assuming you are using a US/UK keyboard. Other layouts may cause variation...


Download

© 2000 Richard Collins


Links


[\/] <- [$$] Email: richard@rejc2.co.uk


<< Back to Richard Collins’ Programming Page