RobWorkProject
24.8.23-
|
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::core::Ptr< Metric< T > > | Ptr |
A pointer to a Metric<T>. | |
typedef rw::core::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. | |
Metric & | operator= (const Metric &) |
Disable assignment of superclass. | |
Template interface for metrics on type T.
A metric is a function that defines a scalar distance between elements.
|
inline |
The distance from element a to b.
a | [in] first element |
b | [in] second element |
|
inlineprotectedvirtual |
Subclass implementation of the size() method.
By default the methods returns -1, i.e. valid for all elements.
Reimplemented in WeightedInfinityMetric< T >, WeightedEuclideanMetric< T >, WeightedManhattanMetric< T >, PlaneMetric, and LineMetric.
|
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.