SurgSim::Math::LinearMotion< T > Class Template Reference

LinearMotion is (intentionally) a lot like Interval, but it deals with linear motion where all operands start and end their motion simultaneously. More...

`#include <SurgSim/Math/LinearMotionArithmetic.h>`

## Public Member Functions

| LinearMotion ()
| Constructor. More...
| LinearMotion (const T &start, const T &end)
| Constructor. More...
| LinearMotion (const LinearMotion< T > &m)
| Copy constructor. More...
| LinearMotion (LinearMotion< T > &&m)
| Move constructor. More...
LinearMotion< T > & | operator= (const LinearMotion< T > &m)
| Assignment operator. More...
LinearMotion< T > & | operator= (LinearMotion< T > &&m)
| Move assignment operator. More...
Interval< T > | toInterval () const
| Convert from LinearMotion to an Interval. More...
Polynomial< T, 1 > | toPolynomial () const
| Returns a linear expression (degree-1 polynomial) whose value for t=0..1 progresses from `start' to `end'. More...
bool | containsZero () const
bool | isApprox (const LinearMotion< T > &i, const T &epsilon) const
bool | operator== (const LinearMotion< T > &m) const
bool | operator!= (const LinearMotion< T > &m) const
Interval< T > | operator* (const LinearMotion< T > &m) const
| Standard arithmetic operators extended to interval groups. More...
Interval< T > | operator/ (const LinearMotion< T > &m) const
| Standard arithmetic operators extended to interval groups. More...
T | getStart () const
T | getEnd () const
T | atTime (const T &t) const
LinearMotion< T > | firstHalf () const
LinearMotion< T > | secondHalf () const
LinearMotion< T > | operator+ (const LinearMotion< T > &m) const
LinearMotion< T > & | operator+= (const LinearMotion< T > &m)
LinearMotion< T > | operator- (const LinearMotion< T > &m) const
LinearMotion< T > & | operator-= (const LinearMotion< T > &m)

## Private Attributes

T | m_start
| The start point of the linear motion. More...
T | m_end
| The end point of the linear motion. More...

## Detailed Description

### template<typename T>
class SurgSim::Math::LinearMotion< T >

LinearMotion is (intentionally) a lot like Interval, but it deals with linear motion where all operands start and end their motion simultaneously.

LinearMotion results in much tighter bounds compared to Interval, since Interval must consider any value of each operand, and LinearMotion only considers values that are synchronous with one another.

The bounds of a LinearMotion are a start value and an end value; there's no requirement that start <= end (or vice versa).

Many operations on LinearMotion arguments (*, /) return results that are not linear in time, so those operations will return Interval instead.

Template Parameters

  T | underlying data type over which the linear motion is defined.

See also
  Interval<T>, and IntervalND<T, N>

## Constructor & Destructor Documentation

## LinearMotion() [1/4]

template<typename T >

SurgSim::Math::LinearMotion< T >::LinearMotion | ( |  | ) |

Constructor.

## LinearMotion() [2/4]

template<typename T>

SurgSim::Math::LinearMotion< T >::LinearMotion | ( | const T & | start,
|  | const T & | end
| ) |  |

Constructor.

Parameters

  start | initial value of the constructed linear motion
  end | final value of the constructed linear motion

Exceptions

  if | max is less than min

## LinearMotion() [3/4]

template<typename T>

SurgSim::Math::LinearMotion< T >::LinearMotion | ( | const LinearMotion< T > & | m | ) |

Copy constructor.

Parameters

  m | Interval to be copied

## LinearMotion() [4/4]

template<typename T>

SurgSim::Math::LinearMotion< T >::LinearMotion | ( | LinearMotion< T > && | m | ) |

Move constructor.

Parameters

  m | LinearMotion to be copied

## Member Function Documentation

## atTime()

template<typename T>

T SurgSim::Math::LinearMotion< T >::atTime | ( | const T & | t | ) | const

Parameters

  t | the parametric time at which to evaluate the linear motion

Returns
  the value of the linear motion at parametric time t

## containsZero()

template<typename T >

bool SurgSim::Math::LinearMotion< T >::containsZero | ( |  | ) | const

Returns
  true if the linear motion crosses through 0.

## firstHalf()

template<typename T >

LinearMotion< T > SurgSim::Math::LinearMotion< T >::firstHalf | ( |  | ) | const

Returns
  the linear motion from the initial time to the midpoint

## getEnd()

template<typename T >

T SurgSim::Math::LinearMotion< T >::getEnd | ( |  | ) | const

Returns
  the end point of the linear motion

## getStart()

template<typename T >

T SurgSim::Math::LinearMotion< T >::getStart | ( |  | ) | const

Returns
  the initial value of the linear motion

## isApprox()

template<typename T>

bool SurgSim::Math::LinearMotion< T >::isApprox | ( | const LinearMotion< T > & | i,
|  | const T & | epsilon
| ) |  | const

Parameters

  i | the linear motion to be tested
  epsilon | the nearness parameter

Returns
  true if the current linear motion is within epsilon of the input linear motion

## operator!=()

template<typename T>

bool SurgSim::Math::LinearMotion< T >::operator!= | ( | const LinearMotion< T > & | m | ) | const

Parameters

  m | the linear motion to be tested

Returns
  true if the current linear motion is not identical to the input linear motion

## operator*()

template<typename T>

Interval< T > SurgSim::Math::LinearMotion< T >::operator* | ( | const LinearMotion< T > & | m | ) | const

Standard arithmetic operators extended to interval groups.

Note
  Multiplication and division operators by their nature do not preserve time ordering and so the return value is an IntervalND instead of a LinearMotionND

## operator+()

template<typename T>

LinearMotion< T > SurgSim::Math::LinearMotion< T >::operator+ | ( | const LinearMotion< T > & | m | ) | const

Standard arithmetic operators extended to linear motions

## operator+=()

template<typename T>

LinearMotion< T > & SurgSim::Math::LinearMotion< T >::operator+= | ( | const LinearMotion< T > & | m | ) |

Standard arithmetic operators extended to linear motions

## operator-()

template<typename T>

LinearMotion< T > SurgSim::Math::LinearMotion< T >::operator- | ( | const LinearMotion< T > & | m | ) | const

Standard arithmetic operators extended to linear motions

## operator-=()

template<typename T>

LinearMotion< T > & SurgSim::Math::LinearMotion< T >::operator-= | ( | const LinearMotion< T > & | m | ) |

Standard arithmetic operators extended to linear motions

## operator/()

template<typename T>

Interval< T > SurgSim::Math::LinearMotion< T >::operator/ | ( | const LinearMotion< T > & | m | ) | const

Standard arithmetic operators extended to interval groups.

Note
  Multiplication and division operators by their nature do not preserve time ordering and so the return value is an IntervalND instead of a LinearMotionND

Exceptions

  if | any component of interval includes 0

## operator=() [1/2]

template<typename T>

LinearMotion< T > & SurgSim::Math::LinearMotion< T >::operator= | ( | const LinearMotion< T > & | m | ) |

Assignment operator.

Parameters

  m | Interval to be copied

## operator=() [2/2]

template<typename T>

LinearMotion< T > & SurgSim::Math::LinearMotion< T >::operator= | ( | LinearMotion< T > && | m | ) |

Move assignment operator.

Parameters

  m | Interval to be moved

## operator==()

template<typename T>

bool SurgSim::Math::LinearMotion< T >::operator== | ( | const LinearMotion< T > & | m | ) | const

Parameters

  m | the linear motion to be tested

Returns
  true if the current linear motion is identical to the input linear motion

## secondHalf()

template<typename T >

LinearMotion< T > SurgSim::Math::LinearMotion< T >::secondHalf | ( |  | ) | const

Returns
  the linear motion from the midpoint to the endpoint

## toInterval()

template<typename T >

Interval< T > SurgSim::Math::LinearMotion< T >::toInterval | ( |  | ) | const

Convert from LinearMotion to an Interval.

Returns
  the conversion of the LinearMotion to an Interval

## toPolynomial()

template<typename T >

Polynomial< T, 1 > SurgSim::Math::LinearMotion< T >::toPolynomial | ( |  | ) | const

Returns a linear expression (degree-1 polynomial) whose value for t=0..1 progresses from `start' to `end'.

Returns
  the conversion of the LinearMotion to a polynomial

## Member Data Documentation

## m_end

template<typename T>

T SurgSim::Math::LinearMotion< T >::m_end

private

The end point of the linear motion.

## m_start

template<typename T>

T SurgSim::Math::LinearMotion< T >::m_start

private

The start point of the linear motion.

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

- SurgSim/Math/LinearMotionArithmetic.h
- SurgSim/Math/LinearMotionArithmetic-inl.h