DGtal  1.4.beta
SpatialCubicalSubdivision.h
1 
17 #pragma once
18 
31 #if defined(SpatialCubicalSubdivision_RECURSES)
32 #error Recursive header files inclusion detected in SpatialCubicalSubdivision.h
33 #else // defined(SpatialCubicalSubdivision_RECURSES)
35 #define SpatialCubicalSubdivision_RECURSES
36 
37 #if !defined SpatialCubicalSubdivision_h
39 #define SpatialCubicalSubdivision_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/Clone.h"
47 #include "DGtal/images/ImageContainerBySTLVector.h"
49 
50 namespace DGtal
51 {
52 
54  // template class SpatialCubicalSubdivision
71  template <typename TSpace>
73  {
75  public:
76  typedef TSpace Space;
77  typedef typename Space::Point Point;
78  typedef typename Space::Vector Vector;
79  typedef typename Point::Coordinate Coordinate;
81  typedef std::vector<Point> Storage;
84 
85  // ----------------------- Standard services ------------------------------
86  public:
87 
92 
98 
107 
109  const Domain& domain() const;
110 
112  const Domain& binDomain() const;
113 
118  Point bin( Point p ) const;
119 
124  Point lowest( Point b ) const;
125 
130  Point uppermost( Point b ) const;
131 
139  void push( const Point& p );
140 
150  template <typename PointConstIterator>
151  void push( PointConstIterator it, PointConstIterator itE );
152 
163  template <typename PointPredicate>
164  void getPoints( std::vector<Point> & pts,
165  Point bin_lo, Point bin_up, const PointPredicate & pred ) const;
166 
175  void getPoints( std::vector<Point> & pts,
176  Point bin_lo, Point bin_up ) const;
177 
178  // ----------------------- Interface --------------------------------------
179  public:
180 
185  void selfDisplay ( std::ostream & out ) const;
186 
191  bool isValid() const;
192 
193  // ------------------------- Protected Datas ------------------------------
194  protected:
195 
203  // ------------------------- Private Datas --------------------------------
204  private:
207 
208  // ------------------------- Hidden services ------------------------------
209  protected:
210 
211  // ------------------------- Internals ------------------------------------
212  private:
213 
221 
222  }; // end of class SpatialCubicalSubdivision
223 
224 
231  template <typename TSpace>
232  std::ostream&
233  operator<< ( std::ostream & out, const SpatialCubicalSubdivision<TSpace> & object );
234 
235 } // namespace DGtal
236 
237 
239 // Includes inline functions.
240 #include "DGtal/geometry/tools/SpatialCubicalSubdivision.ih"
241 
242 // //
244 
245 #endif // !defined SpatialCubicalSubdivision_h
246 
247 #undef SpatialCubicalSubdivision_RECURSES
248 #endif // else defined(SpatialCubicalSubdivision_RECURSES)
Component Coordinate
Type for Point elements.
Definition: PointVector.h:617
Aim: model of CConstBidirectionalRangeFromPoint that adapts any range of elements bounded by two iter...
Aim: This class is a data structure that subdivides a rectangular domains into cubical domains of siz...
void selfDisplay(std::ostream &out) const
Point uppermost(Point b) const
void getPoints(std::vector< Point > &pts, Point bin_lo, Point bin_up) const
Point myDiag
a precomputed point to improve performance of uppermost() method.
Coordinate mySize
the edge size of each bin.
SpatialCubicalSubdivision(const SpatialCubicalSubdivision &other)
const Domain & domain() const
void getPoints(std::vector< Point > &pts, Point bin_lo, Point bin_up, const PointPredicate &pred) const
const Domain & binDomain() const
SpatialCubicalSubdivision(Point lo, Point up, Coordinate size)
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
ImageContainerBySTLVector< Domain, Storage * > StorageArray
Point lowest(Point b) const
Domain myDomain
the rectangular domain representing the useful points of the space.
void push(PointConstIterator it, PointConstIterator itE)
SpatialCubicalSubdivision & operator=(const SpatialCubicalSubdivision &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:106