"
Particle System" is a
term often used in
computer graphics/
computer programming to refer to a
collection of
objects ("Particles") which indivdually follow
simple rules, but when combined simulate a
complex system.
Various types of particle systems are often used to simulate
rain,
snow,
explosions,
fire,
smoke, and many other
natural and
artificial or
special effects.
In most cases each
particle is assigned certain
bits of
information such as
velocity,
position,
color, and
size. There are often other outside forces which are applied to the particle system as a whole, such as
wind and
gravity. In more complex particle systems particles may interact with each other and the environment as well, allowing them to
collide with the
ground or other objects,
attract or
repel each other, and the like.
Pseudo-code (in broken
C) for an extremely
simple particle system follows:
typedef struct Particle {
float X,Y;
float XV, YV;
int color;
};
Particle particle[NUMBER_OF_PARTICLES];
void main() {
for (EACH_PARTICLE) {
particle[CURRENT_PARTICLE].X += particle[CURRENT_PARTICLE].XV;
particle[CURRENT_PARTICLE].Y += particle[CURRENT_PARTICLE].YV;
DRAW_CURRENT_PARTICLE();
}
}