Collision Class Reference

A Modifier that perfoms particle against particle collisions in the Group. More...

Inheritance diagram for Collision:
Modifier Registerable Transformable BufferHandler

List of all members.

Public Member Functions

 Collision (float scale=1.0f, float elasticity=1.0f)
 Constructor of the Collision modifier.
void setScale (float scale)
 Sets the scale of particles to compute their radius.
void setElasticity (float elasticity)
 Sets the elasticity of the collisions.
float getElasticity () const
 Gets the elasticity of the collisions.
float getScale () const
 Gets the scale applied on particle radius.

Static Public Member Functions

static Collisioncreate (float scale=1.0f, float elasticity=1.0f)
 Creates and registers a new Collision.

Detailed Description

A Modifier that perfoms particle against particle collisions in the Group.

The collision between particles uses the size of the particle to determine its radius.
The radius of a particle is computed as follows : radius = size * scale * 0.5f

Moreover the mass ratio of two particles colliding is used to get realistic collision.

The collision can be set as being elastic or inelastic. This is determined thanks to the elasticity of this modifier :

Note that collision particle vs particles requires intensive processing. Moreover the algorithm has a complexity that badly scales which means processing times increase fastly as particles count increase.
Tries to limitate the number of particles to perform collision on. More than 1000 particles can require a lot of processing time even of recent hardware.

The accuracy of the collisions is better with small update steps. Therefore try to keep the update time small by for instance multiplying the number of updates per frame.

Since:
1.04.00

Definition at line 58 of file SPK_Collision.h.


Constructor & Destructor Documentation

Collision ( float  scale = 1.0f,
float  elasticity = 1.0f 
)

Constructor of the Collision modifier.

Parameters:
scale : the scale of the particles
elasticity : the elasticity of the collisions

Member Function Documentation

Collision * create ( float  scale = 1.0f,
float  elasticity = 1.0f 
) [static]

Creates and registers a new Collision.

Parameters:
scale : the scale of the particles
elasticity : the elasticity of the collisions
Since:
1.04.00

Definition at line 135 of file SPK_Collision.h.

float getElasticity (  )  const

Gets the elasticity of the collisions.

Returns:
the elasticity of the collisions

Definition at line 153 of file SPK_Collision.h.

float getScale (  )  const

Gets the scale applied on particle radius.

Returns:
the scale

Definition at line 158 of file SPK_Collision.h.

void setElasticity ( float  elasticity  ) 

Sets the elasticity of the collisions.

The elasticity of the collisions refers to the coefficient of restitution (also called bounciness).
See the class description for more information.

Parameters:
elasticity : the elasticity of the collisions

Definition at line 142 of file SPK_Collision.h.

void setScale ( float  scale  ) 

Sets the scale of particles to compute their radius.

The radius of a particle is computed as follows :
radius = size * scale * 0.5f

Parameters:
scale : the scale of the particles

Definition at line 148 of file SPK_Collision.h.


Generated on Wed Apr 27 21:09:26 2011 for SPARK Particle Engine by  doxygen 1.6.1