DGtal  1.4.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)
35 #define ExactPredicateLpPowerSeparableMetric_RECURSES
36 
37 #if !defined ExactPredicateLpPowerSeparableMetric_h
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 
153  const Point &aQ,
154  const Weight &aWq) const;
155 
156 
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 
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 
341  const Point &aQ,
342  const Weight &aWq) const;
343 
344 
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 
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)
Abscissa binarySearchHidden(const Abscissa &udim, const Abscissa &vdim, const Promoted &nu, const Promoted &nv, const Abscissa &lower, const Abscissa &upper) const
Weight powerDistance(const Point &aPoint, const Point &aQ, const Weight &aWq) const
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
DGtal::Closest closestPower(const Point &origin, const Point &first, const Weight &wF, const Point &second, const Weight &wS) const
Promoted exactDistanceRepresentation(const Point &aP, const Point &aQ) const
Aim: implements weighted separable l_p metrics with exact predicates.
TPromoted Promoted
Type for internal distance values.
ExactPredicateLpPowerSeparableMetric(const ExactPredicateLpPowerSeparableMetric &)
TPromoted Weight
Type for internal distance values.
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
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
Abscissa binarySearchHidden(const Abscissa &udim, const Abscissa &vdim, const Promoted &nu, const Promoted &nv, const Abscissa &lower, const Abscissa &upper) const
DGtal::Closest closestPower(const Point &origin, const Point &first, const Weight &wF, const Point &second, const Weight &wS) const
ExactPredicateLpPowerSeparableMetric & operator=(const ExactPredicateLpPowerSeparableMetric &)
void selfDisplay(std::ostream &out) const
BOOST_CONCEPT_ASSERT((concepts::CInteger< Promoted >))
Weight powerDistance(const Point &aPoint, const Point &aQ, const Weight &aWq) const
Promoted exactDistanceRepresentation(const Point &aP, const Point &aQ) const
Component Coordinate
Type for Point elements.
Definition: PointVector.h:617
NumberTraits< Component >::UnsignedVersion UnsignedComponent
Unsigned version of the components.
Definition: PointVector.h:620
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
Closest
Definition: Common.h:146
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:106
const Point aPoint(3, 4)
unsigned int dim(const Vector &z)
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)