DGtal  1.4.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)
35 #define InGeneralizedDiskOfGivenRadius_RECURSES
36 
37 #if !defined InGeneralizedDiskOfGivenRadius_h
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
125  template <typename TPoint, typename TDetComputer>
127  {
128  // ----------------------- Inner types ------------------------------------
129  public:
133  typedef TPoint Point;
134 
138  typedef std::array<Point,2> PointArray;
142  typedef typename PointArray::size_type SizeArray;
146  static const SizeArray size = 2;
147 
151  typedef TDetComputer DetComputer;
156  typedef typename DetComputer::ArgumentInteger Integer;
160  typedef typename DetComputer::ResultInteger Value;
167 
168  // ----------------------- Standard services ------------------------------
169  public:
170 
187  InGeneralizedDiskOfGivenRadius(bool isPositive = true,
188  const Integer& aNum2 = NumberTraits<Integer>::ONE,
189  const Integer& aDen2 = NumberTraits<Integer>::ZERO);
190 
196 
203 
204  // ----------------------- Interface --------------------------------------
205  public:
213  void init( const Point& aP, const Point& aQ );
214 
220  void init(const PointArray& aA);
221 
243  Value operator()( const Point& aR ) const;
244 
249  void selfDisplay ( std::ostream & out ) const;
250 
259  bool lengthIsValid(const Integer& aL2) const;
260 
268  bool isValid() const;
269 
270  // ----------------------- Internals --------------------------------------
271  public:
275  void finalizeComputation() const;
276 
277  // ------------------------- Private Datas --------------------------------
278  private:
303 
307  mutable Point myP;
311  mutable Point myQ;
315  mutable Point myR;
327  mutable Integer myPQ0;
331  mutable Integer myPQ1;
335  mutable Integer myPQnorm;
339  mutable Integer myQR0;
343  mutable Integer myQR1;
347  mutable Integer myQRnorm;
351  mutable Integer myRP0;
355  mutable Integer myRP1;
359  mutable Integer myRPnorm;
363  mutable Integer myArea;
369 
370  }; // end of class InGeneralizedDiskOfGivenRadius
371 
372 
379  template <typename TPoint, typename TDetComputer>
380  std::ostream&
381  operator<< ( std::ostream & out, const InGeneralizedDiskOfGivenRadius<TPoint, TDetComputer> & object );
382 
383 
384 } // namespace DGtal
385 
386 
388 // Includes inline functions.
389 #include "DGtal/geometry/tools/determinant/InGeneralizedDiskOfGivenRadius.ih"
390 
391 // //
393 
394 #endif // !defined InGeneralizedDiskOfGivenRadius_h
395 
396 #undef InGeneralizedDiskOfGivenRadius_RECURSES
397 #endif // else defined(InGeneralizedDiskOfGivenRadius_RECURSES)
Aim: This class implements an orientation functor that provides a way to determine the position of ...
InGeneralizedDiskOfGivenRadius & operator=(const InGeneralizedDiskOfGivenRadius &other)
void init(const Point &aP, const Point &aQ)
bool lengthIsValid(const Integer &aL2) const
InGeneralizedDiskOfGivenRadius(bool isPositive=true, const Integer &aNum2=NumberTraits< Integer >::ONE, const Integer &aDen2=NumberTraits< Integer >::ZERO)
void selfDisplay(std::ostream &out) const
InGeneralizedDiskOfGivenRadius(const InGeneralizedDiskOfGivenRadius &other)
Value operator()(const Point &aR) const
BOOST_CONCEPT_ASSERT((C2x2DetComputer< DetComputer >))
void init(const PointArray &aA)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: This concept gathers all models that are able to compute the (sign of the) determinant of a 2x2 ...
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:564