DGtal  1.5.beta
StabbingLineComputer.h
1 
17 #pragma once
18 
31 #if defined(StabbingLineComputer_RECURSES)
32 #error Recursive header files inclusion detected in StabbingLineComputer.h
33 #else // defined(StabbingLineComputer_RECURSES)
35 #define StabbingLineComputer_RECURSES
36 
37 #if !defined StabbingLineComputer_h
39 #define StabbingLineComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include <boost/static_assert.hpp>
46 #include "DGtal/base/CowPtr.h"
47 #include "DGtal/base/ConceptUtils.h"
48 #include "DGtal/base/ReverseIterator.h"
49 #include "DGtal/geometry/curves/SegmentComputerUtils.h"
50 
51 #include "DGtal/geometry/tools/Preimage2D.h"
52 #include "DGtal/shapes/fromPoints/StraightLineFrom2Points.h"
53 
55 
56 namespace DGtal
57 {
58 
60  // template class StabbingLineComputer
91  template <typename TConstIterator>
93  {
94 
95  public:
96 
97  //requiered types
98  typedef TConstIterator ConstIterator;
101 
102  //point type
104  typedef typename Pair::first_type Point;
105 
106  //Pair::first_type and Pair::second_type should be the same type;
108  < typename Pair::first_type, typename Pair::second_type >
109  ::value ) );
110 
111  //preimage
115 
116  // ----------------------- Standard services ------------------------------
117  public:
118 
123 
128  StabbingLineComputer ( const Self& other );
129 
135  Self& operator= ( const Self& other );
136 
141 
147  bool operator==( const Self & other) const;
148 
154  bool operator!=( const Self & other) const;
155 
159  Self getSelf() const;
160 
164  Reverse getReverse() const;
165 
166 
167  // ----------------------- Interface --------------------------------------
168  public:
169 
174  bool isValid() const;
175 
180 
185 
186  // ----------------------- accessors --------------------------------------
187 
191  Point Uf() const;
192 
196  Point Ul() const;
197 
201  Point Lf() const;
202 
206  Point Ll() const;
207 
213 
217  bool isClockwiseOriented() const;
218 
225  void getParameters(double& alpha, double& beta, double& gamma) const;
226 
236  void projects(double& x, double& y,
237  const double& alpha, const double& beta, const double& gamma) const;
238 
239  // ----------------------- growth operations --------------------------------------
240 
245  void init(const ConstIterator& anIt);
246 
253  bool extendFront();
254 
262 
272  bool isConcave();
273 
283  bool isConvex();
284 
291  bool extendBack();
292 
300 
311 
322 
323  //------------------ display -------------------------------
328  void selfDisplay ( std::ostream & out ) const;
329 
334  //DrawableWithBoard2D* defaultStyle( std::string mode="" ) const;
335 
339  std::string className() const;
340 
341  // ------------------------- Protected Datas ------------------------------
342  private:
343  // ------------------------- Private Datas --------------------------------
344  private:
366  bool myFlagIsCW;
367 
368  // ------------------------- Hidden services ------------------------------
369  protected:
370 
371 
372  private:
373 
374 
375 
376  // ------------------------- Internals ------------------------------------
377  private:
378 
379  // ------------------------- Private Datas --------------------------------
380  private:
381 
382  }; // end of class StabbingLineComputer
383 
384 
391  template <typename TConstIterator>
392  std::ostream&
393  operator<< ( std::ostream & out, const StabbingLineComputer<TConstIterator> & object );
394 
395 } // namespace DGtal
396 
397 
399 // Includes inline functions.
400 #include "DGtal/geometry/curves/StabbingLineComputer.ih"
401 
402 // //
404 
405 #endif // !defined StabbingLineComputer_h
406 
407 #undef StabbingLineComputer_RECURSES
408 #endif // else defined(StabbingLineComputer_RECURSES)
Aim: Computes the preimage of the 2D Euclidean shapes crossing a sequence of n straigth segments in O...
Definition: Preimage2D.h:94
Aim: On-line recognition of a digital straight segment (DSS) defined as a sequence of connected grid ...
bool operator==(const Self &other) const
StabbingLineComputer(const Self &other)
Self & operator=(const Self &other)
IteratorCirculatorTraits< ConstIterator >::Value Pair
PreimagePtr getPreimage() const
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< typename Pair::first_type, typename Pair::second_type > ::value))
void projects(double &x, double &y, const double &alpha, const double &beta, const double &gamma) const
Reverse getReverse() const
bool isClockwiseOriented() const
ConstIterator end() const
StraightLineFrom2Points< Point > StraightLine
ConstIterator begin() const
std::string className() const
Preimage2D< StraightLine > Preimage
StabbingLineComputer< ReverseIterator< ConstIterator > > Reverse
void selfDisplay(std::ostream &out) const
void init(const ConstIterator &anIt)
StabbingLineComputer< ConstIterator > Self
bool operator!=(const Self &other) const
void getParameters(double &alpha, double &beta, double &gamma) const
Aim: Represents a straight line uniquely defined by two 2D points and that is able to return for any ...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)