Core 1.0
ParticleSet2 Class Reference

Core particle set in the plane. More...

#include <particle.h>

Inheritance diagram for ParticleSet2:
Dla2 EdenGrowth2 EdenAnisotropicGrowth2

Public Member Functions

 ParticleSet2 ()
 Empty constructor.
 ParticleSet2 (const double &)
 Create an empty set of particles.
 ParticleSet2 (const Vector2 &, const double &)
 Create a set of particles.
 ParticleSet2 (const QVector< Vector2 > &, const double &)
 Create a set of particles.
int Size () const
 Return the number of particles.
Circle2 At (int) const
 Get the k-th particle.
double Radius () const
 Return the radius of the particles.
QVector< Vector2 > GetCenters () const
 Return the centers of the particles.
Circle2 GetCircle () const
 Computes a bounding circle of the particles.
Box2 GetBox () const
 Computes the bounding box of the particles.
void Append (const Vector2 &)
 Add a new particle to the set.
bool Intersect (const Circle2 &) const
 Check the intersection between the cluster and a circle.
bool Intersect (const Box2 &) const
 Check the intersection between the cluster and a box.
void Draw (QGraphicsScene &, const QPen &=QPen(QColor(150, 150, 200), 0.025), const QBrush &=QBrush(QColor(200, 200, 250))) const
 Draw the set of particles.

Protected Attributes

QVector< Vector2 > points
 Set of particles.
double r = 0.0
 Radius of particles.

Detailed Description

Core particle set in the plane.

The particles have the same radius.

Constructor & Destructor Documentation

◆ ParticleSet2() [1/3]

ParticleSet2::ParticleSet2 ( const double & r)
explicit

Create an empty set of particles.

Parameters
rRadius.

◆ ParticleSet2() [2/3]

ParticleSet2::ParticleSet2 ( const Vector2 & p,
const double & r )
explicit

Create a set of particles.

Parameters
rRadius.
pFirst particle.

◆ ParticleSet2() [3/3]

ParticleSet2::ParticleSet2 ( const QVector< Vector2 > & s,
const double & r )
explicit

Create a set of particles.

Parameters
rRadius.
sSet of particles.

Member Function Documentation

◆ Append()

void ParticleSet2::Append ( const Vector2 & p)

Add a new particle to the set.

Parameters
pPoint.

◆ At()

Circle2 ParticleSet2::At ( int k) const

Get the k-th particle.

Parameters
kIndex.

◆ Draw()

void ParticleSet2::Draw ( QGraphicsScene & scene,
const QPen & pen = QPen(QColor(150, 150, 200), 0.025),
const QBrush & brush = QBrush(QColor(200, 200, 250)) ) const

Draw the set of particles.

Parameters
sceneGraphics scene.
penThe pen.
brushThe brush.

◆ GetBox()

Box2 ParticleSet2::GetBox ( ) const

Computes the bounding box of the particles.

The box embeds the centers of the particles, and is extended by the radius of the particles, so that it contains all the discs. The radius is already included in the result.

See also
ParticleSet2::GetCircle

◆ GetCircle()

Circle2 ParticleSet2::GetCircle ( ) const

Computes a bounding circle of the particles.

The circle embeds the centers of the particles, and is extended by the radius of the particles, so that it contains all the discs. The radius is already included in the result.

See also
ParticleSet2::GetBox

◆ Intersect() [1/2]

bool ParticleSet2::Intersect ( const Box2 & box) const

Check the intersection between the cluster and a box.

Parameters
boxThe box.

◆ Intersect() [2/2]

bool ParticleSet2::Intersect ( const Circle2 & circle) const

Check the intersection between the cluster and a circle.

Parameters
circleThe circle.