opensurgsim
Public Member Functions | List of all members
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 <LinearMotionArithmetic.h>

Public Member Functions

 LinearMotion ()
 Constructor.
 
 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...
 
getStart () const
 
getEnd () const
 
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)
 

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
Tunderlying data type over which the linear motion is defined.
See also
Interval<T>, and IntervalND<T, N>

Constructor & Destructor Documentation

§ LinearMotion() [1/3]

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

Constructor.

Parameters
startinitial value of the constructed linear motion
endfinal value of the constructed linear motion
Exceptions
ifmax is less than min

§ LinearMotion() [2/3]

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

Copy constructor.

Parameters
mInterval to be copied

§ LinearMotion() [3/3]

template<typename T >
SurgSim::Math::LinearMotion< T >::LinearMotion ( LinearMotion< T > &&  m)

Move constructor.

Parameters
mLinearMotion to be copied

Member Function Documentation

§ atTime()

template<typename T >
T SurgSim::Math::LinearMotion< T >::atTime ( const T &  t) const
Parameters
tthe 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
ithe linear motion to be tested
epsilonthe 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
mthe 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 >
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
ifany 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
mInterval to be copied

§ operator=() [2/2]

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

Move assignment operator.

Parameters
mInterval to be moved

§ operator==()

template<typename T >
bool SurgSim::Math::LinearMotion< T >::operator== ( const LinearMotion< T > &  m) const
Parameters
mthe 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

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