DGtal  0.9.4.1
InexactPredicateLpSeparableMetric.h
1 
17 #pragma once
18 
31 #if defined(InexactPredicateLpSeparableMetric_RECURSES)
32 #error Recursive header files inclusion detected in InexactPredicateLpSeparableMetric.h
33 #else // defined(InexactPredicateLpSeparableMetric_RECURSES)
34 
35 #define InexactPredicateLpSeparableMetric_RECURSES
36 
37 #if !defined InexactPredicateLpSeparableMetric_h
38 
39 #define InexactPredicateLpSeparableMetric_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <cmath>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/kernel/CSpace.h"
47 #include "DGtal/kernel/CEuclideanRing.h"
49 
50 namespace DGtal
51 {
52 
54 // template class InexactPredicateLpSeparableMetric
80  template <typename TSpace, typename TValue = double>
82  {
83  // ----------------------- Standard services ------------------------------
84  public:
85 
87  typedef TSpace Space;
88 
91 
93  typedef typename Space::Point Point;
95  typedef typename Point::Coordinate Abscissa;
97  typedef typename Space::Vector Vector;
99  typedef TValue Value;
101  typedef TValue RawValue;
102 
106  InexactPredicateLpSeparableMetric( const double anExponent );
107 
108 
113 
119  {
120  myExponent = other.myExponent;
121  }
122 
129  {
130  myExponent = other.myExponent;
131  return *this;
132  }
133 
134  // ----------------------- Interface --------------------------------------
135  public:
136 
137  // ----------------------- CMetric --------------------------------------
146  Value operator()(const Point & aP, const Point &aQ) const;
147 
156  RawValue rawDistance(const Point & aP, const Point &aQ) const;
157 
169  Closest closest(const Point &origin,
170  const Point &first,
171  const Point &second) const;
172 
173  // ----------------------- CSeparableMetric --------------------------------------
194  bool hiddenBy(const Point &u,
195  const Point &v,
196  const Point &w,
197  const Point &startingPoint,
198  const Point &endPoint,
199  const typename Point::UnsignedComponent dim) const;
200 
201 
206  void selfDisplay ( std::ostream & out ) const;
207 
212  bool isValid() const;
213 
214  // ------------------------- Protected Datas ------------------------------
215  private:
216 
226  Value distanceLp(const Point &aP, const Point &aQ) const;
227 
228 
249  const Abscissa &vdim,
250  const Value &nu,
251  const Value &nv,
252  const Abscissa &lower,
253  const Abscissa &upper) const;
254 
255 
256  // ------------------------- Private Datas --------------------------------
257  private:
258 
261 
262  }; // end of class InexactPredicateLpSeparableMetric
263 
270  template <typename T, typename V>
271  std::ostream&
272  operator<< ( std::ostream & out, const InexactPredicateLpSeparableMetric<T,V> & object );
273 
274 } // namespace DGtal
275 
276 
278 // Includes inline functions.
279 #include "DGtal/geometry/volumes/distance/InexactPredicateLpSeparableMetric.ih"
280 
281 // //
283 
284 #endif // !defined InexactPredicateLpSeparableMetric_h
285 
286 #undef InexactPredicateLpSeparableMetric_RECURSES
287 #endif // else defined(InexactPredicateLpSeparableMetric_RECURSES)
Value operator()(const Point &aP, const Point &aQ) const
Component Coordinate
Type for Point elements.
Definition: PointVector.h:158
Aim: implements separable l_p metrics with approximated predicates.
Vector lower(const Vector &z, unsigned int k)
Abscissa binarySearchHidden(const Abscissa &udim, const Abscissa &vdim, const Value &nu, const Value &nv, const Abscissa &lower, const Abscissa &upper) const
Value distanceLp(const Point &aP, const Point &aQ) const
InexactPredicateLpSeparableMetric(const double anExponent)
Aim: Defines the mathematical concept equivalent to a unitary commutative ring with a division operat...
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
void selfDisplay(std::ostream &out) const
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
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.
MyPointD Point
Definition: testClone2.cpp:383
unsigned int dim(const Vector &z)
Closest closest(const Point &origin, const Point &first, const Point &second) const
RawValue rawDistance(const Point &aP, const Point &aQ) const
InexactPredicateLpSeparableMetric & operator=(const InexactPredicateLpSeparableMetric &other)
Vector upper(const Vector &z, unsigned int k)
bool hiddenBy(const Point &u, const Point &v, const Point &w, const Point &startingPoint, const Point &endPoint, const typename Point::UnsignedComponent dim) const
InexactPredicateLpSeparableMetric(const InexactPredicateLpSeparableMetric &other)
Closest
Definition: Common.h:130