aimsalgo  5.0.5
Neuroimaging image processing
aims::PointsDistribution Class Reference

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< Point3dfPointSet
 
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...
 
PointSetget_forces (const PointSet &pts)
 
double get_coulomb_energy (const PointSet &pts)
 
PointSetdistribute (const PointSet &pts, unsigned nsteps=100, double step=0.01)
 get a points distribution on a sphere. More...
 
PointSetdistribute (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...
 

Detailed Description

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.

Member Typedef Documentation

◆ LinkSet

typedef std::map<unsigned, std::set<unsigned> > aims::PointsDistribution::LinkSet

Definition at line 100 of file points_distribution.h.

◆ PointSet

Definition at line 99 of file points_distribution.h.

Constructor & Destructor Documentation

◆ PointsDistribution()

aims::PointsDistribution::PointsDistribution ( ForceFunction force = new CoulombForce,
MoveConstraints move_constraint = new SphereMove 
)

Constructor.

parameters

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().

◆ ~PointsDistribution()

aims::PointsDistribution::~PointsDistribution ( )

Member Function Documentation

◆ distribute() [1/2]

PointSet* aims::PointsDistribution::distribute ( const PointSet pts,
unsigned  nsteps = 100,
double  step = 0.01 
)

get a points distribution on a sphere.

parameters

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().

◆ distribute() [2/2]

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.

◆ get_coulomb_energy()

double aims::PointsDistribution::get_coulomb_energy ( const PointSet pts)

◆ get_forces()

PointSet* aims::PointsDistribution::get_forces ( const PointSet pts)

◆ init_points()

static PointSet aims::PointsDistribution::init_points ( unsigned  npoints)
static

Randomly initialize npoints points on a unit sphere.

Referenced by aims::PointsDistribution::SphereMove::~SphereMove().

◆ set_links()

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().

◆ setForceFunction()

void aims::PointsDistribution::setForceFunction ( ForceFunction force)

Set the individual force function.

Referenced by aims::PointsDistribution::SphereMove::~SphereMove().

◆ setMoveConstraints()

void aims::PointsDistribution::setMoveConstraints ( MoveConstraints move_constaint)

Set the individual move constraints function.

Referenced by aims::PointsDistribution::SphereMove::~SphereMove().


The documentation for this class was generated from the following file: