RobWorkProject  24.5.15-
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LineMetric Class Reference

A metric for calculating line-to-line distance. More...

#include <Line.hpp>

Inherits Metric< rw::geometry::Line >.

Public Member Functions

 LineMetric (double angToDistWeight=1.0)
 Construct new metric. More...
 
- Public Member Functions inherited from Metric< rw::geometry::Line >
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

double doDistance (const Line &l) const
 Calculates distance from the line to Z axis.
 
double doDistance (const Line &a, const Line &b) const
 Calculates distance between two lines. More...
 
int doSize () const
 Subclass implementation of the size() method. More...
 
- Protected Member Functions inherited from Metric< rw::geometry::Line >
 Metric ()
 Protected constructor called by subclassed.
 
 Metric (const Metric &)
 Disable copying of superclass.
 
Metricoperator= (const Metric &)
 Disable assignment of superclass.
 

Protected Attributes

double _angToDistWeight
 The weighting of the angle to the distance.
 

Additional Inherited Members

- Public Types inherited from Metric< rw::geometry::Line >
typedef rw::geometry::Line 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< rw::geometry::Line > > Ptr
 A pointer to a Metric<T>.
 
typedef rw::core::Ptr< const Metric< rw::geometry::Line > > CPtr
 A pointer to a const Metric<T>.
 

Detailed Description

A metric for calculating line-to-line distance.

Constructor & Destructor Documentation

◆ LineMetric()

LineMetric ( double  angToDistWeight = 1.0)
inline

Construct new metric.

Parameters
angToDistWeight[in] (optional) weighting of the angle to distance. Default is 1.

Member Function Documentation

◆ doDistance()

double doDistance ( const Line a,
const Line b 
) const
inlineprotectedvirtual

Calculates distance between two lines.

The distance is calculated according to formula:

val = 0.5*angle(l1.dir, l2.dir)*angToDistWeight + 0.5*distance(l1, l2)

Implements Metric< rw::geometry::Line >.

◆ doSize()

int doSize ( ) const
inlineprotectedvirtual

Subclass implementation of the size() method.

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

Reimplemented from Metric< rw::geometry::Line >.


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