|
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 | |
| bool | Cast (int) |
| Cast a particle on the implicit surface. | |
| bool | 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. |
| void DiscSystem::Cast | ( | ) |
Cast all the particles on the implicit surface.
The particles whose gradient vanishes are deleted, the number of particles may therefore decrease.
|
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.
Only the particles of the neighboring cells of the spatial subdivision, whose normal is roughly in the same direction as the one of the particle, are considered. At most DiscSystem::CLOSEST_CACHE_SIZE neighbors are kept, the closest ones.
| id | Index of the particle. |
| cc | Returned indexes of the closest particles, which should have room for DiscSystem::CLOSEST_CACHE_SIZE entries. |
| ll | Returned squared distances to the closest particles, normalized by the square of the sum of the largest radius and of twice the smallest radius of the pair, with the same size as cc. |
|
protected |
Computes the position and radius derivatives with respect to time.
| id | Index of particle (should be called with \( c_i[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.
During an iteration particles may be deleted, if they are too small or if the gradient vanishes, or may be split into two particles: the number of particles, DiscSystem::Size(), is therefore not constant. A particle which takes the place of a deleted one, and a particle which has just been created, are updated in the same iteration.
| n | Number of iterations. |