24 #include <boost/shared_ptr.hpp>
62 Voronoi_Rn(
const boost::shared_ptr<Polytope_Rn>& inputSpace,
const std::vector<Point_Rn>& listOfPoints);
68 virtual bool compute() throw (std::length_error)=0;
87 void dump(std::ostream& out) const;
89 void gnuplot(std::ostream& out) const throw (std::domain_error);
111 IncrementalVoronoi(
const boost::shared_ptr<Polytope_Rn>& is,
const std::vector<Point_Rn>& lop):Voronoi_Rn(is,lop) {}
117 virtual bool compute() throw (std::length_error);
136 CellByCellVoronoi(
const boost::shared_ptr<Polytope_Rn>& is,
const std::vector<Point_Rn>& lop):Voronoi_Rn(is,lop) {}
142 virtual bool compute() throw (std::length_error);
194 CellByCellVoronoiDist(
const boost::shared_ptr<Polytope_Rn>& is,
const std::vector<Point_Rn>& lop):CellByCellVoronoi(is,lop) {
195 _percentageOfSortedHalfSpaces = 100.;
202 CellByCellVoronoiDist(
const boost::shared_ptr<Polytope_Rn>& is,
const std::vector<Point_Rn>& lop,
double percent):CellByCellVoronoi(is,lop) {
203 _percentageOfSortedHalfSpaces = percent;
210 virtual bool compute() throw (std::length_error);
213 void processDistances(
214 std::vector< std::pair<
double,
unsigned int > >& allDistances,
215 std::vector<
Point_Rn>::const_iterator newVoronoiSeed,
219 void setAverageNumberOfNeighbours(
double pc) { _percentageOfSortedHalfSpaces = pc; }
245 virtual bool compute() throw (std::length_error);
249 std::vector<
Point_Rn >::const_iterator iteBeg,
250 std::vector<
Point_Rn >::const_iterator iteEnd) throw (std::length_error);
252 const std::vector< std::vector< std::pair<boost::shared_ptr<
HalfSpace_Rn>,
unsigned int> > >&
253 getFacetNeighbours()
const {
return _facetNeighbours;}
256 void dumpFacetNeighbours(std::ostream &this_ostream)
const;
258 virtual void updateFacetNeighbours(
259 const std::vector< std::pair< double, unsigned int > >& allDistances,
260 boost::shared_ptr<Polytope_Rn> newVoronoiCell,
261 unsigned int counter,
unsigned int newTruncationStep);
265 std::vector< std::vector< std::pair<boost::shared_ptr<HalfSpace_Rn>,
unsigned int> > >
_facetNeighbours;
281 const std::vector< Point_Rn >& listOfSeeds,
282 const std::vector< boost::shared_ptr<Polytope_Rn> >& listOfCells,
283 const std::vector<int>& listOfProp) {
284 _listOfSeeds = listOfSeeds;
285 _listOfVoronoiCells = listOfCells;
286 _listOfSeedProperties = listOfProp;
287 allocateFacetNeighbours();
297 _listOfSeedProperties = listOfProp;
306 static void loadProp(
const std::string& filename, std::vector<int>& propList)
throw (std::ios_base::failure);
308 void loadCell(
const std::string& filename)
throw (std::ios_base::failure);
310 void loadSeeds(
const std::string& filename)
throw (std::ios_base::failure);
312 void loadSeeds(
const std::vector<Point_Rn>& listOfPoints3D) {_listOfSeeds = listOfPoints3D;}
314 void loadProperties(
const std::string& filename)
throw (std::ios_base::failure);
316 void loadFacetNeighbours(
const std::string& filename)
throw (std::length_error,std::ios_base::failure);
322 void dumpNeighbours(std::ostream &this_ostream)
const;
323 void dumpFacetNeighbours(std::ostream &this_ostream)
const;
326 std::pair< boost::shared_ptr<HalfSpace_Rn>,
unsigned int > curHalfspace_ngbPolytope(hs, ngbCell);
327 _facetNeighbours[cellCounter].push_back(curHalfspace_ngbPolytope);
335 bool fuseCellsWithSameProperty(std::vector< std::vector< unsigned int > >& newListOfNonConvexPolytopes) throw (std::length_error);
338 bool fuseCellsWithSameProperty(std::vector< std::vector< boost::shared_ptr<
Polytope_Rn> > >& newListOfNonConvexPolytopes) throw (std::length_error);
344 std::vector< boost::shared_ptr<
Polytope_Rn> > _listOfVoronoiCells;
346 std::vector< std::vector< std::pair<boost::shared_ptr<
HalfSpace_Rn>,
unsigned int> > > _facetNeighbours;
348 std::vector<
int> _listOfSeedProperties;
CellByCellVoronoiDistNgb(const boost::shared_ptr< Polytope_Rn > &is, const std::vector< Point_Rn > &lop)
Constructor.
IncrementalVoronoi(const boost::shared_ptr< Polytope_Rn > &is, const std::vector< Point_Rn > &lop)
Constructor.
virtual ~CellByCellVoronoi()
Destructor.
Creation of a n-coordinate geometric point designed to be shared by its neighbour faces...
virtual ~Voronoi_Rn()
Destructor.
Computes the Voronoi diagram cell by cell.
const std::vector< boost::shared_ptr< Polytope_Rn > > & getVoronoiCells() const
double _percentageOfSortedHalfSpaces
The amount of half-spaces we want to sort.
void dump(std::ostream &out) const
Dump the cell structure on the given output.
Model a polytope using its two equivalent definitions : the convex hull and the half-space intersecti...
boost::shared_ptr< HalfSpace_Rn > computeMidPlane(std::vector< Point_Rn >::const_iterator seed1, std::vector< Point_Rn >::const_iterator seed2)
Compute the half-space containing seed1, in between seed1 and seed2, according to the growing seed pr...
virtual ~CellByCellVoronoiDistNgb()
Destructor.
VoronoiWithProperties(const std::vector< Point_Rn > &listOfSeeds, const std::vector< boost::shared_ptr< Polytope_Rn > > &listOfCells, const std::vector< int > &listOfProp)
A half-space whose frontier is a linear (n-1) dimension space. _constant + _coefficients[0].x1 + ... + _coefficients[n-1].xn >= 0.
Refers to the class CellByCellDistNgb (100% of the distances between seeds to be sorted) ...
const std::vector< Point_Rn > & _listOfSeeds
The list of input points.
Do the same as CellByCellVoronoiDist with the neighbourhood computation.
const std::vector< Point_Rn > & getListOfSeeds() const
void gnuplot(std::ostream &out) const
CellByCellVoronoiDist(const boost::shared_ptr< Polytope_Rn > &is, const std::vector< Point_Rn > &lop)
Constructor.
Fuse Voronoi cells when they share the same property and then get non convex polytopes.
VoronoiWithProperties(const CellByCellVoronoiDistNgb &CBCVDN, const std::vector< int > &listOfProp)
CellByCellVoronoiDist(const boost::shared_ptr< Polytope_Rn > &is, const std::vector< Point_Rn > &lop, double percent)
Refers to the class CellByCellVoronoi.
std::vector< boost::shared_ptr< Polytope_Rn > > _listOfVoronoiCells
The list of polytopes partitioning the whole space.
Refers to the class CellByCellDistNgb ( 1% of the distances between seeds to be sorted) ...
void loadSeeds(const std::vector< Point_Rn > &listOfPoints3D)
Voronoi_Rn(const boost::shared_ptr< Polytope_Rn > &inputSpace, const std::vector< Point_Rn > &listOfPoints)
Refers to the class WithProperties.
void allocateFacetNeighbours()
bool checkTopologyAndGeometry() const
const boost::shared_ptr< Polytope_Rn > & _inputSpace
The original space to be divided.
Refers to the class CellByCellDistNgb ( 30% of the distances between seeds to be sorted) ...
virtual ~VoronoiWithProperties()
Destructor.
Refers to the class CellByCellVoronoiDist.
Refers to the class IncrementalVoronoi.
virtual bool compute()=0
Run the whole algorithm.
Compute a n-dimensional Voronoi diagram. It is a partitioning of a space into regions based on distan...
Refers to the class CellByCellDistNgb ( 40% of the distances between seeds to be sorted) ...
TypeOfAlgorithm
Choose the kind of algorithm to be run.
At the end of the ith iteration, the Voronoi diagram of i seeds is computed.
Refers to the class CellByCellDistNgb ( 10% of the distances between seeds to be sorted) ...
std::vector< boost::shared_ptr< Polytope_Rn > > getVoronoiCells()
std::vector< std::vector< std::pair< boost::shared_ptr< HalfSpace_Rn >, unsigned int > > > _facetNeighbours
For the current cell, store its neighbour numbers. _facetNeighbours[i] = { (H0, i0), (H1, i1), ... }.
const std::vector< std::vector< std::pair< boost::shared_ptr< HalfSpace_Rn >, unsigned int > > > & getFacetNeighbours() const
std::vector< boost::shared_ptr< HalfSpace_Rn > > _allHalfSpaces
For each seed, the list of the half-spaces used to build its cell.
CellByCellVoronoi(const boost::shared_ptr< Polytope_Rn > &is, const std::vector< Point_Rn > &lop)
Constructor.
Refers to the class CellByCellDistNgb ( 20% of the distances between seeds to be sorted) ...
virtual ~CellByCellVoronoiDist()
Destructor.
virtual void allocateFacetNeighbours()
void addHalfSpaceAndNeighbour(unsigned int cellCounter, boost::shared_ptr< HalfSpace_Rn > hs, unsigned int ngbCell)
virtual ~IncrementalVoronoi()
Destructor.