DGtal  1.5.beta
DGtal::SpatialCubicalSubdivision< TSpace > Class Template Reference

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< SpaceDomain
 
typedef std::vector< PointStorage
 
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 Domaindomain () const
 
const DomainbinDomain () 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 >))
 
SpatialCubicalSubdivisionoperator= (const SpatialCubicalSubdivision &other)
 

Private Attributes

Point myDiag
 a precomputed point to improve performance of uppermost() method. More...
 

Detailed Description

template<typename TSpace>
class DGtal::SpatialCubicalSubdivision< TSpace >

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

Template Parameters
TSpacethe digital space, a model of CSpace.

Model of CopyConstructible

Definition at line 72 of file SpatialCubicalSubdivision.h.

Member Typedef Documentation

◆ BinConstRange

template<typename TSpace >
typedef StorageArray::ConstRange DGtal::SpatialCubicalSubdivision< TSpace >::BinConstRange

Definition at line 83 of file SpatialCubicalSubdivision.h.

◆ Coordinate

template<typename TSpace >
typedef Point::Coordinate DGtal::SpatialCubicalSubdivision< TSpace >::Coordinate

Definition at line 79 of file SpatialCubicalSubdivision.h.

◆ Domain

template<typename TSpace >
typedef HyperRectDomain<Space> DGtal::SpatialCubicalSubdivision< TSpace >::Domain

Definition at line 80 of file SpatialCubicalSubdivision.h.

◆ Point

template<typename TSpace >
typedef Space::Point DGtal::SpatialCubicalSubdivision< TSpace >::Point

Definition at line 77 of file SpatialCubicalSubdivision.h.

◆ Space

template<typename TSpace >
typedef TSpace DGtal::SpatialCubicalSubdivision< TSpace >::Space

Definition at line 76 of file SpatialCubicalSubdivision.h.

◆ Storage

template<typename TSpace >
typedef std::vector<Point> DGtal::SpatialCubicalSubdivision< TSpace >::Storage

Definition at line 81 of file SpatialCubicalSubdivision.h.

◆ StorageArray

Definition at line 82 of file SpatialCubicalSubdivision.h.

◆ Vector

template<typename TSpace >
typedef Space::Vector DGtal::SpatialCubicalSubdivision< TSpace >::Vector

Definition at line 78 of file SpatialCubicalSubdivision.h.

Constructor & Destructor Documentation

◆ ~SpatialCubicalSubdivision()

template<typename TSpace >
DGtal::SpatialCubicalSubdivision< TSpace >::~SpatialCubicalSubdivision ( )

Destructor.

◆ SpatialCubicalSubdivision() [1/2]

template<typename TSpace >
DGtal::SpatialCubicalSubdivision< TSpace >::SpatialCubicalSubdivision ( const SpatialCubicalSubdivision< TSpace > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ SpatialCubicalSubdivision() [2/2]

template<typename TSpace >
DGtal::SpatialCubicalSubdivision< TSpace >::SpatialCubicalSubdivision ( Point  lo,
Point  up,
Coordinate  size 
)

Constructor from rectangular domain given by lowest and uppermost point.

Parameters
lothe lowest point of the domain of interest.
upthe uppermost point of the domain of interest.
sizethe edge size of each cubical bin (an integer >= 2 ).

Member Function Documentation

◆ bin()

template<typename TSpace >
Point DGtal::SpatialCubicalSubdivision< TSpace >::bin ( Point  p) const
Parameters
pany point within domain().
Returns
the bin in which lies p.

◆ binDomain()

template<typename TSpace >
const Domain& DGtal::SpatialCubicalSubdivision< TSpace >::binDomain ( ) const
Returns
the rectangular domain of bins, which is a coarser grid than domain().

◆ BOOST_CONCEPT_ASSERT()

template<typename TSpace >
DGtal::SpatialCubicalSubdivision< TSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CSpace< TSpace >)  )
private

◆ domain()

template<typename TSpace >
const Domain& DGtal::SpatialCubicalSubdivision< TSpace >::domain ( ) const
Returns
the rectangular domain of interest

◆ getPoints() [1/2]

template<typename TSpace >
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].

Parameters
[out]ptsthe vector where points are pushed back for output.
bin_lothe lowest bin of the bin domain.
bin_upthe uppermost bin of the bin domain.

◆ getPoints() [2/2]

template<typename TSpace >
template<typename PointPredicate >
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.

Template Parameters
PointPredicatethe type of a point predicate.
Parameters
[out]ptsthe vector where points are pushed back for output.
bin_lothe lowest bin of the bin domain.
bin_upthe uppermost bin of the bin domain.
predan arbitrary predicate on point.

◆ isValid()

template<typename TSpace >
bool DGtal::SpatialCubicalSubdivision< TSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ lowest()

template<typename TSpace >
Point DGtal::SpatialCubicalSubdivision< TSpace >::lowest ( Point  b) const
Parameters
bany valid bin of binDomain().
Returns
its lowest possible point.

◆ operator=()

template<typename TSpace >
SpatialCubicalSubdivision& DGtal::SpatialCubicalSubdivision< TSpace >::operator= ( const SpatialCubicalSubdivision< TSpace > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. forbidden.

◆ push() [1/2]

template<typename TSpace >
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).

Parameters
pany point within domain().

◆ push() [2/2]

template<typename TSpace >
template<typename PointConstIterator >
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).

Template Parameters
PointConstIteratorthe type of const iterator on point.
Parameters
itan iterator pointing at the beginning of the range.
itEan iterator pointing after the end of the range.

◆ selfDisplay()

template<typename TSpace >
void DGtal::SpatialCubicalSubdivision< TSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ uppermost()

template<typename TSpace >
Point DGtal::SpatialCubicalSubdivision< TSpace >::uppermost ( Point  b) const
Parameters
bany valid bin of binDomain().
Returns
its uppermost possible point.

Field Documentation

◆ myArray

template<typename TSpace >
StorageArray DGtal::SpatialCubicalSubdivision< TSpace >::myArray
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.

◆ myDiag

template<typename TSpace >
Point DGtal::SpatialCubicalSubdivision< TSpace >::myDiag
private

a precomputed point to improve performance of uppermost() method.

Definition at line 206 of file SpatialCubicalSubdivision.h.

◆ myDomain

template<typename TSpace >
Domain DGtal::SpatialCubicalSubdivision< TSpace >::myDomain
protected

the rectangular domain representing the useful points of the space.

Definition at line 197 of file SpatialCubicalSubdivision.h.

◆ mySize

template<typename TSpace >
Coordinate DGtal::SpatialCubicalSubdivision< TSpace >::mySize
protected

the edge size of each bin.

Definition at line 199 of file SpatialCubicalSubdivision.h.


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