DGtal  0.9.2
StabbingCircleComputer.h
1 
17 #pragma once
18 
31 #if defined(StabbingCircleComputer_RECURSES)
32 #error Recursive header files inclusion detected in StabbingCircleComputer.h
33 #else // defined(StabbingCircleComputer_RECURSES)
34 
35 #define StabbingCircleComputer_RECURSES
36 
37 #if !defined StabbingCircleComputer_h
38 
39 #define StabbingCircleComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/CowPtr.h"
46 #include "DGtal/base/ConceptUtils.h"
47 #include "DGtal/geometry/curves/SegmentComputerUtils.h"
48 
49 #include "DGtal/geometry/curves/StabbingLineComputer.h"
50 #include "DGtal/shapes/fromPoints/CircleFrom2Points.h"
51 #include "DGtal/geometry/tools/Preimage2D.h"
52 #include "DGtal/shapes/fromPoints/CircleFrom3Points.h"
53 #include "DGtal/shapes/fromPoints/Point2ShapePredicate.h"
54 
56 
57 namespace DGtal
58 {
59 
61  // template class StabbingCircleComputer
111  template <typename TConstIterator>
113  {
114 
115  public:
116 
117  //requiered types
118  typedef TConstIterator ConstIterator;
121 
122  //point type
124  //Pair::first_type and Pair::second_type should be the same type;
126  typedef typename Pair::first_type Point;
127  BOOST_STATIC_ASSERT(( Point::dimension == 2 ));
128 
129  private:
130 
131  //other types used for the recognition
134 
135  //Predicates used to decide whether the current circle is still seperating or not
140 
141  // ----------------------- Standard services ------------------------------
142  public:
143 
148 
153  StabbingCircleComputer ( const Self& other );
154 
160  Self& operator= ( const Self& other );
161 
166 
174  bool operator==( const Self & other) const;
175 
183  bool operator!=( const Self & other) const;
184 
188  Self getSelf() const;
189 
193  Reverse getReverse() const;
194 
195 
196  // ----------------------- Interface --------------------------------------
197  public:
198 
203  bool isValid() const;
204 
208  ConstIterator begin() const;
209 
213  ConstIterator end() const;
214 
215  //------------------ accessors -------------------------------
216 
221  bool isStraight() const;
222 
228  StabbingLineComputerPtr getStabbingLineComputerPtr() const;
229 
233  Circle getSeparatingCircle() const;
234 
235  // ----------------------- growth operations --------------------------------------
236 
241  void init(const ConstIterator& anIt);
242 
248  bool extendFront();
249 
255  bool isExtendableFront();
256 
262  bool extendBack();
263 
269  bool isExtendableBack();
270 
271  //------------------ display -------------------------------
276  void selfDisplay ( std::ostream & out ) const;
277 
278 
282  std::string className() const;
283 
284 
285  // ------------------------- Protected Datas ------------------------------
286  private:
287  // ------------------------- Private Datas --------------------------------
288  private:
292  ConstIterator myBegin;
296  ConstIterator myEnd;
300  StabbingLineComputerPtr mySegPtr;
304  Circle myCircle;
310 
311  // ------------------------- Hidden services ------------------------------
312  protected:
313 
314 
315  private:
316 
317 
318  // ------------------------- Internals ------------------------------------
319  private:
320 
340  template <typename TIterator>
341  bool isCircularlySeparable(const TIterator& itb, const TIterator& ite,
342  const Point& aPole,
343  Point& Pf, Point& Pl, Point& Qf, Point& Ql);
344 
345  // ------------------------- Private Datas --------------------------------
346  private:
347 
348 
349  }; // end of class StabbingCircleComputer
350 
351 
358  template <typename TConstIterator>
359  std::ostream&
360  operator<< ( std::ostream & out, const StabbingCircleComputer<TConstIterator> & object );
361 
362 } // namespace DGtal
363 
364 
366 // Includes inline functions.
367 #include "DGtal/geometry/curves/StabbingCircleComputer.ih"
368 
369 // //
371 
372 #endif // !defined StabbingCircleComputer_h
373 
374 #undef StabbingCircleComputer_RECURSES
375 #endif // else defined(StabbingCircleComputer_RECURSES)
bool operator==(const Self &other) const
CircleFrom3Points< Point > Circle
CowPtr< StabbingLineComputer< ConstIterator > > StabbingLineComputerPtr
functors::Point2ShapePredicate< Circle, true, true > QInCirclePred
functors::Point2ShapePredicate< Circle, false, true > PInCirclePred
Self & operator=(const Self &other)
ConstIterator begin() const
StabbingLineComputerPtr getStabbingLineComputerPtr() const
std::string className() const
Aim: On-line recognition of a digital circular arcs (DCA) defined as a sequence of connected grid edg...
Aim: Predicate returning 'true' iff a given point is in the 'interior' of a given shape...
StabbingCircleComputer< ReverseIterator< ConstIterator > > Reverse
bool operator!=(const Self &other) const
void selfDisplay(std::ostream &out) const
Circle getSeparatingCircle() const
bool isCircularlySeparable(const TIterator &itb, const TIterator &ite, const Point &aPole, Point &Pf, Point &Pl, Point &Qf, Point &Ql)
IteratorCirculatorTraits< ConstIterator >::Value Pair
ConstIterator end() const
void init(const ConstIterator &anIt)
StabbingCircleComputer< ConstIterator > Self
DGtal is the top-level namespace which contains all DGtal functions and types.
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< typename Pair::first_type, typename Pair::second_type >::value))
Aim: Copy on write shared pointer.
Definition: CowPtr.h:67