DGtal  1.2.0
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)
35 #define ExactPredicateLpSeparableMetric_RECURSES
36 
37 #if !defined ExactPredicateLpSeparableMetric_h
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  {
89  // ----------------------- Standard services ------------------------------
90  public:
92  typedef TSpace Space;
94 
96  typedef typename Space::Point Point;
98  typedef typename Point::Coordinate Abscissa;
100  typedef typename Space::Vector Vector;
101 
103  typedef TRawValue RawValue;
105 
107  typedef double Value;
108 
111 
116 
117 
122 
128  {
129  boost::ignore_unused_variable_warning( other );
130  }
131 
137  Self & operator= ( const Self & other )
138  {
139  boost::ignore_unused_variable_warning( other );
140  return *this;
141  }
142 
143  // ----------------------- Interface --------------------------------------
144  public:
145 
146  // ----------------------- CMetricSpace --------------------------------------
155  Value operator()(const Point & aP, const Point &aQ) const;
156 
168  Closest closest(const Point &origin,
169  const Point &first,
170  const Point &second) const;
171 
180  RawValue rawDistance(const Point & aP, const Point &aQ) const;
181 
182  // ----------------------- CSeparableMetric --------------------------------------
204  bool hiddenBy(const Point &u,
205  const Point &v,
206  const Point &w,
207  const Point &startingPoint,
208  const Point &endPoint,
209  const typename Point::UnsignedComponent dim) const;
210 
211 
216  void selfDisplay ( std::ostream & out ) const;
217 
222  bool isValid() const;
223 
224 
245  const Abscissa &vdim,
246  const RawValue &nu,
247  const RawValue &nv,
248  const Abscissa &lower,
249  const Abscissa &upper) const;
250 
251  }; // end of class ExactPredicateLpSeparableMetric
252 
253 
255 // L_2 specialization //
257 
258 
259  template <typename TSpace,
260  typename TRawValue>
261  class ExactPredicateLpSeparableMetric<TSpace, 2, TRawValue>
262  {
263  // ----------------------- Standard services ------------------------------
264  public:
265 
267  typedef TSpace Space;
269  typedef typename Space::Point Point;
271  typedef typename Point::Coordinate Abscissa;
273  typedef typename Space::Vector Vector;
274 
276  typedef TRawValue RawValue;
277 
279  typedef double Value;
280 
283 
288 
289 
294 
295 
301  {
302  boost::ignore_unused_variable_warning( other );
303  }
304 
310  Self & operator= ( const Self & other )
311  {
312  boost::ignore_unused_variable_warning( other );
313  return *this;
314  }
315 
316 
317  // ----------------------- Interface --------------------------------------
318  public:
319 
320  // ----------------------- CLocalMetric --------------------------------------
330  Value local(const Point & aP, const Vector &aDir) const;
331 
332 
333  // ----------------------- CMetric --------------------------------------
342  Value operator()(const Point & aP, const Point &aQ) const;
343 
355  Closest closest(const Point &origin,
356  const Point &first,
357  const Point &second) const;
358 
359 
370  RawValue rawDistance(const Point &aP, const Point &aQ) const;
371 
372  // ----------------------- CSeparableMetric --------------------------------------
391  bool hiddenBy(const Point &u,
392  const Point &v,
393  const Point &w,
394  const Point &startingPoint,
395  const Point &endPoint,
396  const typename Point::UnsignedComponent dim) const;
397 
398  // ----------------------- Other services --------------------------------------
403  void selfDisplay ( std::ostream & out ) const;
404 
409  bool isValid() const;
410 
411  // ------------------------- Protected Datas ------------------------------
412  private:
413 
414 
432  const Abscissa &vdim,
433  const RawValue &nu,
434  const RawValue &nv,
435  const Abscissa &lower,
436  const Abscissa &upper) const;
437 
438 
439  }; // end of class ExactPredicateLpSeparableMetric
440 
447  template <typename T, DGtal::uint32_t p, typename P>
448  std::ostream&
449  operator<< ( std::ostream & out, const ExactPredicateLpSeparableMetric<T,p,P> & object );
450 
451 } // namespace DGtal
452 
453 
455 // Includes inline functions.
456 #include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.ih"
457 
458 // //
460 
461 #endif // !defined ExactPredicateLpSeparableMetric_h
462 
463 #undef ExactPredicateLpSeparableMetric_RECURSES
464 #endif // else defined(ExactPredicateLpSeparableMetric_RECURSES)
bool hiddenBy(const Point &u, const Point &v, const Point &w, const Point &startingPoint, const Point &endPoint, const typename Point::UnsignedComponent dim) const
Value local(const Point &aP, const Vector &aDir) const
ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue > Self
Self type.
Abscissa binarySearchHidden(const Abscissa &udim, const Abscissa &vdim, const RawValue &nu, const RawValue &nv, const Abscissa &lower, const Abscissa &upper) const
Value operator()(const Point &aP, const Point &aQ) const
RawValue rawDistance(const Point &aP, const Point &aQ) const
Closest closest(const Point &origin, const Point &first, const Point &second) const
Aim: implements separable l_p metrics with exact predicates.
BOOST_CONCEPT_ASSERT((concepts::CInteger< RawValue >))
Closest closest(const Point &origin, const Point &first, const Point &second) const
Abscissa binarySearchHidden(const Abscissa &udim, const Abscissa &vdim, const RawValue &nu, const RawValue &nv, const Abscissa &lower, const Abscissa &upper) const
bool hiddenBy(const Point &u, const Point &v, const Point &w, const Point &startingPoint, const Point &endPoint, const typename Point::UnsignedComponent dim) const
RawValue rawDistance(const Point &aP, const Point &aQ) const
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
TRawValue RawValue
Type for internal distance values.
void selfDisplay(std::ostream &out) const
Value operator()(const Point &aP, const Point &aQ) const
ExactPredicateLpSeparableMetric< TSpace, p, RawValue > Self
Self type.
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:147
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &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
unsigned int dim(const Vector &z)
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)