RobWorkProject  24.5.15-
LinearInterpolator< T > Class Template Reference

Make a linear interpolation between to position. More...

#include <LinearInterpolator.hpp>

Inherits Interpolator< T >.

## Public Types

typedef rw::core::Ptr< LinearInterpolatorPtr
smart pointer type to instance of class

typedef rw::core::Ptr< const LinearInterpolatorCPtr
smart pointer type const instance of class

Public Types inherited from Interpolator< T >
typedef rw::core::Ptr< InterpolatorPtr
smart pointer type to this class

## Public Member Functions

LinearInterpolator (const T &start, const T &end, double duration)
Construct LinearInterpolator starting a start and finishing in end and taking duration time. More...

x (double t) const
Position at time t. More...

dx (double t) const
Velocity at time t. More...

ddx (double t) const
Acceleration at time t. More...

getStart () const
Returns the start position of the interpolator. More...

getEnd () const
Returns the end position of the interpolator. More...

double duration () const
Returns the duration of the interpolator. More...

Public Member Functions inherited from Interpolator< T >
virtual ~Interpolator ()
Virtual destructor.

## Detailed Description

### template<class T> class rw::trajectory::LinearInterpolator< T >

Make a linear interpolation between to position.

Given a start $$\mathbf{s}$$, end $$\mathbf{e}$$ and duration $$d$$ the interpolation is implemented as $$\mathbf{x}(t)=\mathbf{s} + (\mathbf{e}-\mathbf{s})*t/d$$.

The template argument given needs to support addition with the "+" operator and scaling with a double using the "*" operator.

For use with a rw::math::Transform3D see the template specialization

## ◆ LinearInterpolator()

 LinearInterpolator ( const T & start, const T & end, double duration )
inline

Construct LinearInterpolator starting a start and finishing in end and taking duration time.

If duration <= 0 an exception is thrown

Parameters
 start [in] Start of interpolator end [in] End of interpolator duration [in] Time it takes to from one end to the other.

## ◆ ddx()

 T ddx ( double t ) const
inlinevirtual

Acceleration at time t.

Parameters
 t [in] time between 0 and length
Returns
Acceleration

Implements Interpolator< T >.

## ◆ duration()

 double duration ( ) const
inlinevirtual

Returns the duration of the interpolator.

The duration is defined as the time it takes to move from one end of the interpolator to the other.

Returns
duration

Implements Interpolator< T >.

## ◆ dx()

 T dx ( double t ) const
inlinevirtual

Velocity at time t.

Parameters
 t [in] time between 0 and length
Returns
Velocity

Implements Interpolator< T >.

## ◆ getEnd()

 T getEnd ( ) const
inline

Returns the end position of the interpolator.

Returns
The end position of the interpolator

## ◆ getStart()

 T getStart ( ) const
inline

Returns the start position of the interpolator.

Returns
The start position of the interpolator

## ◆ x()

 T x ( double t ) const
inlinevirtual

Position at time t.

Parameters
 t [in] time between 0 and length
Returns
Position

Implements Interpolator< T >.

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