DGtal  0.9.2
ExactPredicateLpPowerSeparableMetric.h
1 
17 #pragma once
18 
31 #if defined(ExactPredicateLpPowerSeparableMetric_RECURSES)
32 #error Recursive header files inclusion detected in ExactPredicateLpPowerSeparableMetric.h
33 #else // defined(ExactPredicateLpPowerSeparableMetric_RECURSES)
34 
35 #define ExactPredicateLpPowerSeparableMetric_RECURSES
36 
37 #if !defined ExactPredicateLpPowerSeparableMetric_h
38 
39 #define ExactPredicateLpPowerSeparableMetric_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 ExactPredicateLpPowerSeparableMetric
85  template <typename TSpace, DGtal::uint32_t p,
86  typename TPromoted=DGtal::int64_t>
88  {
89  // ----------------------- Standard services ------------------------------
90  public:
91 
92 
94  typedef TSpace Space;
96 
98  typedef typename Space::Point Point;
100  typedef typename Point::Coordinate Abscissa;
102  typedef typename Space::Vector Vector;
103 
105  typedef TPromoted Promoted;
106 
108  typedef TPromoted Weight;
110 
112  typedef TPromoted Value;
113 
118 
119 
124 
129 
135 
136  // ----------------------- Interface --------------------------------------
137  public:
138 
139  // ----------------------- CPowerMetric --------------------------------------
140 
141 
152  Weight powerDistance(const Point &aPoint,
153  const Point &aQ,
154  const Weight &aWq) const;
155 
156 
170  DGtal::Closest closestPower(const Point &origin,
171  const Point &first,
172  const Weight &wF,
173  const Point &second,
174  const Weight &wS) const;
175 
176  // ----------------------- CPowerSeparableMetric --------------------------------------
177 
202  bool hiddenByPower(const Point &u,
203  const Weight &wu,
204  const Point &v,
205  const Weight &wv,
206  const Point &w,
207  const Weight &ww,
208  const Point &startingPoint,
209  const Point &endPoint,
210  const typename Point::UnsignedComponent dim) const;
211 
212 
217  void selfDisplay ( std::ostream & out ) const;
218 
223  bool isValid() const;
224 
225  // ------------------------- Protected Datas ------------------------------
226  private:
227 
237  Promoted exactDistanceRepresentation(const Point &aP, const Point &aQ) const;
238 
255  Abscissa binarySearchHidden(const Abscissa &udim,
256  const Abscissa &vdim,
257  const Promoted &nu,
258  const Promoted &nv,
259  const Abscissa &lower,
260  const Abscissa &upper) const;
261 
262 
263  // ------------------------- Private Datas --------------------------------
264  private:
265 
266 
267  // ------------------------- Internals ------------------------------------
268  private:
269 
270  }; // end of class ExactPredicateLpPowerSeparableMetric
271 
272 
274 // L_2 specialization //
276 
277 
278  template <typename TSpace,
279  typename TPromoted>
280  class ExactPredicateLpPowerSeparableMetric<TSpace, 2, TPromoted>
281  {
282  // ----------------------- Standard services ------------------------------
283  public:
284 
286  typedef TSpace Space;
288  typedef typename Space::Point Point;
290  typedef typename Point::Coordinate Abscissa;
292  typedef typename Space::Vector Vector;
293 
295  typedef TPromoted Promoted;
296 
298  typedef TPromoted Weight;
299 
301  typedef TPromoted Value;
306 
307 
312 
313 
318 
324  { return *this;}
325 
326 
327  // ----------------------- Interface --------------------------------------
328  public:
329 
340  Weight powerDistance(const Point &aPoint,
341  const Point &aQ,
342  const Weight &aWq) const;
343 
344 
358  DGtal::Closest closestPower(const Point &origin,
359  const Point &first,
360  const Weight &wF,
361  const Point &second,
362  const Weight &wS) const;
363 
364 
375  Promoted exactDistanceRepresentation(const Point &aP, const Point &aQ) const;
376 
377  // ----------------------- CSeparableMetric --------------------------------------
399  bool hiddenByPower(const Point &u,
400  const Weight &wu,
401  const Point &v,
402  const Weight &wv,
403  const Point &w,
404  const Weight &ww,
405  const Point &startingPoint,
406  const Point &endPoint,
407  const typename Point::UnsignedComponent dim) const;
408 
409  // ----------------------- Other services --------------------------------------
414  void selfDisplay ( std::ostream & out ) const;
415 
420  bool isValid() const;
421 
422  // ------------------------- Protected Datas ------------------------------
423  private:
424 
425 
442  Abscissa binarySearchHidden(const Abscissa &udim,
443  const Abscissa &vdim,
444  const Promoted &nu,
445  const Promoted &nv,
446  const Abscissa &lower,
447  const Abscissa &upper) const;
448 
449 
450  // ------------------------- Private Datas --------------------------------
451  private:
452 
453  // ------------------------- Internals ------------------------------------
454  private:
455 
456  }; // end of class ExactPredicateLpPowerSeparableMetric
457 
464  template <typename T, DGtal::uint32_t p , typename P>
465  std::ostream&
466  operator<< ( std::ostream & out, const ExactPredicateLpPowerSeparableMetric<T,p,P> & object );
467 
468 } // namespace DGtal
469 
470 
472 // Includes inline functions.
473 #include "DGtal/geometry/volumes/distance/ExactPredicateLpPowerSeparableMetric.ih"
474 
475 // //
477 
478 #endif // !defined ExactPredicateLpPowerSeparableMetric_h
479 
480 #undef ExactPredicateLpPowerSeparableMetric_RECURSES
481 #endif // else defined(ExactPredicateLpPowerSeparableMetric_RECURSES)
Aim: implements weighted separable l_p metrics with exact predicates.
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
void selfDisplay(std::ostream &out) const
TPromoted Weight
Type for internal distance values.
Weight powerDistance(const Point &aPoint, const Point &aQ, const Weight &aWq) const
DGtal::Closest closestPower(const Point &origin, const Point &first, const Weight &wF, const Point &second, const Weight &wS) const
Component Coordinate
Type for Point elements.
Definition: PointVector.h:158
bool hiddenByPower(const Point &u, const Weight &wu, const Point &v, const Weight &wv, const Point &w, const Weight &ww, const Point &startingPoint, const Point &endPoint, const typename Point::UnsignedComponent dim) const
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
ExactPredicateLpPowerSeparableMetric(const ExactPredicateLpPowerSeparableMetric &)
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
Abscissa binarySearchHidden(const Abscissa &udim, const Abscissa &vdim, const Promoted &nu, const Promoted &nv, const Abscissa &lower, const Abscissa &upper) const
ExactPredicateLpPowerSeparableMetric & operator=(const ExactPredicateLpPowerSeparableMetric &)
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.
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
Promoted exactDistanceRepresentation(const Point &aP, const Point &aQ) const
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
TPromoted Promoted
Type for internal distance values.
Closest
Definition: Common.h:123