DGtal  0.9.2
ExactPredicateLpSeparableMetric.h
1 
17 #pragma once
18 
31 #if defined(ExactPredicateLpSeparableMetric_RECURSES)
32 #error Recursive header files inclusion detected in ExactPredicateLpSeparableMetric.h
33 #else // defined(ExactPredicateLpSeparableMetric_RECURSES)
34 
35 #define ExactPredicateLpSeparableMetric_RECURSES
36 
37 #if !defined ExactPredicateLpSeparableMetric_h
38 
39 #define ExactPredicateLpSeparableMetric_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <cmath>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/math/BasicMathFunctions.h"
47 #include "DGtal/kernel/CInteger.h"
48 #include "DGtal/kernel/CSpace.h"
49 #include "DGtal/kernel/CInteger.h"
51 
52 namespace DGtal
53 {
54 
56 // template class ExactPredicateLpSeparableMetric
85  template <typename TSpace, DGtal::uint32_t p,
86  typename TRawValue=DGtal::int64_t>
88  : public std::binary_function< typename TSpace::Point, typename TSpace::Point, double >
89  {
90  // ----------------------- Standard services ------------------------------
91  public:
92  typedef std::binary_function< typename TSpace::Point, typename TSpace::Point, double > Base;
93  typedef typename Base::first_argument_type first_argument_type;
94  typedef typename Base::second_argument_type second_argument_type;
95  typedef typename Base::result_type result_type;
96 
98  typedef TSpace Space;
100 
102  typedef typename Space::Point Point;
104  typedef typename Point::Coordinate Abscissa;
106  typedef typename Space::Vector Vector;
107 
109  typedef TRawValue RawValue;
111 
113  typedef double Value;
114 
117 
122 
123 
128 
133  ExactPredicateLpSeparableMetric ( const Self & other )
134  {
135  boost::ignore_unused_variable_warning( other );
136  }
137 
143  Self & operator= ( const Self & other )
144  {
145  boost::ignore_unused_variable_warning( other );
146  return *this;
147  }
148 
149  // ----------------------- Interface --------------------------------------
150  public:
151 
152  // ----------------------- CMetricSpace --------------------------------------
161  Value operator()(const Point & aP, const Point &aQ) const;
162 
174  Closest closest(const Point &origin,
175  const Point &first,
176  const Point &second) const;
177 
186  RawValue rawDistance(const Point & aP, const Point &aQ) const;
187 
188  // ----------------------- CSeparableMetric --------------------------------------
210  bool hiddenBy(const Point &u,
211  const Point &v,
212  const Point &w,
213  const Point &startingPoint,
214  const Point &endPoint,
215  const typename Point::UnsignedComponent dim) const;
216 
217 
222  void selfDisplay ( std::ostream & out ) const;
223 
228  bool isValid() const;
229 
230 
250  Abscissa binarySearchHidden(const Abscissa &udim,
251  const Abscissa &vdim,
252  const RawValue &nu,
253  const RawValue &nv,
254  const Abscissa &lower,
255  const Abscissa &upper) const;
256 
257  }; // end of class ExactPredicateLpSeparableMetric
258 
259 
261 // L_2 specialization //
263 
264 
265  template <typename TSpace,
266  typename TRawValue>
267  class ExactPredicateLpSeparableMetric<TSpace, 2, TRawValue>
268  : public std::binary_function< typename TSpace::Point, typename TSpace::Point, double >
269  {
270  // ----------------------- Standard services ------------------------------
271  public:
272 
274  typedef TSpace Space;
276  typedef typename Space::Point Point;
278  typedef typename Point::Coordinate Abscissa;
280  typedef typename Space::Vector Vector;
281 
283  typedef TRawValue RawValue;
284 
286  typedef double Value;
287 
290 
295 
296 
301 
302 
307  ExactPredicateLpSeparableMetric ( const Self & other )
308  {
309  boost::ignore_unused_variable_warning( other );
310  }
311 
317  Self & operator= ( const Self & other )
318  {
319  boost::ignore_unused_variable_warning( other );
320  return *this;
321  }
322 
323 
324  // ----------------------- Interface --------------------------------------
325  public:
326 
327  // ----------------------- CLocalMetric --------------------------------------
337  Value local(const Point & aP, const Vector &aDir) const;
338 
339 
340  // ----------------------- CMetric --------------------------------------
349  Value operator()(const Point & aP, const Point &aQ) const;
350 
362  Closest closest(const Point &origin,
363  const Point &first,
364  const Point &second) const;
365 
366 
377  RawValue rawDistance(const Point &aP, const Point &aQ) const;
378 
379  // ----------------------- CSeparableMetric --------------------------------------
398  bool hiddenBy(const Point &u,
399  const Point &v,
400  const Point &w,
401  const Point &startingPoint,
402  const Point &endPoint,
403  const typename Point::UnsignedComponent dim) const;
404 
405  // ----------------------- Other services --------------------------------------
410  void selfDisplay ( std::ostream & out ) const;
411 
416  bool isValid() const;
417 
418  // ------------------------- Protected Datas ------------------------------
419  private:
420 
421 
438  Abscissa binarySearchHidden(const Abscissa &udim,
439  const Abscissa &vdim,
440  const RawValue &nu,
441  const RawValue &nv,
442  const Abscissa &lower,
443  const Abscissa &upper) const;
444 
445 
446  }; // end of class ExactPredicateLpSeparableMetric
447 
454  template <typename T, DGtal::uint32_t p, typename P>
455  std::ostream&
456  operator<< ( std::ostream & out, const ExactPredicateLpSeparableMetric<T,p,P> & object );
457 
458 } // namespace DGtal
459 
460 
462 // Includes inline functions.
463 #include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.ih"
464 
465 // //
467 
468 #endif // !defined ExactPredicateLpSeparableMetric_h
469 
470 #undef ExactPredicateLpSeparableMetric_RECURSES
471 #endif // else defined(ExactPredicateLpSeparableMetric_RECURSES)
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
Component Coordinate
Type for Point elements.
Definition: PointVector.h:158
ExactPredicateLpSeparableMetric< TSpace, p, RawValue > Self
Self type.
void selfDisplay(std::ostream &out) const
std::binary_function< typename TSpace::Point, typename TSpace::Point, double > Base
Aim: implements separable l_p metrics with exact predicates.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
Value operator()(const Point &aP, const Point &aQ) const
Abscissa binarySearchHidden(const Abscissa &udim, const Abscissa &vdim, const RawValue &nu, const RawValue &nv, const Abscissa &lower, const Abscissa &upper) const
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue > Self
Self type.
NumberTraits< Component >::UnsignedVersion UnsignedComponent
Unsigned version of the components.
Definition: PointVector.h:161
DGtal is the top-level namespace which contains all DGtal functions and types.
RawValue rawDistance(const Point &aP, const Point &aQ) const
bool hiddenBy(const Point &u, const Point &v, const Point &w, const Point &startingPoint, const Point &endPoint, const typename Point::UnsignedComponent dim) const
Closest closest(const Point &origin, const Point &first, const Point &second) const
TRawValue RawValue
Type for internal distance values.
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
Closest
Definition: Common.h:123