DGtal  1.3.beta
UmbrellaComputer.h
1 
17 #pragma once
18 
31 #if defined(UmbrellaComputer_RECURSES)
32 #error Recursive header files inclusion detected in UmbrellaComputer.h
33 #else // defined(UmbrellaComputer_RECURSES)
34 
35 #define UmbrellaComputer_RECURSES
36 
37 #if !defined UmbrellaComputer_h
38 
39 #define UmbrellaComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/topology/CDigitalSurfaceTracker.h"
47 
48 namespace DGtal
49 {
50 
52  // template class UmbrellaComputer
85  template <typename TDigitalSurfaceTracker>
87  {
88  // Concept checks
90 
91  // ----------------------- public types ------------------------------
92  public:
93  typedef TDigitalSurfaceTracker DigitalSurfaceTracker;
94  typedef typename DigitalSurfaceTracker::DigitalSurfaceContainer DigitalSurfaceContainer;
98  typedef typename KSpace::SCell SCell;
99 
104  struct State
105  {
111  bool epsilon;
114  inline State(){}
115  inline State( const Surfel & _surfel,
116  Dimension _k, bool _epsilon, Dimension _j )
117  : surfel( _surfel ), k( _k ), epsilon( _epsilon ), j( _j )
118  {}
119  inline bool operator==( const State & other ) const
120  {
121  return ( surfel == other.surfel )
122  && ( k == other.k )
123  && ( epsilon == other.epsilon )
124  && ( j == other.j );
125  }
126  inline bool operator<( const State & other ) const
127  {
128  return ( surfel < other.surfel )
129  || ( ( surfel == other.surfel )
130  && ( ( k < other.k )
131  || ( ( k == other.k )
132  && ( ( epsilon < other.epsilon )
133  || ( ( epsilon == other.epsilon)
134  && ( j < other.j ) ) ) ) ) );
135  }
136  };
137 
138  // ----------------------- Standard services ------------------------------
139  public:
140 
143 
146 
151  UmbrellaComputer( const UmbrellaComputer & other );
152 
159  operator=( const UmbrellaComputer & other );
160 
177  void init( const DigitalSurfaceTracker & tracker,
178  Dimension k, bool epsilon, Dimension j );
179 
188  void setState( const State & aState );
189 
196  void getState( State & aState ) const;
197 
199  const State & state() const;
200 
202  const KSpace & space() const;
203 
204  // ----------------------- Accessor services ------------------------------
205  public:
206 
208  const Surfel & surfel() const;
209 
211  SCell separator() const;
212 
214  SCell pivot() const;
215 
217  Dimension orthDir() const;
218 
220  Dimension trackDir() const;
221 
223  bool trackOrientation() const;
224 
226  Dimension separatorDir() const;
227 
229  bool separatorOrientation() const;
230 
231  // ----------------------- Pivoting services ------------------------------
232  public:
233 
240  unsigned int next();
241 
248  unsigned int previous();
249 
258  bool adjacent();
259 
260 
261 
262  // ----------------------- Interface --------------------------------------
263  public:
264 
269  void selfDisplay ( std::ostream & out ) const;
270 
275  bool isValid() const;
276 
277  // ------------------------- Protected Datas ------------------------------
278  private:
279  // ------------------------- Private Datas --------------------------------
280  private:
281 
285  State myState;
286 
287  // ------------------------- Hidden services ------------------------------
288  protected:
289 
290  // ------------------------- Internals ------------------------------------
291  private:
292 
293  }; // end of class UmbrellaComputer
294 
295 
302  template <typename TDigitalSurfaceTracker>
303  std::ostream&
304  operator<< ( std::ostream & out, const UmbrellaComputer<TDigitalSurfaceTracker> & object );
305 
306 } // namespace DGtal
307 
308 
310 // Includes inline functions.
311 #include "DGtal/topology/UmbrellaComputer.ih"
312 
313 // //
315 
316 #endif // !defined UmbrellaComputer_h
317 
318 #undef UmbrellaComputer_RECURSES
319 #endif // else defined(UmbrellaComputer_RECURSES)
DGtal::UmbrellaComputer::state
const State & state() const
Accessor to current state.
DGtal::UmbrellaComputer::Size
DigitalSurfaceContainer::Size Size
Definition: UmbrellaComputer.h:97
DGtal::UmbrellaComputer::separator
SCell separator() const
DGtal::UmbrellaComputer::SCell
KSpace::SCell SCell
Definition: UmbrellaComputer.h:98
DGtal::UmbrellaComputer::trackDir
Dimension trackDir() const
DGtal::UmbrellaComputer::surfel
const Surfel & surfel() const
DGtal::UmbrellaComputer::State::epsilon
bool epsilon
Orientation to find separator (true = positively along k-axis)
Definition: UmbrellaComputer.h:111
DGtal::concepts::CDigitalSurfaceTracker
Aim:
Definition: CDigitalSurfaceTracker.h:85
DGtal::UmbrellaComputer::separatorOrientation
bool separatorOrientation() const
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::UmbrellaComputer::getState
void getState(State &aState) const
DGtal::UmbrellaComputer::pivot
SCell pivot() const
DGtal::SignedKhalimskyCell
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Definition: KhalimskySpaceND.h:208
DGtal::UmbrellaComputer::operator=
UmbrellaComputer & operator=(const UmbrellaComputer &other)
DGtal::UmbrellaComputer::next
unsigned int next()
DGtal::UmbrellaComputer::setState
void setState(const State &aState)
DGtal::UmbrellaComputer::previous
unsigned int previous()
Size
HalfEdgeDataStructure::Size Size
Definition: testHalfEdgeDataStructure.cpp:50
DGtal::UmbrellaComputer::~UmbrellaComputer
~UmbrellaComputer()
Destructor.
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::UmbrellaComputer::State::State
State(const Surfel &_surfel, Dimension _k, bool _epsilon, Dimension _j)
Definition: UmbrellaComputer.h:115
KSpace
Z3i::KSpace KSpace
Definition: testArithmeticalDSSComputerOnSurfels.cpp:48
DGtal::UmbrellaComputer::orthDir
Dimension orthDir() const
Surfel
KSpace::SCell Surfel
Definition: testArithmeticalDSSComputerOnSurfels.cpp:50
DGtal::UmbrellaComputer::DigitalSurfaceContainer
DigitalSurfaceTracker::DigitalSurfaceContainer DigitalSurfaceContainer
Definition: UmbrellaComputer.h:94
DGtal::UmbrellaComputer::Surfel
DigitalSurfaceContainer::Surfel Surfel
Definition: UmbrellaComputer.h:96
DGtal::UmbrellaComputer::init
void init(const DigitalSurfaceTracker &tracker, Dimension k, bool epsilon, Dimension j)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::UmbrellaComputer::separatorDir
Dimension separatorDir() const
DGtal::UmbrellaComputer::State::operator==
bool operator==(const State &other) const
Definition: UmbrellaComputer.h:119
DGtal::UmbrellaComputer::State::k
Dimension k
Direction to find separator, k in sDirs(surfel).
Definition: UmbrellaComputer.h:109
DGtal::UmbrellaComputer::space
const KSpace & space() const
Accessor to the digital space.
DGtal::UmbrellaComputer::KSpace
DigitalSurfaceContainer::KSpace KSpace
Definition: UmbrellaComputer.h:95
DGtal::UmbrellaComputer::trackOrientation
bool trackOrientation() const
DGtal::UmbrellaComputer::State
Definition: UmbrellaComputer.h:104
DGtal::UmbrellaComputer::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDigitalSurfaceTracker< TDigitalSurfaceTracker >))
DGtal::UmbrellaComputer::adjacent
bool adjacent()
DGtal::UmbrellaComputer::isValid
bool isValid() const
DGtal::UmbrellaComputer::UmbrellaComputer
UmbrellaComputer()
Constructor. The object is not valid.
DGtal::UmbrellaComputer::State::j
Dimension j
Track direction (j != k), j in sDirs(surfel).
Definition: UmbrellaComputer.h:113
DGtal::UmbrellaComputer::DigitalSurfaceTracker
TDigitalSurfaceTracker DigitalSurfaceTracker
Definition: UmbrellaComputer.h:93
DGtal::UmbrellaComputer::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::UmbrellaComputer::State::surfel
Surfel surfel
Current surfel.
Definition: UmbrellaComputer.h:107
DGtal::UmbrellaComputer::State::State
State()
Definition: UmbrellaComputer.h:114
DGtal::UmbrellaComputer::myTracker
DigitalSurfaceTracker * myTracker
Tracker used to move on the digital surface.
Definition: UmbrellaComputer.h:283
DGtal::UmbrellaComputer
Aim: Useful for computing umbrellas on 'DigitalSurface's, ie set of n-1 cells around a n-3 cell.
Definition: UmbrellaComputer.h:86
DGtal::UmbrellaComputer::myState
State myState
Current state for the umbrella.
Definition: UmbrellaComputer.h:285
DGtal::UmbrellaComputer::State::operator<
bool operator<(const State &other) const
Definition: UmbrellaComputer.h:126