DGtal  0.9.3beta
Public Types | Public Member Functions | Private Member Functions
DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue > Class Template Reference

#include <DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h>

Inheritance diagram for DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >:
[legend]
Collaboration diagram for DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >:
[legend]

Public Types

typedef TSpace Space
 
typedef Space::Point Point
 
typedef Point::Coordinate Abscissa
 
typedef Space::Vector Vector
 
typedef TRawValue RawValue
 
typedef double Value
 
typedef ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue > Self
 

Public Member Functions

 ExactPredicateLpSeparableMetric ()
 
 ~ExactPredicateLpSeparableMetric ()
 
 ExactPredicateLpSeparableMetric (const Self &other)
 
Selfoperator= (const Self &other)
 
Value local (const Point &aP, const Vector &aDir) const
 
Value operator() (const Point &aP, const Point &aQ) const
 
Closest closest (const Point &origin, const Point &first, const Point &second) const
 
RawValue rawDistance (const Point &aP, const Point &aQ) 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
 

Private Member Functions

Abscissa binarySearchHidden (const Abscissa &udim, const Abscissa &vdim, const RawValue &nu, const RawValue &nv, const Abscissa &lower, const Abscissa &upper) const
 

Detailed Description

template<typename TSpace, typename TRawValue>
class DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >

Definition at line 267 of file ExactPredicateLpSeparableMetric.h.

Member Typedef Documentation

template<typename TSpace , typename TRawValue >
typedef Point::Coordinate DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::Abscissa

Type for points.

Definition at line 278 of file ExactPredicateLpSeparableMetric.h.

template<typename TSpace , typename TRawValue >
typedef Space::Point DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::Point

Type for points.

Definition at line 276 of file ExactPredicateLpSeparableMetric.h.

template<typename TSpace , typename TRawValue >
typedef TRawValue DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::RawValue

Type for internal distance values.

Definition at line 283 of file ExactPredicateLpSeparableMetric.h.

template<typename TSpace , typename TRawValue >
typedef ExactPredicateLpSeparableMetric<TSpace,2,TRawValue> DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::Self

Self type.

Definition at line 289 of file ExactPredicateLpSeparableMetric.h.

template<typename TSpace , typename TRawValue >
typedef TSpace DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::Space

Copy the space type.

Definition at line 274 of file ExactPredicateLpSeparableMetric.h.

template<typename TSpace , typename TRawValue >
typedef double DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::Value

Type for distance values.

Definition at line 286 of file ExactPredicateLpSeparableMetric.h.

template<typename TSpace , typename TRawValue >
typedef Space::Vector DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::Vector

Type for vectors.

Definition at line 280 of file ExactPredicateLpSeparableMetric.h.

Constructor & Destructor Documentation

template<typename TSpace , typename TRawValue >
DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::ExactPredicateLpSeparableMetric ( )

Constructor.

template<typename TSpace , typename TRawValue >
DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::~ExactPredicateLpSeparableMetric ( )

Destructor.

template<typename TSpace , typename TRawValue >
DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::ExactPredicateLpSeparableMetric ( const Self other)
inline

Copy constructor.

Parameters
otherthe object to clone (not used).

Definition at line 307 of file ExactPredicateLpSeparableMetric.h.

308  {
309  boost::ignore_unused_variable_warning( other );
310  }

Member Function Documentation

template<typename TSpace , typename TRawValue >
Abscissa DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::binarySearchHidden ( const Abscissa udim,
const Abscissa vdim,
const RawValue nu,
const RawValue nv,
const Abscissa lower,
const Abscissa upper 
) const
private

Perform a binary search on the interval [lower,upper] to detect the mid-point between u and v according to the l_p distance.

Parameters
udimcoordinate of u along dimension dim
vdimcoordinate of v along dimension dim
nupartial distance of u (sum of |xj-x_i|^p) discarding the term along the dimension dim
nvpartial distance of v (sum of |xj-x_i|^p) discarding the term along the dimension dim
lowerinterval lower bound
upperinterval upper bound
Returns
the Voronoi boundary point coordinates along dimension dim.
template<typename TSpace , typename TRawValue >
Closest DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::closest ( const Point origin,
const Point first,
const Point second 
) const

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.

Parameters
originthe origin
firstthe first point
secondthe second point
Returns
a Closest enum: FIRST, SECOND or BOTH.
template<typename TSpace , typename TRawValue >
bool DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::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 (a,b,c) and a straight segment [startingPoint,endPoint] along dimension dim, we detect if the voronoi cells of a and c hide the voronoi cell of c on the straight line.

Precondition
both voronoi cells associated with a and b must intersect the straight line.
Parameters
ua site
va site
wa site
startingPointstarting point of the segment
endPointend point of the segment
dimdirection of the straight line
Returns
true if (a,c) hides b.
template<typename TSpace , typename TRawValue >
bool DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TSpace , typename TRawValue >
Value DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::local ( const Point aP,
const Vector aDir 
) const

Compute the local distance between aP and its displacement along the direction aDir.

Parameters
aPa point.
aDira direction.
Returns
the distance between aP and aP+aDir.
template<typename TSpace , typename TRawValue >
Value DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::operator() ( const Point aP,
const Point aQ 
) const

Compute the distance between aP and aQ.

Parameters
aPa first point.
aQa second point.
Returns
the distance between aP and aQ.
template<typename TSpace , typename TRawValue >
Self& DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::operator= ( const Self other)
inline

Assignment.

Parameters
otherthe object to copy (unused).
Returns
a reference on 'this'.

Definition at line 317 of file ExactPredicateLpSeparableMetric.h.

318  {
319  boost::ignore_unused_variable_warning( other );
320  return *this;
321  }
template<typename TSpace , typename TRawValue >
RawValue DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::rawDistance ( const Point aP,
const Point aQ 
) const

Compute an exact representation of Lp distances. We just return the sum of powers without computing the last 1/p power. I.e. only \( \sum |p_i- q_i|^p\) is given.

Parameters
aPa first point
aQa second point
Returns
the power p of the l_p distance between aP and aQ.
template<typename TSpace , typename TRawValue >
void DGtal::ExactPredicateLpSeparableMetric< TSpace, 2, TRawValue >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

The documentation for this class was generated from the following file: