DGtal
1.4.2
|
Aim: This class is a data structure that subdivides a rectangular domains into cubical domains of size \( r^n \) in order to store points into different bins (each cubical domain is a bin, characterized by one coordinate). This data structure may be used for proximity queries, generally to get the points at distance r from a given point. More...
#include <DGtal/geometry/tools/SpatialCubicalSubdivision.h>
Public Types | |
typedef TSpace | Space |
typedef Space::Point | Point |
typedef Space::Vector | Vector |
typedef Point::Coordinate | Coordinate |
typedef HyperRectDomain< Space > | Domain |
typedef std::vector< Point > | Storage |
typedef ImageContainerBySTLVector< Domain, Storage * > | StorageArray |
typedef StorageArray::ConstRange | BinConstRange |
Public Member Functions | |
~SpatialCubicalSubdivision () | |
SpatialCubicalSubdivision (const SpatialCubicalSubdivision &other) | |
SpatialCubicalSubdivision (Point lo, Point up, Coordinate size) | |
const Domain & | domain () const |
const Domain & | binDomain () const |
Point | bin (Point p) const |
Point | lowest (Point b) const |
Point | uppermost (Point b) const |
void | push (const Point &p) |
template<typename PointConstIterator > | |
void | push (PointConstIterator it, PointConstIterator itE) |
template<typename PointPredicate > | |
void | getPoints (std::vector< Point > &pts, Point bin_lo, Point bin_up, const PointPredicate &pred) const |
void | getPoints (std::vector< Point > &pts, Point bin_lo, Point bin_up) const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Protected Attributes | |
Domain | myDomain |
the rectangular domain representing the useful points of the space. More... | |
Coordinate | mySize |
the edge size of each bin. More... | |
StorageArray | myArray |
Private Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >)) | |
SpatialCubicalSubdivision & | operator= (const SpatialCubicalSubdivision &other) |
Private Attributes | |
Point | myDiag |
a precomputed point to improve performance of uppermost() method. More... | |
Aim: This class is a data structure that subdivides a rectangular domains into cubical domains of size \( r^n \) in order to store points into different bins (each cubical domain is a bin, characterized by one coordinate). This data structure may be used for proximity queries, generally to get the points at distance r from a given point.
Description of template class 'SpatialCubicalSubdivision'
Bins are characterized by one Point and are organized as a rectangular domain with lowest bin at coordinates (0,...,0).
TSpace | the digital space, a model of CSpace. |
Model of CopyConstructible
Definition at line 72 of file SpatialCubicalSubdivision.h.
typedef StorageArray::ConstRange DGtal::SpatialCubicalSubdivision< TSpace >::BinConstRange |
Definition at line 83 of file SpatialCubicalSubdivision.h.
typedef Point::Coordinate DGtal::SpatialCubicalSubdivision< TSpace >::Coordinate |
Definition at line 79 of file SpatialCubicalSubdivision.h.
typedef HyperRectDomain<Space> DGtal::SpatialCubicalSubdivision< TSpace >::Domain |
Definition at line 80 of file SpatialCubicalSubdivision.h.
typedef Space::Point DGtal::SpatialCubicalSubdivision< TSpace >::Point |
Definition at line 77 of file SpatialCubicalSubdivision.h.
typedef TSpace DGtal::SpatialCubicalSubdivision< TSpace >::Space |
Definition at line 76 of file SpatialCubicalSubdivision.h.
typedef std::vector<Point> DGtal::SpatialCubicalSubdivision< TSpace >::Storage |
Definition at line 81 of file SpatialCubicalSubdivision.h.
typedef ImageContainerBySTLVector<Domain,Storage*> DGtal::SpatialCubicalSubdivision< TSpace >::StorageArray |
Definition at line 82 of file SpatialCubicalSubdivision.h.
typedef Space::Vector DGtal::SpatialCubicalSubdivision< TSpace >::Vector |
Definition at line 78 of file SpatialCubicalSubdivision.h.
DGtal::SpatialCubicalSubdivision< TSpace >::~SpatialCubicalSubdivision | ( | ) |
Destructor.
DGtal::SpatialCubicalSubdivision< TSpace >::SpatialCubicalSubdivision | ( | const SpatialCubicalSubdivision< TSpace > & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::SpatialCubicalSubdivision< TSpace >::SpatialCubicalSubdivision | ( | Point | lo, |
Point | up, | ||
Coordinate | size | ||
) |
Constructor from rectangular domain given by lowest and uppermost point.
lo | the lowest point of the domain of interest. |
up | the uppermost point of the domain of interest. |
size | the edge size of each cubical bin (an integer >= 2 ). |
Point DGtal::SpatialCubicalSubdivision< TSpace >::bin | ( | Point | p | ) | const |
p | any point within domain(). |
const Domain& DGtal::SpatialCubicalSubdivision< TSpace >::binDomain | ( | ) | const |
|
private |
const Domain& DGtal::SpatialCubicalSubdivision< TSpace >::domain | ( | ) | const |
void DGtal::SpatialCubicalSubdivision< TSpace >::getPoints | ( | std::vector< Point > & | pts, |
Point | bin_lo, | ||
Point | bin_up | ||
) | const |
Pushs back in pts all the points in the bin domain [bin_lo, bin_up].
[out] | pts | the vector where points are pushed back for output. |
bin_lo | the lowest bin of the bin domain. | |
bin_up | the uppermost bin of the bin domain. |
void DGtal::SpatialCubicalSubdivision< TSpace >::getPoints | ( | std::vector< Point > & | pts, |
Point | bin_lo, | ||
Point | bin_up, | ||
const PointPredicate & | pred | ||
) | const |
Pushes back in pts all the points in the bin domain [bin_lo, bin_up] which satisfy the predicate pred.
PointPredicate | the type of a point predicate. |
[out] | pts | the vector where points are pushed back for output. |
bin_lo | the lowest bin of the bin domain. | |
bin_up | the uppermost bin of the bin domain. | |
pred | an arbitrary predicate on point. |
bool DGtal::SpatialCubicalSubdivision< TSpace >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Point DGtal::SpatialCubicalSubdivision< TSpace >::lowest | ( | Point | b | ) | const |
b | any valid bin of binDomain(). |
|
private |
Assignment.
other | the object to copy. |
void DGtal::SpatialCubicalSubdivision< TSpace >::push | ( | const Point & | p | ) |
Pushes the point p into its bin (beware, if you push the same point several times, there are as many copies of this point into the bin).
p | any point within domain(). |
void DGtal::SpatialCubicalSubdivision< TSpace >::push | ( | PointConstIterator | it, |
PointConstIterator | itE | ||
) |
Pushes the range of points [it, itE) into the corresponding bins (beware, if you push the same point several times, there are as many copies of this point into its bin).
PointConstIterator | the type of const iterator on point. |
it | an iterator pointing at the beginning of the range. |
itE | an iterator pointing after the end of the range. |
void DGtal::SpatialCubicalSubdivision< TSpace >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Point DGtal::SpatialCubicalSubdivision< TSpace >::uppermost | ( | Point | b | ) | const |
b | any valid bin of binDomain(). |
|
protected |
the image that associates to each bin its dyn. allocated vector of points. If 0, no point is stored in this bin.
Definition at line 202 of file SpatialCubicalSubdivision.h.
|
private |
a precomputed point to improve performance of uppermost() method.
Definition at line 206 of file SpatialCubicalSubdivision.h.
|
protected |
the rectangular domain representing the useful points of the space.
Definition at line 197 of file SpatialCubicalSubdivision.h.
|
protected |
the edge size of each bin.
Definition at line 199 of file SpatialCubicalSubdivision.h.