Core 1.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Dla2 Class Reference

A diffusion limited aggregation class. More...

#include <dla.h>

Inheritance diagram for Dla2:
ParticleSet2

Public Member Functions

 Dla2 (const double &)
 Create the diffuse limited aggregation structure. More...
 
 Dla2 (const Circle2 &, const double &)
 Create a diffuse limited aggregation structure. More...
 
 Dla2 (const Circle2 &, const QVector< Vector2 > &, const double &)
 Create a diffuse limited aggregation structure. More...
 
 ~Dla2 ()
 Empty.
 
void Add ()
 Add a new particle to the cluster. More...
 
void AddBorder ()
 Add a new particle to the cluster. More...
 
void Step (int)
 Add several particles to the cluster. More...
 
void Extend (const double &)
 Extend the radius of the simulation.
 
void Agregate (const Vector2 &)
 Perform a random walk from an initial position, and aggregate particle if it hits the cluster. More...
 
QVector< int > GetIndices () const
 Return the indices.
 
Box2 GetBox () const
 Return the bounding box of the cluster.
 
void Draw (QGraphicsScene &) const
 Draw the cluster. More...
 
bool Hit (const Vector2 &, int &) const
 Detect the intersection between a disc and the cluster. More...
 
bool Hit (const Vector2 &) const
 Detect the intersection between a disc and the cluster. More...
 
- Public Member Functions inherited from ParticleSet2
 ParticleSet2 ()
 Empty constructor.
 
 ParticleSet2 (const double &)
 Create an empty set of particles. More...
 
 ParticleSet2 (const Vector2 &, const double &)
 Create a set of particles. More...
 
 ParticleSet2 (const QVector< Vector2 > &, const double &)
 Create a set of particles. More...
 
Circle2 At (int) const
 Get the k-th particle. More...
 
double Radius () const
 Return the radius of the particles.
 
QVector< Vector2GetCenters () const
 Return the centers of the particles.
 
Circle2 GetCircle () const
 Computes the bounding circle of the centers of the particles. More...
 
bool Intersect (const Circle2 &) const
 Check the intersection between the cluster and a circle. More...
 
bool Intersect (const Box2 &) const
 Check the intersection between the cluster and a box. More...
 
void Draw (QGraphicsScene &) const
 Draw the set of particles. More...
 

Protected Member Functions

bool Walk (Vector2 &, int &, int=2000)
 Perform a random walk until the particle either collides with the cluster, or until it reaches the maximum number of steps or escapes from the domain. More...
 

Protected Attributes

Circle2 circle
 Bounding circle of the domain.
 
QVector< int > v
 Tree structure topology, i.e., index of the collided particle during cluster growth.
 
- Protected Attributes inherited from ParticleSet2
QVector< Vector2points
 Set of particles.
 
double r
 Radius of particles.
 

Detailed Description

A diffusion limited aggregation class.

Constructor & Destructor Documentation

◆ Dla2() [1/3]

Dla2::Dla2 ( const double &  r)
explicit

Create the diffuse limited aggregation structure.

Set initial circle as empty, and list of particles as empty.

Parameters
rRadius of particles.

◆ Dla2() [2/3]

Dla2::Dla2 ( const Circle2 c,
const double &  r 
)
explicit

Create a diffuse limited aggregation structure.

Parameters
cInitial circle.
rRadius of particles.

◆ Dla2() [3/3]

Dla2::Dla2 ( const Circle2 c,
const QVector< Vector2 > &  p,
const double &  r 
)
explicit

Create a diffuse limited aggregation structure.

Parameters
cInitial circle.
pSet of seed points.
rRadius of particles.

Member Function Documentation

◆ Add()

void Dla2::Add ( )

Add a new particle to the cluster.

The particle is generated inside the embedding disc.

◆ AddBorder()

void Dla2::AddBorder ( )

Add a new particle to the cluster.

The particle is generated on the border of the embedding disc.

◆ Agregate()

void Dla2::Agregate ( const Vector2 start)

Perform a random walk from an initial position, and aggregate particle if it hits the cluster.

Parameters
startInitial position.

◆ Draw()

void Dla2::Draw ( QGraphicsScene &  scene) const

Draw the cluster.

Parameters
sceneGraphics scene.

◆ Hit() [1/2]

bool Dla2::Hit ( const Vector2 p) const

Detect the intersection between a disc and the cluster.

Parameters
pCenter of the disc.

◆ Hit() [2/2]

bool Dla2::Hit ( const Vector2 p,
int &  c 
) const

Detect the intersection between a disc and the cluster.

Parameters
pCenter of the disc.
cReturned index of the first intersected disc.

◆ Step()

void Dla2::Step ( int  n)

Add several particles to the cluster.

Parameters
nNumber of particles.

◆ Walk()

bool Dla2::Walk ( Vector2 p,
int &  c,
int  steps = 2000 
)
protected

Perform a random walk until the particle either collides with the cluster, or until it reaches the maximum number of steps or escapes from the domain.

Parameters
pStarting point.
cReturned index of the particle collided.
stepsMaximum number of steps.