PointMass Class Reference

A Modifier defining a point with a mass that attracts or repulses particles. More...

Inheritance diagram for PointMass:
Modifier Registerable Transformable BufferHandler

List of all members.

Public Member Functions

 PointMass (Zone *zone=NULL, ModifierTrigger trigger=INSIDE_ZONE, float mass=1.0f, float minDistance=0.05f)
 Constructor of PointMass.
void setPosition (const Vector3D &pos)
 Sets the delta position from the position of the zone (or origin if no zone set).
void setMass (float mass)
 Sets the mass of this PointMass.
void setMinDistance (float minDistance)
 Sets the minimum distance of this PointMass.
const Vector3DgetPosition () const
 Gets the delta position.
const Vector3DgetTransformedPosition () const
 Gets the transformed delta position.
float getMass () const
 Gets the mass of this PointMass.
float getMinDistance () const
 Gets the minimum distance of this PointMass.

Static Public Member Functions

static PointMasscreate (Zone *zone=NULL, ModifierTrigger trigger=INSIDE_ZONE, float mass=1.0f, float minDistance=0.05f)
 Creates and registers a new PointMass.

Protected Member Functions

virtual void innerUpdateTransform ()
 Updates all the parameters in the world coordinates.

Detailed Description

A Modifier defining a point with a mass that attracts or repulses particles.

A PointMass triggered on a Particle will affect its velocity as followed :
dist = pointMassPosition - particlePosition
particleVelocity += dist * mass * step / max(minDistance,|dist|)

Definition at line 38 of file SPK_PointMass.h.


Constructor & Destructor Documentation

PointMass ( Zone zone = NULL,
ModifierTrigger  trigger = INSIDE_ZONE,
float  mass = 1.0f,
float  minDistance = 0.05f 
)

Constructor of PointMass.

Parameters:
zone : the Zone of the PointMass
trigger : the trigger of the PointMass
mass : the mass of the PointMass
minDistance : the minimum distance of the PointMass

Member Function Documentation

PointMass * create ( Zone zone = NULL,
ModifierTrigger  trigger = INSIDE_ZONE,
float  mass = 1.0f,
float  minDistance = 0.05f 
) [static]

Creates and registers a new PointMass.

Parameters:
zone : the Zone of the PointMass
trigger : the trigger of the PointMass
mass : the mass of the PointMass
minDistance : the minimum distance of the PointMass
Returns:
A new registered PointMass
Since:
1.04.00

Definition at line 148 of file SPK_PointMass.h.

float getMass (  )  const

Gets the mass of this PointMass.

Returns:
the mass of this PointMass

Definition at line 182 of file SPK_PointMass.h.

float getMinDistance (  )  const

Gets the minimum distance of this PointMass.

Returns:
the minimum distance of this PointMass

Definition at line 187 of file SPK_PointMass.h.

const Vector3D & getPosition (  )  const

Gets the delta position.

Returns:
the delta position
Since:
1.03.02

Definition at line 172 of file SPK_PointMass.h.

const Vector3D & getTransformedPosition (  )  const

Gets the transformed delta position.

Returns:
the transformed delta position
Since:
1.03.02

Definition at line 177 of file SPK_PointMass.h.

void innerUpdateTransform (  )  [protected, virtual]

Updates all the parameters in the world coordinates.

This method can be overriden in derived classes of Transformable (By default it does nothing).
It is this method task to compute all parameters of the class that are dependent of the world transform.

Reimplemented from Transformable.

Definition at line 192 of file SPK_PointMass.h.

void setMass ( float  mass  ) 

Sets the mass of this PointMass.

The mass defines the strenght of the attraction. The more the mass, the stronger the attraction.
A position mass will result into an attraction while a negative mass will result into a repulsion. Moreover a mass equal to 0 make the PointMass have no effect.

Parameters:
mass : the mass of this PointMass

Definition at line 161 of file SPK_PointMass.h.

void setMinDistance ( float  minDistance  ) 

Sets the minimum distance of this PointMass.

The minimum distance of the PointMass is the minimum distance that can be considered to compute the force implied by the PointMass. If a distance between a Particle and a PointMass is inferior to the minimum distance of the PointMass, the distance is clamped to the minimum distance.
This avoids forces that approaching the infinity with Particle getting very close to the PointMass.

Parameters:
minDistance : the minimum distance of this PointMass

Definition at line 166 of file SPK_PointMass.h.

void setPosition ( const Vector3D pos  ) 

Sets the delta position from the position of the zone (or origin if no zone set).

Parameters:
pos : the delta position
Since:
1.03.02

Definition at line 155 of file SPK_PointMass.h.


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