DGtal  0.9.3beta
ArithmeticalDSSComputer.h
1 
17 #pragma once
18 
35 #if defined(ArithmeticalDSSComputer_RECURSES)
36 #error Recursive header files inclusion detected in ArithmeticalDSSComputer.h
37 #else // defined(ArithmeticalDSSComputer_RECURSES)
38 
39 #define ArithmeticalDSSComputer_RECURSES
40 
41 #if !defined ArithmeticalDSSComputer_h
42 
43 #define ArithmeticalDSSComputer_h
44 
46 // Inclusions
47 #include <iostream>
48 #include <list>
49 #include "DGtal/base/Exceptions.h"
50 #include "DGtal/base/Common.h"
51 #include "DGtal/kernel/PointVector.h"
52 #include "DGtal/kernel/CInteger.h"
53 #include "DGtal/base/ReverseIterator.h"
54 #include "DGtal/geometry/curves/ArithmeticalDSS.h"
56 
57 
58 namespace DGtal
59 {
61  // class ArithmeticalDSSComputer
83  template <typename TIterator,
84  typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate,
85  unsigned short adjacency = 8>
87  {
88 
89  // ----------------------- inner types ------------------------------
90  public:
91 
95  typedef TIterator ConstIterator;
98 
103  BOOST_STATIC_ASSERT(( Point::dimension == 2 ));
104 
110 
114  typedef TInteger Integer;
116 
121  //we expect that the iterator type returned DGtal points, used in the DSS representation
123 
127  typedef DSS Primitive;
128 
132  typedef Point Vector;
133 
136 
137  // ----------------------- Standard services ------------------------------
138  public:
139 
145 
151  ArithmeticalDSSComputer(const ConstIterator& it);
152 
157  void init(const ConstIterator& it);
158 
164 
171 
175  Self getSelf() const;
176 
180  Reverse getReverse() const;
181 
189  bool operator==( const ArithmeticalDSSComputer & other ) const;
190 
197  bool operator!=( const ArithmeticalDSSComputer & other ) const;
198 
203 
204  // ----------------------- Interface --------------------------------------
205  public:
206 
212  bool isExtendableFront();
213 
219  bool isExtendableBack();
220 
226  bool extendFront();
227 
233  bool extendBack();
234 
240  bool retractFront();
241 
247  bool retractBack();
248 
249 
250  // ------------------------- Accessors ------------------------------
257  const Primitive& primitive() const;
261  Integer a() const;
265  Integer b() const;
269  Integer mu() const;
273  Integer omega() const;
277  Point Uf() const;
281  Point Ul() const;
285  Point Lf() const;
289  Point Ll() const;
293  Point back() const ;
297  Point front() const ;
301  ConstIterator begin() const;
305  ConstIterator end() const;
306 
311  bool isValid() const;
312 
313 
314  // ------------------ Useful tools -----------------------------------
315 
322  Integer remainder(const ConstIterator & it) const;
323 
330  Integer remainder( const Point& aPoint ) const;
331 
338  Integer position(const ConstIterator & it) const;
339 
346  Integer position( const Point& aPoint ) const;
347 
354  bool isInDSL( const Point& aPoint ) const;
355 
362  bool isInDSL(const ConstIterator & it) const;
363 
369  bool isInDSS( const Point& aPoint ) const;
370 
376  bool isInDSS(const ConstIterator & it) const;
377 
378 
379  // ------------------------- Hidden services ------------------------------
380  private:
381 
382 
383  // ------------------------- Protected Datas ------------------------------
384  protected:
385 
389  DSS myDSS;
393  ConstIterator myBegin;
397  ConstIterator myEnd;
398 
399  // ------------------ Display ------------------------------------------
400 
401  public:
402 
407  void selfDisplay ( std::ostream & out ) const;
408 
409 
410  }; // end of class ArithmeticalDSSComputer
411 
412 
419 template <typename TIterator, typename TInteger, unsigned short adjacency>
420 std::ostream&
421 operator<< ( std::ostream & out, const ArithmeticalDSSComputer<TIterator,TInteger,adjacency> & object )
422 {
423  object.selfDisplay( out);
424  return out;
425 }
426 
427 } // namespace DGtal
428 
430 // Aliases
431 namespace DGtal
432 {
460  template <typename TIterator,
461  typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
463  public ArithmeticalDSSComputer<TIterator, TInteger, 4>
464  {
465  public:
471 
472  public:
473 
479 
484  StandardDSS4Computer(const ConstIterator& it);
485 
490  StandardDSS4Computer ( const StandardDSS4Computer & aOther );
491 
498 
499  };
500 
521  template <typename TIterator,
522  typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
524  public ArithmeticalDSSComputer<TIterator, TInteger, 4>
525  {
526  public:
532 
533  public:
534 
539  NaiveDSS8Computer ();
540 
545  NaiveDSS8Computer(const ConstIterator& it);
546 
551  NaiveDSS8Computer ( const NaiveDSS8Computer & aOther );
552 
558  NaiveDSS8Computer & operator= ( const NaiveDSS8Computer & aOther );
559 
560  };
561 
562 } // namespace DGtal
563 
564 
566 // Includes inline functions/methods.
567 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.ih"
568 
569 // //
571 
572 #endif // !defined ArithmeticalDSSComputer_h
573 
574 #undef ArithmeticalDSSComputer_RECURSES
575 #endif // else defined(ArithmeticalDSSComputer_RECURSES)
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of sta...
void selfDisplay(std::ostream &out) const
StandardDSS4Computer & operator=(const StandardDSS4Computer &aOther)
IteratorCirculatorTraits< TIterator >::Value::Coordinate Coordinate
void init(const ConstIterator &it)
ArithmeticalDSSComputer< ConstIterator, TInteger, adjacency > Self
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept< ConstIterator >))
ArithmeticalDSSComputer< TIterator, TInteger, 4 > Super
ArithmeticalDSSComputer< ReverseIterator< ConstIterator >, TInteger, adjacency > Reverse
bool operator!=(const ArithmeticalDSSComputer &other) const
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
BOOST_STATIC_ASSERT((Point::dimension==2))
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of nai...
ArithmeticalDSS< Coordinate, Integer, adjacency > DSS
ArithmeticalDSSComputer & operator=(const ArithmeticalDSSComputer &other)
Integer remainder(const ConstIterator &it) const
bool operator==(const ArithmeticalDSSComputer &other) const
Aim: Provides nested types for both iterators and circulators: Type, Category, Value, Difference, Pointer and Reference.
Integer position(const ConstIterator &it) const
ConstIterator end() const
DGtal is the top-level namespace which contains all DGtal functions and types.
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/ForwardTraversal.html.
bool isInDSL(const Point &aPoint) const
IteratorCirculatorTraits< ConstIterator >::Value Point
bool isInDSS(const Point &aPoint) const
ConstIterator begin() const
ArithmeticalDSSComputer< TIterator, TInteger, 4 > Super
const Primitive & primitive() const
NaiveDSS8Computer & operator=(const NaiveDSS8Computer &aOther)
Super::ConstIterator ConstIterator
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/ReadableIterator.html.