<<<<<<<<<<<<<<<<<

particle_system(modeller) LYMB particle_system(modeller)

NAME

particle_system - create a particle system (i.e., oriented, colored lines that look like streaking particles)

DESCRIPTION

The particle_system object creates one or more geometric representations of a particle system. A partical system consists of many oriented lines, possibly colored, which are projected from a specified spherical region. The particles may have a life and may be influenced by gravity.

The particle system works as follows. One or more particle systems may be added each time an "update!" message is received. ("Update!" is automatically sent once on initialization, and the initial system consists of zero length lines.) The creation of these systems is controlled by a number of parameters. Each "update!" message bumps an internal iteration counter by one. If the iteration counter is less than the duration, a total of num_new_parts particle systems are created at each "update!". The average life of each particle in the system may be controlled with the life instance variable.

The particles are directed in a random orientation within the cone defined by the instance variable spread, from within the sperical region defined by radius, and with iniital average speed. The axis of the cone is the y- axis. Gravity can influence the trajectory of the particles: negative values pull the particles down. If the particle falls below ground_height, it is automatically extinguished.

Because the particle_system is a subclass of new_modeller, it responds to the "data?" message and can be used in the display_data pipeline. In addition, particle_system also inherits the convenience routines from new_modeller (e.g., output!).

Particle_system is often used to mimic things like engine exhaust, volcanoes, comets, or burning/exploding objects.

SUPERCLASS

new_modeller

INSTANCE VARIABLES

num_parts number of particles in each particle system created.

num_new_parts number of new particle systems to create during each update.

gravity pull particles along y-axis. Looks like gravity: values < 0 look like conventional gravity.

radius particles are randomly generated within a sphere of this radius.

duration controls how long new particle systems are added for each "update!" message.

life average life of the particles in the system.

speed average speed of the particles in the system

spread particles are randomly launched along y-axis with spread variation in angle.

colors boolean controls whether random colors are given to particles.

ground_height particles falling below this height are extinguished.

status boolean indicates whether particle systems are all extinguished or not.

MESSAGES

EXAMPLES

The following LYMB script creates a particle system and then animates it through 100 iterations.

/* * Script to generate particle system */ particle_system new: psys life= 100 duration=100 num_parts=5 num_new_parts=2 gravity= -0.15 ground_height= -5 colors_on! ;

actor new: psys_actor modeller=psys ;

environment new: _env variable="LYMB_RENDERER"; string new: current_renderer = [_env value?];

camera new: acamera position=(1,0,1) x_range=(-5,5) y_range=(-5,5) z_range=(-5,5) default! on! ;

light new: alight position=[acamera position?] focal_point=[acamera focal_point?] on! ;

object# current_renderer new: main_renderer actors=([actor instances?]) lights=alight cameras=acamera ;

loop new: l resolution=1 duration=100 start_actions=` psys reset!; ' tick_actions=` psys update!; main_renderer render!; '

start! ;

SEE ALSO

new_modeller, modeller, display_data, display_filter, shrink_filter, actor, renderer


Please send comments and suggestions to
consult@rpi.edu