![]() |
aimsalgo
5.0.5
Neuroimaging image processing
|
Points repartition using forces in a given geometry (on a sphere for instance). More...
#include <aims/points_distribution/points_distribution.h>
Classes | |
class | CoulombAndRestoringForce |
Utility function for sphere_distribution. More... | |
class | CoulombForce |
Utility function for sphere_distribution. More... | |
class | ForceFunction |
Utility force class for sphere_distribution. More... | |
class | MoveConstraints |
Utility function for sphere_distribution. More... | |
class | SphereMove |
Move point constrained to a uinit sphere: project the force to be tangent to the sphere, move the point, then stick it onto the sphere. More... | |
Public Types | |
typedef std::vector< Point3df > | PointSet |
typedef std::map< unsigned, std::set< unsigned > > | LinkSet |
Public Member Functions | |
PointsDistribution (ForceFunction *force=new CoulombForce, MoveConstraints *move_constraint=new SphereMove) | |
Constructor. More... | |
~PointsDistribution () | |
void | set_links (const LinkSet &links) |
Set linked points set. More... | |
void | setForceFunction (ForceFunction *force) |
Set the individual force function. More... | |
void | setMoveConstraints (MoveConstraints *move_constaint) |
Set the individual move constraints function. More... | |
PointSet * | get_forces (const PointSet &pts) |
double | get_coulomb_energy (const PointSet &pts) |
PointSet * | distribute (const PointSet &pts, unsigned nsteps=100, double step=0.01) |
get a points distribution on a sphere. More... | |
PointSet * | distribute (unsigned npoints, unsigned nsteps=100, double step=0.01) |
Same as above but point are randomly initialized on a sphere, using the init_points() function. More... | |
Static Public Member Functions | |
static PointSet | init_points (unsigned npoints) |
Randomly initialize npoints points on a unit sphere. More... | |
Points repartition using forces in a given geometry (on a sphere for instance).
adapted from: http://www.nicoptere.net/blog/index.php/2008/09/20/50-distribution-points-sphere-actionscript http://www.nicoptere.net/AS3/distribution/Distribute.as
Points are moved according to forces, using an energy minimization method.
A few parameters have been added, to allow fitting spheres, or "free" geometries and forces.
Linked points can be defined, with different force behaviours.
Definition at line 57 of file points_distribution.h.
typedef std::map<unsigned, std::set<unsigned> > aims::PointsDistribution::LinkSet |
Definition at line 100 of file points_distribution.h.
typedef std::vector<Point3df> aims::PointsDistribution::PointSet |
Definition at line 99 of file points_distribution.h.
aims::PointsDistribution::PointsDistribution | ( | ForceFunction * | force = new CoulombForce , |
MoveConstraints * | move_constraint = new SphereMove |
||
) |
Constructor.
force: force / energy function between 2 points. Takes 2 points and a bool (has_link), and returns the force vector applied to the 1st point. Defaults to a Coulomb force (r_vec/r^3) move_constraints: applies force to a point, and add additional constraints. Takes a point, a force vector, and a step (factor to the force), returns the new point position. Default: projects the force to be tangent to a unit sphere, and renormalizes the resulting point position to stock on the sphere.
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
aims::PointsDistribution::~PointsDistribution | ( | ) |
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
PointSet* aims::PointsDistribution::distribute | ( | const PointSet & | pts, |
unsigned | nsteps = 100 , |
||
double | step = 0.01 |
||
) |
get a points distribution on a sphere.
points: list of 3D points (Point3df), or number If points is a number, this number of points in initialized randomly on a sphere.
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
PointSet* aims::PointsDistribution::distribute | ( | unsigned | npoints, |
unsigned | nsteps = 100 , |
||
double | step = 0.01 |
||
) |
Same as above but point are randomly initialized on a sphere, using the init_points() function.
double aims::PointsDistribution::get_coulomb_energy | ( | const PointSet & | pts | ) |
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
|
static |
Randomly initialize npoints points on a unit sphere.
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
void aims::PointsDistribution::set_links | ( | const LinkSet & | links | ) |
Set linked points set.
Optional links. Linked points have different forces to make them closer. The links dict maps a point num to a set of linked points: {0: [1, 3], 1: [0, 5], 2: [4], 3: [0]} The map should be symmetrical.
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
void aims::PointsDistribution::setForceFunction | ( | ForceFunction * | force | ) |
Set the individual force function.
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().
void aims::PointsDistribution::setMoveConstraints | ( | MoveConstraints * | move_constaint | ) |
Set the individual move constraints function.
Referenced by aims::PointsDistribution::SphereMove::~SphereMove().