DGtal  0.9.2
InGeneralizedDiskOfGivenRadius.h
1 
17 #pragma once
18 
31 #if defined(InGeneralizedDiskOfGivenRadius_RECURSES)
32 #error Recursive header files inclusion detected in InGeneralizedDiskOfGivenRadius.h
33 #else // defined(InGeneralizedDiskOfGivenRadius_RECURSES)
34 
35 #define InGeneralizedDiskOfGivenRadius_RECURSES
36 
37 #if !defined InGeneralizedDiskOfGivenRadius_h
38 
39 #define InGeneralizedDiskOfGivenRadius_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <array>
45 #include "DGtal/base/Common.h"
46 
47 #include "DGtal/geometry/tools/determinant/C2x2DetComputer.h"
48 #include "DGtal/geometry/tools/determinant/Simple2x2DetComputer.h"
50 
51 namespace DGtal
52 {
53 
55  // template class InGeneralizedDiskOfGivenRadius
124  template <typename TPoint, typename TDetComputer>
126  {
127  // ----------------------- Inner types ------------------------------------
128  public:
132  typedef TPoint Point;
133 
137  typedef std::array<Point,2> PointArray;
141  typedef typename PointArray::size_type SizeArray;
145  static const SizeArray size = 2;
146 
150  typedef TDetComputer DetComputer;
155  typedef typename DetComputer::ArgumentInteger Integer;
159  typedef typename DetComputer::ResultInteger Value;
166 
167  // ----------------------- Standard services ------------------------------
168  public:
169 
186  InGeneralizedDiskOfGivenRadius(bool isPositive = true,
187  const Integer& aNum2 = NumberTraits<Integer>::ONE,
188  const Integer& aDen2 = NumberTraits<Integer>::ZERO);
189 
195 
202 
203  // ----------------------- Interface --------------------------------------
204  public:
212  void init( const Point& aP, const Point& aQ );
213 
219  void init(const PointArray& aA);
220 
242  Value operator()( const Point& aR ) const;
243 
248  void selfDisplay ( std::ostream & out ) const;
249 
258  bool lengthIsValid(const Integer& aL2) const;
259 
267  bool isValid() const;
268 
269  // ----------------------- Internals --------------------------------------
270  public:
274  void finalizeComputation() const;
275 
276  // ------------------------- Private Datas --------------------------------
277  private:
281  Integer myNum2;
285  Integer myDen2;
301  DetComputer myDetComputer;
302 
306  mutable Point myP;
310  mutable Point myQ;
314  mutable Point myR;
318  mutable Integer myComputedNum2;
322  mutable Integer myComputedDen2;
326  mutable Integer myPQ0;
330  mutable Integer myPQ1;
334  mutable Integer myPQnorm;
338  mutable Integer myQR0;
342  mutable Integer myQR1;
346  mutable Integer myQRnorm;
350  mutable Integer myRP0;
354  mutable Integer myRP1;
358  mutable Integer myRPnorm;
362  mutable Integer myArea;
367  mutable AreaFunctor myAreaFunctor;
368 
369  }; // end of class InGeneralizedDiskOfGivenRadius
370 
371 
378  template <typename TPoint, typename TDetComputer>
379  std::ostream&
380  operator<< ( std::ostream & out, const InGeneralizedDiskOfGivenRadius<TPoint, TDetComputer> & object );
381 
382 
383 } // namespace DGtal
384 
385 
387 // Includes inline functions.
388 #include "DGtal/geometry/tools/determinant/InGeneralizedDiskOfGivenRadius.ih"
389 
390 // //
392 
393 #endif // !defined InGeneralizedDiskOfGivenRadius_h
394 
395 #undef InGeneralizedDiskOfGivenRadius_RECURSES
396 #endif // else defined(InGeneralizedDiskOfGivenRadius_RECURSES)
InGeneralizedDiskOfGivenRadius & operator=(const InGeneralizedDiskOfGivenRadius &other)
Value operator()(const Point &aR) const
BOOST_CONCEPT_ASSERT((C2x2DetComputer< DetComputer >))
void selfDisplay(std::ostream &out) const
Aim: This concept gathers all models that are able to compute the (sign of the) determinant of a 2x2 ...
void init(const Point &aP, const Point &aQ)
InGeneralizedDiskOfGivenRadius(bool isPositive=true, const Integer &aNum2=NumberTraits< Integer >::ONE, const Integer &aDen2=NumberTraits< Integer >::ZERO)
Aim: This class implements an orientation functor that provides a way to determine the position of a ...
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:69
DGtal is the top-level namespace which contains all DGtal functions and types.
bool lengthIsValid(const Integer &aL2) const