DGtal  0.9.2
SurfelNeighborhood.h
1 
17 #pragma once
18 
31 #if defined(SurfelNeighborhood_RECURSES)
32 #error Recursive header files inclusion detected in SurfelNeighborhood.h
33 #else // defined(SurfelNeighborhood_RECURSES)
34 
35 #define SurfelNeighborhood_RECURSES
36 
37 #if !defined SurfelNeighborhood_h
38 
39 #define SurfelNeighborhood_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/topology/SurfelAdjacency.h"
47 
48 namespace DGtal
49 {
50 
52  // template class SurfelNeighborhood
67  template <typename TKSpace>
69  {
70  // ----------------------- Types ------------------------------
71  public:
72 
73  typedef TKSpace KSpace;
74  typedef typename KSpace::Point Point;
75  typedef typename KSpace::Cell Cell;
76  typedef typename KSpace::SCell SCell;
77 
78  // ----------------------- Standard services ------------------------------
79  public:
80 
85 
90 
95  SurfelNeighborhood ( const SurfelNeighborhood & other );
96 
103 
111  void init( const KSpace* space,
113  const SCell & aSurfel );
114 
119  void setSurfel( const SCell & aSurfel );
120 
122  const SCell & surfel() const;
123 
125  Dimension orthDir() const;
126 
127  //----------------------- spel services -------------------------
128  public:
130  SCell innerSpel() const;
131 
133  SCell outerSpel() const;
134 
145  SCell innerAdjacentSpel( Dimension track_dir, bool pos ) const;
146 
157  SCell outerAdjacentSpel( Dimension track_dir, bool pos ) const;
158 
159  //----------------------- follower services -------------------------
160  public:
169  SCell follower1( Dimension track_dir, bool pos ) const;
170 
179  SCell follower2( Dimension track_dir, bool pos ) const;
180 
189  SCell follower3( Dimension track_dir, bool pos ) const;
190 
191 
192  // ----------------------- Surfel adjacency services --------------------
193  public:
194 
214  template <typename SpelSet>
215  unsigned int getAdjacentOnSpelSet( SCell & adj_surfel,
216  const SpelSet & obj,
217  Dimension track_dir,
218  bool pos ) const;
219 
239  template <typename DigitalSet>
240  unsigned int getAdjacentOnDigitalSet( SCell & adj_surfel,
241  const DigitalSet & obj,
242  Dimension track_dir,
243  bool pos ) const;
244 
270  template <typename PointPredicate>
271  unsigned int getAdjacentOnPointPredicate( SCell & adj_surfel,
272  const PointPredicate & pp,
273  Dimension track_dir,
274  bool pos ) const;
275 
299  template <typename SurfelPredicate>
300  unsigned int getAdjacentOnSurfelPredicate( SCell & adj_surfel,
301  const SurfelPredicate & sp,
302  Dimension track_dir,
303  bool pos ) const;
304 
305  // ----------------------- Interface --------------------------------------
306  public:
307 
312  void selfDisplay ( std::ostream & out ) const;
313 
318  bool isValid() const;
319 
320  // ------------------------- Protected Datas ------------------------------
321  private:
322  // ------------------------- Private Datas --------------------------------
323  private:
324 
326  const KSpace* mySpace;
330  SCell mySurfel;
336 
337  // ------------------------- Hidden services ------------------------------
338  protected:
339 
340 
341  // ------------------------- Internals ------------------------------------
342  private:
343 
344  }; // end of class SurfelNeighborhood
345 
346 
353  template <typename T>
354  std::ostream&
355  operator<< ( std::ostream & out, const SurfelNeighborhood<T> & object );
356 
357 } // namespace DGtal
358 
359 
361 // Includes inline functions.
362 #include "DGtal/topology/SurfelNeighborhood.ih"
363 
364 // //
366 
367 #endif // !defined SurfelNeighborhood_h
368 
369 #undef SurfelNeighborhood_RECURSES
370 #endif // else defined(SurfelNeighborhood_RECURSES)
unsigned int getAdjacentOnSurfelPredicate(SCell &adj_surfel, const SurfelPredicate &sp, Dimension track_dir, bool pos) const
unsigned int getAdjacentOnDigitalSet(SCell &adj_surfel, const DigitalSet &obj, Dimension track_dir, bool pos) const
unsigned int getAdjacentOnPointPredicate(SCell &adj_surfel, const PointPredicate &pp, Dimension track_dir, bool pos) const
void selfDisplay(std::ostream &out) const
DGtal::uint32_t Dimension
Definition: Common.h:113
const SCell & surfel() const
SCell innerAdjacentSpel(Dimension track_dir, bool pos) const
Aim: This helper class is useful to compute the neighboring surfels of a given surfel, especially over a digital surface or over an object boundary. Two signed surfels are incident if they share a common n-2 cell. This class uses a SurfelAdjacency so as to determine adjacent surfels (either looking for them from interior to exterior or inversely).
SCell innerSpel() const
SCell follower3(Dimension track_dir, bool pos) const
Dimension orthDir() const
void init(const KSpace *space, const SurfelAdjacency< KSpace::dimension > *adj, const SCell &aSurfel)
const SurfelAdjacency< KSpace::dimension > * mySurfelAdj
SCell follower1(Dimension track_dir, bool pos) const
DGtal is the top-level namespace which contains all DGtal functions and types.
unsigned int getAdjacentOnSpelSet(SCell &adj_surfel, const SpelSet &obj, Dimension track_dir, bool pos) const
void setSurfel(const SCell &aSurfel)
SCell follower2(Dimension track_dir, bool pos) const
SurfelNeighborhood & operator=(const SurfelNeighborhood &other)
SCell outerAdjacentSpel(Dimension track_dir, bool pos) const
SCell outerSpel() const