SurgSim::Math::IntervalND< T, 3 > Class Template Reference

IntervalND<T,3> defines the concept of a group of mathematical intervals specialized to 3 intervals and provides operations on them including arithmetic operations, construction, and IO. More...

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

## Public Member Functions

| IntervalND ()
| Constructor. More...
| IntervalND (const std::array< Interval< T >, 3 > &x)
| Constructor. More...
| IntervalND (const Interval< T > &x, const Interval< T > &y, const Interval< T > &z)
| Constructor. More...
| IntervalND (const IntervalND< T, 3 > &i)
| Copy constructor. More...
| IntervalND (IntervalND< T, 3 > &&i)
| Move constructor. More...
| IntervalND (const std::array< T, 3 > &a, const std::array< T, 3 > &b)
| Constructor. More...
IntervalND< T, 3 > & | operator= (const IntervalND< T, 3 > &i)
| Assignment operator. More...
IntervalND< T, 3 > & | operator= (IntervalND< T, 3 > &&i)
| Move assignment operator. More...
bool | overlapsWith (const IntervalND< T, 3 > &interval) const
bool | isApprox (const IntervalND< T, 3 > &interval, const T &epsilon) const
bool | operator== (const IntervalND< T, 3 > &i) const
bool | operator!= (const IntervalND< T, 3 > &i) const
IntervalND< T, 3 > & | addThickness (const T &thickness)
| Widens every interval in the current interval group by thickness on both sides. More...
IntervalND< T, 3 > | inverse () const
IntervalND< T, 3 > | operator/ (const IntervalND< T, 3 > &i) const
IntervalND< T, 3 > & | operator/= (const IntervalND< T, 3 > &i)
Interval< T > | dotProduct (const IntervalND< T, 3 > &i) const
IntervalND< T, 3 > | crossProduct (const IntervalND< T, 3 > &i) const
Interval< T > | magnitudeSquared () const
Interval< T > | magnitude () const
const Interval< T > & | getAxis (size_t i) const
IntervalND< T, 3 > | operator+ (const IntervalND< T, 3 > &i) const
IntervalND< T, 3 > & | operator+= (const IntervalND< T, 3 > &i)
IntervalND< T, 3 > | operator- (const IntervalND< T, 3 > &i) const
IntervalND< T, 3 > & | operator-= (const IntervalND< T, 3 > &i)
IntervalND< T, 3 > | operator* (const IntervalND< T, 3 > &i) const
IntervalND< T, 3 > & | operator*= (const IntervalND< T, 3 > &i)

## Private Attributes

std::array< Interval< T >, 3 > | m_interval
| The 3 dimensional group of intervals. More...

## Friends

template<class P >
void | IntervalArithmetic_add (const IntervalND< P, 3 > &a, const IntervalND< P, 3 > &b, IntervalND< P, 3 > *res)
| Calculate the sum of two interval groups. More...
template<class P >
void | IntervalArithmetic_sub (const IntervalND< P, 3 > &a, const IntervalND< P, 3 > &b, IntervalND< P, 3 > *res)
| Calculate the difference of two interval groups. More...
template<class P >
void | IntervalArithmetic_crossProduct (const IntervalND< P, 3 > &a, const IntervalND< P, 3 > &b, IntervalND< P, 3 > *res)
| Calculate the cross product of two interval groups. More...
template<class P >
void | IntervalArithmetic_dotProduct (const IntervalND< P, 3 > &a, const IntervalND< P, 3 > &b, Interval< P > *res)
| Calculate the dot product of two interval groups. More...

## Detailed Description

### template<class T>
class SurgSim::Math::IntervalND< T, 3 >

IntervalND<T,3> defines the concept of a group of mathematical intervals specialized to 3 intervals and provides operations on them including arithmetic operations, construction, and IO.

Template Parameters

  T | underlying data type over which the interval is defined.

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

## Constructor & Destructor Documentation

## IntervalND() [1/6]

template<class T >

SurgSim::Math::IntervalND< T, 3 >::IntervalND | ( |  | ) |

Constructor.

## IntervalND() [2/6]

template<class T >

SurgSim::Math::IntervalND< T, 3 >::IntervalND | ( | const std::array< Interval< T >, 3 > & | x | ) |

explicit

Constructor.

Parameters

  x | array of 3 intervals to be copied into the group

## IntervalND() [3/6]

template<class T >

SurgSim::Math::IntervalND< T, 3 >::IntervalND | ( | const Interval< T > & | x,
|  | const Interval< T > & | y,
|  | const Interval< T > & | z
| ) |  |

Constructor.

Parameters

  x | first interval to be added to the 3 group
  y | second interval to be added to the 3 group
  z | third interval to be added to the 3 group

## IntervalND() [4/6]

template<class T >

SurgSim::Math::IntervalND< T, 3 >::IntervalND | ( | const IntervalND< T, 3 > & | i | ) |

Copy constructor.

Parameters

  i | interval 3 group to copied

## IntervalND() [5/6]

template<class T >

SurgSim::Math::IntervalND< T, 3 >::IntervalND | ( | IntervalND< T, 3 > && | i | ) |

Move constructor.

Parameters

  i | Interval to be copied

## IntervalND() [6/6]

template<class T >

SurgSim::Math::IntervalND< T, 3 >::IntervalND | ( | const std::array< T, 3 > & | a,
|  | const std::array< T, 3 > & | b
| ) |  |

Constructor.

Parameters

  a | array of 3 values to be used as the respective minimums for the interval entries.
  b | array of 3 values to be used as the respective maximums for the interval entries.

## Member Function Documentation

## addThickness()

template<class T >

IntervalND< T, 3 > & SurgSim::Math::IntervalND< T, 3 >::addThickness | ( | const T & | thickness | ) |

Widens every interval in the current interval group by thickness on both sides.

Parameters

  thickness | the amount to widen on both sides

Returns
  the current interval group after modification

## crossProduct()

template<class T >

IntervalND< T, 3 > SurgSim::Math::IntervalND< T, 3 >::crossProduct | ( | const IntervalND< T, 3 > & | i | ) | const

Parameters

  i | the input interval group

Returns
  the interval cross product of the current 3 group and interval

## dotProduct()

template<class T >

Interval< T > SurgSim::Math::IntervalND< T, 3 >::dotProduct | ( | const IntervalND< T, 3 > & | i | ) | const

Parameters

  i | the input interval group

Returns
  the interval dot product of the current 3 group and interval

## getAxis()

template<class T >

const Interval< T > & SurgSim::Math::IntervalND< T, 3 >::getAxis | ( | size_t | i | ) | const

Parameters

  i | the selector for the interval to be returned

Returns
  the ith interval in the current 3 group

## inverse()

template<class T >

IntervalND< T, 3 > SurgSim::Math::IntervalND< T, 3 >::inverse | ( |  | ) | const

Returns
  the inverse of each interval in the 3 interval group

Exceptions

  if | any interval includes 0

## isApprox()

template<class T >

bool SurgSim::Math::IntervalND< T, 3 >::isApprox | ( | const IntervalND< T, 3 > & | interval,
|  | const T & | epsilon
| ) |  | const

Parameters

  interval | the interval group to be tested
  epsilon | the nearness parameter

Returns
  true if each interval in the input group is approximately equal to its correspondent element in interval.

## magnitude()

template<class T >

Interval< T > SurgSim::Math::IntervalND< T, 3 >::magnitude | ( |  | ) | const

Returns
  the interval magnitude for the current 3 group

## magnitudeSquared()

template<class T >

Interval< T > SurgSim::Math::IntervalND< T, 3 >::magnitudeSquared | ( |  | ) | const

Returns
  the square of the interval magnitude for the current 3 group

## operator!=()

template<class T >

bool SurgSim::Math::IntervalND< T, 3 >::operator!= | ( | const IntervalND< T, 3 > & | i | ) | const

Parameters

  i | the interval group to be tested

Returns
  true if the current interval 3 group is not identical to the input 3 group i

## operator*()

template<class T >

IntervalND< T, 3 > SurgSim::Math::IntervalND< T, 3 >::operator* | ( | const IntervalND< T, 3 > & | i | ) | const

Standard arithmetic operators extended to 3 interval groups

## operator*=()

template<class T >

IntervalND< T, 3 > & SurgSim::Math::IntervalND< T, 3 >::operator*= | ( | const IntervalND< T, 3 > & | i | ) |

Standard arithmetic operators extended to 3 interval groups

## operator+()

template<class T >

IntervalND< T, 3 > SurgSim::Math::IntervalND< T, 3 >::operator+ | ( | const IntervalND< T, 3 > & | i | ) | const

Standard arithmetic operators extended to 3 interval groups

## operator+=()

template<class T >

IntervalND< T, 3 > & SurgSim::Math::IntervalND< T, 3 >::operator+= | ( | const IntervalND< T, 3 > & | i | ) |

Standard arithmetic operators extended to 3 interval groups

## operator-()

template<class T >

IntervalND< T, 3 > SurgSim::Math::IntervalND< T, 3 >::operator- | ( | const IntervalND< T, 3 > & | i | ) | const

Standard arithmetic operators extended to 3 interval groups

## operator-=()

template<class T >

IntervalND< T, 3 > & SurgSim::Math::IntervalND< T, 3 >::operator-= | ( | const IntervalND< T, 3 > & | i | ) |

Standard arithmetic operators extended to 3 interval groups

## operator/()

template<class T >

IntervalND< T, 3 > SurgSim::Math::IntervalND< T, 3 >::operator/ | ( | const IntervalND< T, 3 > & | i | ) | const

Parameters

  i | the interval to be divided by

Returns
  the product of each interval in the 3 group multiplied by the inverse of its correspondent in i

Exceptions

  if | any component of interval includes 0

## operator/=()

template<class T >

IntervalND< T, 3 > & SurgSim::Math::IntervalND< T, 3 >::operator/= | ( | const IntervalND< T, 3 > & | i | ) |

Parameters

  i | the interval to be divided by

Returns
  the product of each interval in the 3 group multiplied by the inverse of its correspondent in i

Note
  the current interval is modified by this operation

## operator=() [1/2]

template<class T >

IntervalND< T, 3 > & SurgSim::Math::IntervalND< T, 3 >::operator= | ( | const IntervalND< T, 3 > & | i | ) |

Assignment operator.

Parameters

  i | Interval 3 group to be copied

## operator=() [2/2]

template<class T >

IntervalND< T, 3 > & SurgSim::Math::IntervalND< T, 3 >::operator= | ( | IntervalND< T, 3 > && | i | ) |

Move assignment operator.

Parameters

  i | Interval to be moved

## operator==()

template<class T >

bool SurgSim::Math::IntervalND< T, 3 >::operator== | ( | const IntervalND< T, 3 > & | i | ) | const

Parameters

  i | the interval group to be tested

Returns
  true if the current interval 3 group is identical to the input 3 group i

## overlapsWith()

template<class T >

bool SurgSim::Math::IntervalND< T, 3 >::overlapsWith | ( | const IntervalND< T, 3 > & | interval | ) | const

Parameters

  interval | the interval group the current group will be tested against

Returns
  true if the input 3 group interval overlaps the current 3 group

## Friends And Related Function Documentation

## IntervalArithmetic_add

template<class T >
template<class P >

void IntervalArithmetic_add | ( | const IntervalND< P, 3 > & | a,
|  | const IntervalND< P, 3 > & | b,
|  | IntervalND< P, 3 > * | res
| ) |  |

friend

Calculate the sum of two interval groups.

Template Parameters

  P | underlying type of the interval

Parameters

  a | the first interval group
  b | the second interval group
  res | [out] the result of a + b

## IntervalArithmetic_crossProduct

template<class T >
template<class P >

void IntervalArithmetic_crossProduct | ( | const IntervalND< P, 3 > & | a,
|  | const IntervalND< P, 3 > & | b,
|  | IntervalND< P, 3 > * | res
| ) |  |

friend

Calculate the cross product of two interval groups.

Template Parameters

  P | underlying type of the interval

Parameters

  a | the first interval group
  b | the second interval group
  res | [out] the cross product of a and b

## IntervalArithmetic_dotProduct

template<class T >
template<class P >

void IntervalArithmetic_dotProduct | ( | const IntervalND< P, 3 > & | a,
|  | const IntervalND< P, 3 > & | b,
|  | Interval< P > * | res
| ) |  |

friend

Calculate the dot product of two interval groups.

Template Parameters

  P | underlying type of the interval

Parameters

  a | the first interval group
  b | the second interval group
  res | [out] the dot product of a and b

## IntervalArithmetic_sub

template<class T >
template<class P >

void IntervalArithmetic_sub | ( | const IntervalND< P, 3 > & | a,
|  | const IntervalND< P, 3 > & | b,
|  | IntervalND< P, 3 > * | res
| ) |  |

friend

Calculate the difference of two interval groups.

Template Parameters

  P | underlying type of the interval

Parameters

  a | the first interval group
  b | the second interval group
  res | [out] the result of a - b

## Member Data Documentation

## m_interval

template<class T >

std::array<Interval<T>, 3> SurgSim::Math::IntervalND< T, 3 >::m_interval

private

The 3 dimensional group of intervals.

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

- SurgSim/Math/IntervalArithmetic.h
- SurgSim/Math/IntervalArithmetic-inl.h