DGtal  1.2.0
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)
39 #define ArithmeticalDSSComputer_RECURSES
40 
41 #if !defined ArithmeticalDSSComputer_h
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 
152 
157  void init(const ConstIterator& it);
158 
164 
171 
175  Self getSelf() const;
176 
181 
189  bool operator==( const ArithmeticalDSSComputer & other ) const;
190 
197  bool operator!=( const ArithmeticalDSSComputer & other ) const;
198 
203 
204  // ----------------------- Interface --------------------------------------
205  public:
206 
213 
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 ;
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 
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 
484  template <typename TIterator,
485  typename TInteger = typename IteratorCirculatorTraits<TIterator>::Value::Coordinate>
487 
488 } // namespace DGtal
489 
490 
492 // Includes inline functions/methods.
493 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.ih"
494 
495 // //
497 
498 #endif // !defined ArithmeticalDSSComputer_h
499 
500 #undef ArithmeticalDSSComputer_RECURSES
501 #endif // else defined(ArithmeticalDSSComputer_RECURSES)
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< Point, typename DSS::Point >::value))
Integer remainder(const Point &aPoint) const
bool operator!=(const ArithmeticalDSSComputer &other) const
ArithmeticalDSSComputer< ReverseIterator< ConstIterator >, TInteger, adjacency > Reverse
bool isInDSL(const Point &aPoint) const
bool isInDSS(const Point &aPoint) const
Integer remainder(const ConstIterator &it) const
Integer position(const Point &aPoint) const
ArithmeticalDSSComputer(const ConstIterator &it)
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept< ConstIterator >))
ArithmeticalDSSComputer< ConstIterator, TInteger, adjacency > Self
ArithmeticalDSSComputer(const ArithmeticalDSSComputer &other)
const Primitive & primitive() const
bool isInDSL(const ConstIterator &it) const
ConstIterator end() const
ArithmeticalDSSComputer & operator=(const ArithmeticalDSSComputer &other)
IteratorCirculatorTraits< TIterator >::Value::Coordinate Coordinate
Integer position(const ConstIterator &it) const
bool operator==(const ArithmeticalDSSComputer &other) const
BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept< ConstIterator >))
bool isInDSS(const ConstIterator &it) const
void selfDisplay(std::ostream &out) const
IteratorCirculatorTraits< ConstIterator >::Value Point
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
ConstIterator begin() const
ArithmeticalDSS< Coordinate, Integer, adjacency > DSS
BOOST_STATIC_ASSERT((Point::dimension==2))
BOOST_CONCEPT_ASSERT((concepts::CInteger< Coordinate >))
void init(const ConstIterator &it)
Aim: This class represents a naive (resp. standard) digital straight segment (DSS),...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: Provides nested types for both iterators and circulators: Type, Category, Value,...
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/ForwardTraversal.html.
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/ReadableIterator.html.
const Point aPoint(3, 4)