DGtal  0.9.2
Naive3DDSSComputer.h
1 
17 #pragma once
18 
31 #if defined(Naive3DDSSComputer_RECURSES)
32 #error Recursive header files inclusion detected in Naive3DDSSComputer.h
33 #else // defined(Naive3DDSSComputer_RECURSES)
34 
35 #define Naive3DDSSComputer_RECURSES
36 
37 #if !defined Naive3DDSSComputer_h
38 
39 #define Naive3DDSSComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <list>
45 #include <utility>
46 #include <array>
47 #include "DGtal/base/Exceptions.h"
48 #include "DGtal/base/Common.h"
49 #include "DGtal/kernel/PointVector.h"
50 #include "DGtal/kernel/CInteger.h"
51 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
52 #include "DGtal/base/ConstIteratorAdapter.h"
53 #include "DGtal/kernel/BasicPointFunctors.h"
55 
56 namespace DGtal
57 {
58 
60 // class Naive3DDSSComputer
68 // class Naive3DDSSComputer
96 template <typename TIterator, typename TInteger, int connectivity = 8>
98 {
100  // ----------------------- Types ------------------------------
101  public:
103  typedef TInteger Integer;
105  typedef std::pair <Integer, Integer> Quotient;
107  typedef TIterator ConstIterator;
117  typedef typename Point3d::Coordinate Coordinate;
121  typedef std::array< Quotient, 3 > PointR3d;
128 
129  // ----------------------- Standard services ------------------------------
130  public:
131 
132 
138 
144  Naive3DDSSComputer ( const ConstIterator& it );
145 
150  void init ( const ConstIterator& it );
151 
152 
157  Naive3DDSSComputer ( const Naive3DDSSComputer & other );
158 
165 
169  Self getSelf() const;
170 
174  Reverse getReverse() const;
175 
181  bool isInDSS ( const Point3d& aPoint ) const;
182 
188  bool isInDSS ( const ConstIterator & it ) const;
189 
198  bool operator== ( const Naive3DDSSComputer & other ) const;
199 
206  bool operator!= ( const Naive3DDSSComputer & other ) const;
207 
212 
213  // ----------------------- Interface --------------------------------------
214  public:
215 
216 
223  bool extendFront();
224 
225 
231  bool isExtendableFront();
232 
233  // ------------------------- Accessors ------------------------------
234 
243  void getParameters ( Vector3d& direction, PointR3d& intercept, PointR3d& thickness ) const;
244 
249  bool isValid() const;
250 
255  ConstIterator begin() const;
259  ConstIterator end() const;
260 
265  const ArithmeticalDSSComputer2d & arithmeticalDSS2dXY () const;
266 
271  const ArithmeticalDSSComputer2d & arithmeticalDSS2dXZ () const;
272 
277  const ArithmeticalDSSComputer2d & arithmeticalDSS2dYZ () const;
278 
287  const ArithmeticalDSSComputer2d & arithmeticalDSS2d( Dimension i ) const;
288 
296  bool validArithmeticalDSS2d ( Dimension i ) const;
297 
298 
299  // ------------------ Display ------------------------------------------
300  public:
301 
305  std::string className() const;
306 
311  void selfDisplay ( std::ostream & out ) ;
312 
313  // ------------------------- Hidden services ------------------------------
314  private:
325  bool extendFront ( ArithmeticalDSSComputer2d & DSS2D, bool & blocked );
326 
327  // ------------------------- Protected Datas ------------------------------
328  protected:
329 
331  Projector2d myProjXY;
333  Projector2d myProjXZ;
335  Projector2d myProjYZ;
336 
338  ArithmeticalDSSComputer2d myXYalgo;
340  ArithmeticalDSSComputer2d myXZalgo;
342  ArithmeticalDSSComputer2d myYZalgo;
343 
350 
352  ConstIterator myBegin, myEnd;
353 }; // end of class Naive3DDSSComputer
354 
355 } // namespace DGtal
356 
357 
359 // Includes inline functions.
360 #if !defined(BUILD_INLINE)
361 #include "DGtal/geometry/curves/Naive3DDSSComputer.ih"
362 #endif
363 
364 
365 // //
367 
368 #endif // !defined Naive3DDSSComputer_h
369 
370 #undef Naive3DDSSComputer_RECURSES
371 #endif // else defined(Naive3DDSSComputer_RECURSES)
TIterator ConstIterator
Type of iterator, at least readable and forward.
This class adapts any iterator so that operator* returns another element than the one pointed to by t...
ArithmeticalDSSComputer2d myXYalgo
2d-arithmeticalDSS recognition algorithms for XY-plane.
Projector2d myProjXZ
Projector for XZ-plane.
Point3d::Coordinate Coordinate
Type of 3d digital point coordinate.
TInteger Integer
Type of integer, devoted to remainders (and intercepts)
bool operator==(const Naive3DDSSComputer &other) const
DGtal::uint32_t Dimension
Definition: Common.h:113
Naive3DDSSComputer & operator=(const Naive3DDSSComputer &other)
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
functors::Projector< SpaceND< 2, Coordinate > > Projector2d
Adapter for iterators.
IteratorCirculatorTraits< ConstIterator >::Value Vector3d
Type of 3d digital vector.
ConstIterator myBegin
begin and end iterators
ArithmeticalDSSComputer2d myYZalgo
2d-arithmeticalDSS recognition algorithms for YZ-plane.
Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an ...
void init(const ConstIterator &it)
const ArithmeticalDSSComputer2d & arithmeticalDSS2dXZ() const
Naive3DDSSComputer< ConstIterator, TInteger, connectivity > Self
Self type.
IteratorCirculatorTraits< ConstIterator >::Value Point3d
Type of 3d digital point.
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
void selfDisplay(std::ostream &out)
std::pair< Integer, Integer > Quotient
Type which represent quotient of two integers first/second.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
bool isInDSS(const Point3d &aPoint) const
Projector2d myProjXY
Projector for XY-plane.
std::string className() const
const ArithmeticalDSSComputer2d & arithmeticalDSS2dXY() const
DGtal::PointVector< 2, Coordinate > Point2d
Type of 2d digital point.
const ArithmeticalDSSComputer2d & arithmeticalDSS2d(Dimension i) const
ArithmeticalDSSComputer2d myXZalgo
2d-arithmeticalDSS recognition algorithms for XZ-plane.
void getParameters(Vector3d &direction, PointR3d &intercept, PointR3d &thickness) const
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::ArithmeticalDSSComputer< IteratorAdapter, TInteger, connectivity > ArithmeticalDSSComputer2d
2D arithmetical DSS recognition algorithm
Reverse getReverse() const
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
const ArithmeticalDSSComputer2d & arithmeticalDSS2dYZ() const
ConstIteratorAdapter< ConstIterator, Projector2d, Point2d > IteratorAdapter
Iterator over adapter.
ConstIterator begin() const
Naive3DDSSComputer< ReverseIterator< ConstIterator >, TInteger, connectivity > Reverse
Reverse type.
Projector2d myProjYZ
Projector for YZ-plane.
bool operator!=(const Naive3DDSSComputer &other) const
bool validArithmeticalDSS2d(Dimension i) const
ConstIterator end() const
std::array< Quotient, 3 > PointR3d
Type of 3d rational point.