Core 1.0
|
A particle system constrained to an implicit surface. More...
#include <discsystem.h>
Public Member Functions | |
DiscSystem (const AnalyticScalarField *, const double &, int) | |
Creates a particle system constrained to an implicit surface. | |
~DiscSystem () | |
Destroy a particle system. | |
void | Steps (int=1) |
Update the particle system. | |
void | Cast () |
Cast all the particles on the implicit surface. | |
Circle | operator() (int) const |
Get the i-th particle. | |
Circle & | operator() (int) |
Get the i-th particle. | |
void | AddParticle (const Vector &, const double &) |
Insert a new particle in the list. | |
int | Size () const |
Get the number of particles. | |
Protected Member Functions | |
void | Cast (int) |
Cast a particle on the implicit surface. | |
void | Step (int) |
Particle update. | |
int | Closest (int, int *, double *) const |
Find the neighbors closest to a particle. | |
void | Compute (int, Vector &, double &, bool &, bool &, int, int *) |
Computes the position and radius derivatives with respect to time. | |
void | SplitParticle (int) |
Split a particle into two slighly perturbed ones. | |
void | DeleteParticle (int) |
Delete a particle. | |
Protected Attributes | |
DynamicArrayIndex | subd |
Voxel subdivision of space required for an efficient determination of neighbor relations between particles. | |
QVector< Circle > | particles |
Array of particles. | |
double | time_step = 1.0 |
Step size for numerical integration. | |
const AnalyticScalarField * | function = nullptr |
Reference to function. | |
double | ir = 1.0 |
Initial radius. | |
A particle system constrained to an implicit surface.
This class implements Witkin-Heckbert particle system over an implicit surface. It may be used to generate a cloud of vertices located almost uniformly over the implicit surface.
DiscSystem::DiscSystem | ( | const AnalyticScalarField * | f, |
const double & | r, | ||
int | n ) |
Creates a particle system constrained to an implicit surface.
f | Implicit surface class. |
r | Radius of the particles. |
n | Spatial subdivision used to speed up particle update. |
DiscSystem::~DiscSystem | ( | ) |
Destroy a particle system.
This function destroys the internal acceleration data-structures but does not destroy the implicit function.
void DiscSystem::AddParticle | ( | const Vector & | p, |
const double & | r ) |
Insert a new particle in the list.
This function hides the particles-poll mechanism that keeps track of indices of previously deleted indices to be reused. The gradient of the field function at the location of the particle is computed internally.
p | Center of new particle. |
r | Radius of particle. |
|
protected |
Cast a particle on the implicit surface.
The particle is destroyed if gradient vanishes to null.
i | Particle identifier. |
|
protected |
Find the neighbors closest to a particle.
These are saved in a cache to improve speed in calculations of repulsion forces.
|
protected |
Computes the position and radius derivatives with respect to time.
id | Index of particle (should be called with ci[k] as argument). |
delta_P | Variation of the position of the particle (projected to tangent plane). |
delta_rad | Variation of the radius of the particle. |
split_flag | Splitting flag. |
death_flag | Death flag. |
ncl | Number of closest particles. |
close | Id of closest particles. |
|
protected |
Delete a particle.
id | Index. |
|
protected |
Split a particle into two slighly perturbed ones.
i | Index of particle. |
|
protected |
Particle update.
Find the closest neighbors, and then computes Witkin and Hekbert parameters. Particle's behavior is modified according to those parameters.
i | Index of particle. |
void DiscSystem::Steps | ( | int | n = 1 | ) |
Update the particle system.
Iteratively update all particles.
n | Number of iterations. |