About me

Vladimir Nabokov

Books
Programming
Biochemistry
Aim | Communicate

Search
 


 

 

     
 
 

     
The Particle collisions demo, with an interesting formation developing - click to download
 
 
     

Particle collisions

The particle collision demo was an attempt to produce a home-made varient of a fractal generator, and construct a program that could produce original, irregular (and hopefully aesthetcially effective) results using (simple) mechanistic routines as the basis for the generation. In this I was partly successful - the generator ultimately relies upon the randomly generated coordinates of the points of creation of the particles; but the graphical results are nevertheless satisfying and almost compulsively watchable. Tiny particles, consisting of SVGA pixels, are projected around the inside of a box in a simple manner, and eventually coagulate with a central mass, accumulating in strange, icicle projections. As these become longer and more obstructive, they gather still more particles, gaining striations and knobbles of their own. The process, although (comparatively) simple to code, is fascinating; I have sat and watched the programming functioning for over half an hour on some occasions - it would make a great screensaver. The program works by storing the central coagulation on the virtual screen, and by using the graphical library methods to access the coordinates when the immobilisation of travelling particles must be evaluated. As further particles are removed from 'solution', additional ones are reintroduced randomly, so allowing the central crystalline mass to grow. The shapes produced can be quite extraordinary, even if the ultimate results of the program can appear somewhat bizaare: the entire box becomes filled with an irregular matrix of the associated pixels. There are several interesting pieces of coding involved in this demo, most notably in the use of a graphical routine to store essentially non graphical information, ie. the configuration of the immobile pixels, interpreted onto the 2D matrix that constutes the graphical output. This has one major advantage; the graphical routines contain within them extremely fast procedures for the accessing of arrays larger than 64K, which is required for the storage of such a complex shape. To program this de novo is a major undertaking, essentially that of producing the SVGA graphics library; creative use of the existing library neatly avoids this. There is endless potential for this sort of abuse of the graphics library; as long as the virtual screen is temporarily free, it can be used to store large amounts of raw data. This demo is available with full pascal source.

Download the 'Collisions' demo (24 kb, zipped) | Back to Graphical trinkets

 
 
Letters from Terra | Updated 15th December 2004 | By Jonathan Ayling