RobWorkProject
Public Types | Public Member Functions | Protected Member Functions | List of all members
Metric< T > Class Template Referenceabstract

Template interface for metrics on type T. More...

#include <Metric.hpp>

Inherited by EuclideanMetric< T >, InfinityMetric< T >, MahalanobisMetric< T >, ManhattanMetric< T >, WeightedEuclideanMetric< T >, WeightedInfinityMetric< T >, and WeightedManhattanMetric< T >.

Public Types

typedef T value_type
 The type of element on which the metric operates.
 
typedef T::value_type scalar_type
 The type of the scalar.
 
typedef rw::common::Ptr< Metric< T > > Ptr
 A pointer to a Metric<T>.
 
typedef rw::common::Ptr< const Metric< T > > CPtr
 A pointer to a const Metric<T>.
 

Public Member Functions

virtual ~Metric ()
 Destructor.
 
scalar_type distance (const value_type &q) const
 The distance from the zero element to q.
 
scalar_type distance (const value_type &a, const value_type &b) const
 The distance from element a to b. More...
 
int size () const
 The dimension of elements on which this metric operates. More...
 

Protected Member Functions

virtual scalar_type doDistance (const value_type &q) const =0
 Subclass implementation of the distance() method.
 
virtual scalar_type doDistance (const value_type &a, const value_type &b) const =0
 Subclass implementation of the distance() method.
 
virtual int doSize () const
 Subclass implementation of the size() method. More...
 
 Metric ()
 Protected constructor called by subclassed.
 
 Metric (const Metric &)
 Disable copying of superclass.
 
Metricoperator= (const Metric &)
 Disable assignment of superclass.
 

Detailed Description

template<class T>
class rw::math::Metric< T >

Template interface for metrics on type T.

A metric is a function that defines a scalar distance between elements.

Member Function Documentation

◆ distance()

scalar_type distance ( const value_type a,
const value_type b 
) const
inline

The distance from element a to b.

Parameters
a[in] first element
b[in] second element
Returns
the distance

◆ doSize()

virtual int doSize ( ) const
inlineprotectedvirtual

Subclass implementation of the size() method.

By default the methods returns -1, i.e. valid for all elements.

Reimplemented in PlaneMetric, WeightedInfinityMetric< T >, LineMetric, WeightedEuclideanMetric< T >, and WeightedManhattanMetric< T >.

◆ size()

int size ( ) const
inline

The dimension of elements on which this metric operates.

The returns -1 if the elements don't have a measure of dimension or if the metric works for elements of all dimensions.


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