DGtal 1.4.0
|
Aim: Adapts any model of CMetric to construct a separable metric (model of CSeparableMetric). More...
#include <DGtal/geometry/volumes/distance/SeparableMetricAdapter.h>
Public Types | |
typedef TMetric | Metric |
Copy the space type. | |
typedef Metric::Point | Point |
Type for points. | |
typedef Point::Coordinate | Abscissa |
Type for point abscissa. | |
typedef Metric::Value | Value |
Type for values. | |
typedef Metric::RawValue | RawValue |
Type for raw values. | |
typedef Metric::Vector | Vector |
Type for vectors. | |
typedef Metric::Space | Space |
Type for Space. | |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CMetricSpace< TMetric >)) | |
SeparableMetricAdapter (ConstAlias< Metric > aMetric) | |
~SeparableMetricAdapter () | |
SeparableMetricAdapter (const SeparableMetricAdapter &other) | |
SeparableMetricAdapter & | operator= (const SeparableMetricAdapter &other) |
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 |
bool | hiddenBy (const Point &u, const Point &v, const Point &w, const Point &startingPoint, const Point &endPoint, const typename Point::UnsignedComponent dim) const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Abscissa | binarySearchHidden (const Point &u, const Point &v, const typename Point::UnsignedComponent dim, const Point &lower, const Point &upper) const |
Private Attributes | |
const Metric * | myMetric |
Aim: Adapts any model of CMetric to construct a separable metric (model of CSeparableMetric).
Description of template class 'SeparableMetricAdapter'
The adapted metric can thus be used in separable algorithms such as VoronoiMap or PowerMap. The adapted metric makes sense only if the input metric as the monotinicity propertery (see [62] or ␓[85]): In dimension 2, consider two points \( p(x,y)\), \(q(x',y')\) with \(x<x'\). Let \(r( x'',0)\) be a point on the x-axis such that \(d(p,r) = d(q,r)\) and \( s(u,0)\) be another point on the x-axis. A metric \( d\) is monotonic if
\[ u < x'' \implies d(p,s) \leq d(q,s) \]
and
\[ u > x'' \implies d(p,s) \geq d(q,s) \]
If the metric distance evaluation is in \(O(m)\), the hiddenBy() method is in \(O(m\log n)\).
TMetric | the type of input metric (model of CMetric) |
Definition at line 79 of file SeparableMetricAdapter.h.
typedef Point::Coordinate DGtal::SeparableMetricAdapter< TMetric >::Abscissa |
Type for point abscissa.
Definition at line 92 of file SeparableMetricAdapter.h.
typedef TMetric DGtal::SeparableMetricAdapter< TMetric >::Metric |
Copy the space type.
Definition at line 86 of file SeparableMetricAdapter.h.
typedef Metric::Point DGtal::SeparableMetricAdapter< TMetric >::Point |
Type for points.
Definition at line 90 of file SeparableMetricAdapter.h.
typedef Metric::RawValue DGtal::SeparableMetricAdapter< TMetric >::RawValue |
Type for raw values.
Definition at line 96 of file SeparableMetricAdapter.h.
typedef Metric::Space DGtal::SeparableMetricAdapter< TMetric >::Space |
Type for Space.
Definition at line 100 of file SeparableMetricAdapter.h.
typedef Metric::Value DGtal::SeparableMetricAdapter< TMetric >::Value |
Type for values.
Definition at line 94 of file SeparableMetricAdapter.h.
typedef Metric::Vector DGtal::SeparableMetricAdapter< TMetric >::Vector |
Type for vectors.
Definition at line 98 of file SeparableMetricAdapter.h.
|
inline |
Constructor from a CMetric model instance. The metric is aliased in this class.
[in] | aMetric | any model of CMetric which is monotonic. |
Definition at line 108 of file SeparableMetricAdapter.h.
|
inline |
|
inline |
Copy constructor. (CopyConstruticle concept)
other | the object to clone. |
Definition at line 120 of file SeparableMetricAdapter.h.
Abscissa DGtal::SeparableMetricAdapter< TMetric >::binarySearchHidden | ( | const Point & | u, |
const Point & | v, | ||
const typename Point::UnsignedComponent | dim, | ||
const Point & | lower, | ||
const Point & | upper ) const |
Perform a binary search on the interval [lower,upper] to detect the mid-point between u and v .
u | a point |
v | a point |
dim | direction of the straight line |
lower | starting point of the segment |
upper | end point of the segment |
DGtal::SeparableMetricAdapter< TMetric >::BOOST_CONCEPT_ASSERT | ( | (concepts::CMetricSpace< TMetric >) | ) |
|
inline |
Given an origin and two points, this method decides which one is closest to the origin. This method should be faster than comparing distance values.
origin | the origin |
first | the first point |
second | the second point |
Definition at line 173 of file SeparableMetricAdapter.h.
References DGtal::SeparableMetricAdapter< TMetric >::myMetric.
bool DGtal::SeparableMetricAdapter< TMetric >::hiddenBy | ( | const Point & | u, |
const Point & | v, | ||
const Point & | w, | ||
const Point & | startingPoint, | ||
const Point & | endPoint, | ||
const typename Point::UnsignedComponent | dim ) const |
Given three sites (u,v,w) and a straight segment [startingPoint,endPoint] along dimension dim, we detect if the voronoi cells of u and w strictly hide the voronoi cell of v on the straight line.
If operator()(p,q) of the underlying metric is in \( O(m)\), the cost of this method is \( O(mlog(n))\) (b being the number of points in [startingPoint,endPoint]).
u | a site |
v | a site |
w | a site |
startingPoint | starting point of the segment |
endPoint | end point of the segment |
dim | direction of the straight line |
|
inline |
Checks the validity/consistency of the object.
Definition at line 219 of file SeparableMetricAdapter.h.
References DGtal::SeparableMetricAdapter< TMetric >::myMetric.
|
inline |
Compute the distance between aP and aQ.
aP | a first point. |
aQ | a second point. |
Definition at line 145 of file SeparableMetricAdapter.h.
References DGtal::SeparableMetricAdapter< TMetric >::myMetric.
|
inline |
Assignment. (Assignable concept)
other | the object to copy. |
Definition at line 127 of file SeparableMetricAdapter.h.
References DGtal::SeparableMetricAdapter< TMetric >::myMetric.
|
inline |
Compute the raw distance between aP and aQ.
aP | a first point. |
aQ | a second point. |
Definition at line 158 of file SeparableMetricAdapter.h.
References DGtal::SeparableMetricAdapter< TMetric >::myMetric.
void DGtal::SeparableMetricAdapter< TMetric >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
private |
Definition at line 250 of file SeparableMetricAdapter.h.
Referenced by DGtal::SeparableMetricAdapter< TMetric >::closest(), DGtal::SeparableMetricAdapter< TMetric >::isValid(), DGtal::SeparableMetricAdapter< TMetric >::operator()(), DGtal::SeparableMetricAdapter< TMetric >::operator=(), and DGtal::SeparableMetricAdapter< TMetric >::rawDistance().