DGtal  1.5.beta
ArithmeticalDSSComputerOnSurfels.h
1 
17 #pragma once
18 
33 #if defined(ArithmeticalDSSComputerOnSurfels_RECURSES)
34 #error Recursive header files inclusion detected in ArithmeticalDSSComputerOnSurfels.h
35 #else // defined(ArithmeticalDSSComputerOnSurfels_RECURSES)
37 #define ArithmeticalDSSComputerOnSurfels_RECURSES
38 
39 #if !defined ArithmeticalDSSComputerOnSurfels_h
41 #define ArithmeticalDSSComputerOnSurfels_h
42 
44 // Inclusions
45 #include <iostream>
46 #include <list>
47 #include "DGtal/base/Exceptions.h"
48 #include "DGtal/base/Common.h"
49 #include "DGtal/kernel/SpaceND.h"
50 #include "DGtal/kernel/PointVector.h"
51 #include "DGtal/kernel/BasicPointFunctors.h"
52 #include "DGtal/kernel/CInteger.h"
53 #include "DGtal/base/ReverseIterator.h"
54 #include "DGtal/geometry/curves/ArithmeticalDSS.h"
55 #include "DGtal/topology/CCellularGridSpaceND.h"
57 
58 
59 namespace DGtal
60 {
62  // class ArithmeticalDSSComputerOnSurfels
83  template <typename TKSpace, typename TIterator,
84  typename TInteger = typename TKSpace::Space::Integer>
86  {
88  BOOST_STATIC_ASSERT(( TKSpace::dimension == 3 ));
89 
90  // ----------------------- inner types ------------------------------
91  public:
92 
96  typedef TKSpace KSpace;
97 
101  typedef typename KSpace::SCell SCell;
102 
106  typedef TIterator ConstIterator;
114  typedef typename KSpace::Space::Point Point3;
115 
120 
125 
129  typedef typename Point::Coordinate Coordinate;
131 
135  typedef TInteger Integer;
137 
142  //we expect that the iterator type returned DGtal points, used in the DSS representation
144 
148  typedef DSS Primitive;
149 
153  typedef Point Vector;
154 
159 
164 
165  virtual Point first(const std::pair<Point,Point>& aPair) const { return aPair.first; }
166  virtual Point second(const std::pair<Point,Point>& aPair) const { return aPair.second; }
167 
168  };
170 
171  Point first(const std::pair<Point,Point>& aPair) const { return aPair.second; }
172  Point second(const std::pair<Point,Point>& aPair) const { return aPair.first; }
173 
174  };
175  typedef std::shared_ptr<DirectPairExtractor> PairExtractor;
176 
181 
182  // ----------------------- Standard services ------------------------------
183  public:
184 
190 
200  ArithmeticalDSSComputerOnSurfels(const KSpace& aKSpace, Dimension aDim1, Dimension aDim2, bool aFlagToReverse = false);
201 
206  void init(const ConstIterator& it);
207 
213 
220 
224  Self getSelf() const;
225 
230 
238  bool operator==( const ArithmeticalDSSComputerOnSurfels & other ) const;
239 
246  bool operator!=( const ArithmeticalDSSComputerOnSurfels & other ) const;
247 
252 
253  // ----------------------- Interface --------------------------------------
254  public:
255 
265 
272 
282  bool extendFront();
283 
289  bool extendBack();
290 
296  bool retractFront();
297 
303  bool retractBack();
304 
312  std::pair<Point,Point> getProjectedPointsFromSurfel(SCell const& aSurfel) const;
313 
321  Point getNextProjectedPoint(SCell const& aSurfel) const;
322 
330  Point getPreviousProjectedPoint(SCell const& aSurfel) const;
331 
332  // ------------------------- Accessors ------------------------------
339  const Primitive& primitive() const;
343  Integer a() const;
347  Integer b() const;
351  Integer mu() const;
355  Integer omega() const;
359  Point Uf() const;
363  Point Ul() const;
367  Point Lf() const;
371  Point Ll() const;
375  Point back() const ;
379  Point front() const ;
388 
393  bool isValid() const;
394 
395 
396  // ------------------------- Hidden services ------------------------------
397  private:
398 
406  std::pair<Point,Point> getProjectedPointsFromLinel(SCell const& aLinel) const;
407 
414  Dimension dimNotIn(Dimension const& aDim1, Dimension const& aDim2) const;
415 
416  // ------------------------- Protected Datas ------------------------------
417  protected:
418 
422  const KSpace* myKSpace;
423 
428 
433 
439 
444 
450 
455 
460 
468 
469  // ------------------ Display ------------------------------------------
470 
471  public:
472 
477  void selfDisplay ( std::ostream & out ) const;
478 
479 
480  }; // end of class ArithmeticalDSSComputerOnSurfels
481 
482 
489 template <typename TKSpace, typename TIterator, typename TInteger>
490 std::ostream&
492 {
493  object.selfDisplay( out);
494  return out;
495 }
496 
497 } // namespace DGtal
498 
499 
501 // Includes inline functions/methods.
502 #include "DGtal/geometry/surfaces/ArithmeticalDSSComputerOnSurfels.ih"
503 
504 // //
506 
507 #endif // !defined ArithmeticalDSSComputerOnSurfels_h
508 
509 #undef ArithmeticalDSSComputerOnSurfels_RECURSES
510 #endif // else defined(ArithmeticalDSSComputerOnSurfels_RECURSES)
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
BOOST_STATIC_ASSERT((TKSpace::dimension==3))
ArithmeticalDSSComputerOnSurfels(const ArithmeticalDSSComputerOnSurfels &other)
ArithmeticalDSSComputerOnSurfels< KSpace, ReverseIterator< ConstIterator >, TInteger > Reverse
std::shared_ptr< DirectPairExtractor > PairExtractor
ArithmeticalDSSComputerOnSurfels & operator=(const ArithmeticalDSSComputerOnSurfels &other)
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept< ConstIterator >))
bool operator!=(const ArithmeticalDSSComputerOnSurfels &other) const
functors::Projector< SpaceND< 2, TInteger > > Projector
Point getNextProjectedPoint(SCell const &aSurfel) const
const Primitive & primitive() const
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
ArithmeticalDSS< Coordinate, Integer, 4 > DSS
bool operator==(const ArithmeticalDSSComputerOnSurfels &other) const
std::pair< Point, Point > getProjectedPointsFromSurfel(SCell const &aSurfel) const
ArithmeticalDSSComputerOnSurfels(const KSpace &aKSpace, Dimension aDim1, Dimension aDim2, bool aFlagToReverse=false)
Point getPreviousProjectedPoint(SCell const &aSurfel) const
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< Point, typename DSS::Point >::value))
BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept< ConstIterator >))
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< SCell, typename IteratorCirculatorTraits< ConstIterator >::Value >::value))
Dimension dimNotIn(Dimension const &aDim1, Dimension const &aDim2) const
void init(const ConstIterator &it)
ArithmeticalDSSComputerOnSurfels< KSpace, ConstIterator, TInteger > Self
BOOST_CONCEPT_ASSERT((concepts::CInteger< Coordinate >))
void selfDisplay(std::ostream &out) const
std::pair< Point, Point > getProjectedPointsFromLinel(SCell const &aLinel) const
Component Coordinate
Type for Point elements.
Definition: PointVector.h:617
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::uint32_t Dimension
Definition: Common.h:136
virtual Point second(const std::pair< Point, Point > &aPair) const
virtual Point first(const std::pair< Point, Point > &aPair) const
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88
Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an ...
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.