Kinetic Visualization (Visualisierung 2 - S2012)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Member Functions | Private Attributes
Particle Class Reference

This class represents a single particle. More...

#include <Particle.h>

List of all members.

Public Member Functions

 Particle (const vl::vec3 &pos, const vl::vec3 &dir, int w, int h, int d)
 ~Particle (void)
void prepareUpdate (vl::ref< vl::Image > image, vl::ref< vl::Image > gradient, vl::ref< vl::Image > curvature, ParticleMap &map, const std::vector< vl::vec3 > &candidatePositions, std::vector< bool > &spawnMap, float kC, float kF, float flockSigma, float kD, const vl::vec3 &userDir, float kR, float sigmaRepulse, bool enableDying, float crowdedThreshold, float crowdedSigma, int dyingNeighborhood, float density, bool stick)
void updateMap (ParticleMap &map, float dt)
void addToMap (ParticleMap &map)
void update (float dt)
vl::vec3 getDirection () const
vl::vec3 getPosition () const
vl::vec3 getWorldPosition () const

Private Member Functions

bool outOfBounds (const vl::vec3 &dir) const

Private Attributes

vl::vec3 _position
 Stores the position of the particle.
vl::vec3 _direction
 Stores the direction of the particle.
vl::vec3 _nextDirection
 Stores the next direction of the particle. This is set by prepareUpdate.
int _width
 Stores the width of the volume.
int _height
 Stores the height of the volume.
int _depth
 Stores the depth of the volume.
vl::vec3 _nextPosition
 Stores the next position of the particle.
bool _wasDeath
 Flag which indicates if the particle has died.

Detailed Description

This class represents a single particle.


Constructor & Destructor Documentation

Particle::Particle ( const vl::vec3 &  pos,
const vl::vec3 &  dir,
int  w,
int  h,
int  d 
)
  Initializes the particle.
Parameters:
posis the position of the particle in volume coordinates
diris the initial direction of the particle
wis the width of the volume
his the height of the volume
dis the depth of the volume
Particle::~Particle ( void  )

Member Function Documentation

void Particle::addToMap ( ParticleMap map)

Adds the particle to the particle map (initialization step).

vl::vec3 Particle::getDirection ( ) const
inline

Returns the direction of the particle.

vl::vec3 Particle::getPosition ( ) const
inline

Returns the model position of the particle.

vl::vec3 Particle::getWorldPosition ( ) const

Returns the world position of the particle. It transforms the volume coordinates to the range [-10,10].

bool Particle::outOfBounds ( const vl::vec3 &  dir) const
private
void Particle::prepareUpdate ( vl::ref< vl::Image >  image,
vl::ref< vl::Image >  gradient,
vl::ref< vl::Image >  curvature,
ParticleMap map,
const std::vector< vl::vec3 > &  candidatePositions,
std::vector< bool > &  spawnMap,
float  kC,
float  kF,
float  flockSigma,
float  kD,
const vl::vec3 &  userDir,
float  kR,
float  sigmaRepulse,
bool  enableDying,
float  crowdedThreshold,
float  crowdedSigma,
int  dyingNeighborhood,
float  density,
bool  stick 
)

This method essentially does the bulk work and sets the _nextDirection according to the particle system's rules.

Parameters:
imageis the volume
gradientis the gradient map
candidatePositionsare the candidate positions where particles might spawn on the map
curvatureis the curvature map
mapis a map of all particles
spawnMapis a boolean map indicating where dead particles are spawning. This is to prevent collisions on spawning particles.
kCis the influence of the curvature
kFis the influence of the flocking
flockSigmais essentially the neighborhood-size which should be used for flocking
kDis the influence of the preferred user direction
userDiris the user preferred direction
kRis the influence of the repulsion
sigmaRepulseis the size of the neighborhood used for repulsion
enableDyingis a flag, which indicates whether particles should die
crowdedSigmainfluences the neighbourhood which should be checked if a particle dies
crowdedThresholdis a threshold above which a particle dies
dyingNeighborhood
densityis the initialization particle density
stickindicates if particles should stick to the surface.
void Particle::update ( float  dt)

Updates the actual position of the particle on the particle map.

void Particle::updateMap ( ParticleMap map,
float  dt 
)

Updates the position of the particle on the particle map and removes the old position from the map.


Member Data Documentation

int Particle::_depth
private

Stores the depth of the volume.

vl::vec3 Particle::_direction
private

Stores the direction of the particle.

int Particle::_height
private

Stores the height of the volume.

vl::vec3 Particle::_nextDirection
private

Stores the next direction of the particle. This is set by prepareUpdate.

vl::vec3 Particle::_nextPosition
private

Stores the next position of the particle.

vl::vec3 Particle::_position
private

Stores the position of the particle.

bool Particle::_wasDeath
private

Flag which indicates if the particle has died.

int Particle::_width
private

Stores the width of the volume.


The documentation for this class was generated from the following files: