Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

OpenTissue::math::interval::Interval< value_type_ > Class Template Reference

#include <interval.h>

List of all members.

Public Types

typedef value_type_ T
typedef math::ValueTraits< Tvalue_traits
typedef T value_type
typedef T base_type
typedef size_t index_type

Public Member Functions

Tlower ()
T const & lower () const
Tupper ()
T const & upper () const
Toperator() (index_type index)
T const & operator() (index_type index) const
Toperator[] (index_type index)
T const & operator[] (index_type index) const
 Interval ()
 Interval (Interval const &i)
 Interval (T const &value)
 Interval (T const &l, T const &u)
 ~Interval ()
Intervaloperator= (Interval const &rhs)
void assign (T const &l, T const &u)
void clear ()
bool is_valid () const
bool is_empty () const
bool operator< (Interval const &i) const
bool operator> (Interval const &i) const
bool operator<= (Interval const &i) const
bool operator>= (Interval const &i) const
bool operator== (Interval const &i) const
bool operator!= (Interval const &i) const
Intervaloperator+= (Interval const &i)
Interval operator+ (Interval const &i) const
Intervaloperator-= (Interval const &i)
Interval operator- (Interval const &i) const
Interval operator- () const
Intervaloperator*= (T const &val)
Interval operator* (T const &val) const
Intervaloperator*= (Interval const &i)
Interval operator* (Interval const &i) const
Intervaloperator/= (Interval const &i)
Interval operator/ (Interval const &i) const
T get_abs_lower () const
T get_abs_upper () const

Static Public Member Functions

static Interval const & empty ()

Protected Attributes

T m_lower
 The lower value of the interval. Default value is zero.
T m_upper
 The upper value of the interval. Default value is zero.

Detailed Description

template<typename value_type_>
class OpenTissue::math::interval::Interval< value_type_ >

Interval class.

A *simple naive* speed test, no -DNDEBUG used.

Intervals of type [x,y] where x<0 and y>0 used in testing.

this interval, 10^6 muls: 2.85913 seconds boost interval, 10^6 muls: 5.13671 seconds

this interval, 10^6 adds: 1.94612 seconds boost interval, 10^6 adds: 3.86221 seconds

this interval, 10^6 subs: 2.00829 seconds boost interval, 10^6 subs: 3.8229 seconds

Intervals of type [x,y] where 0<x<y used in divs.

this interval, 10^6 divs: 3.41608 seconds boost interval, 10^6 divs: 4.78257 seconds

This class contains >no< error-checking. You might want to use boost::numeric::interval until you know your interval-code is working.

Author:
Jackj.

Member Typedef Documentation

template<typename value_type_>
typedef T OpenTissue::math::interval::Interval< value_type_ >::base_type
template<typename value_type_>
typedef size_t OpenTissue::math::interval::Interval< value_type_ >::index_type
template<typename value_type_>
typedef value_type_ OpenTissue::math::interval::Interval< value_type_ >::T
template<typename value_type_>
typedef math::ValueTraits<T> OpenTissue::math::interval::Interval< value_type_ >::value_traits
template<typename value_type_>
typedef T OpenTissue::math::interval::Interval< value_type_ >::value_type

Constructor & Destructor Documentation

template<typename value_type_>
OpenTissue::math::interval::Interval< value_type_ >::Interval (  )  [inline]
template<typename value_type_>
OpenTissue::math::interval::Interval< value_type_ >::Interval ( Interval< value_type_ > const &  i  )  [inline]
template<typename value_type_>
OpenTissue::math::interval::Interval< value_type_ >::Interval ( T const &  value  )  [inline, explicit]
template<typename value_type_>
OpenTissue::math::interval::Interval< value_type_ >::Interval ( T const &  l,
T const &  u 
) [inline, explicit]
template<typename value_type_>
OpenTissue::math::interval::Interval< value_type_ >::~Interval (  )  [inline]

Member Function Documentation

template<typename value_type_>
void OpenTissue::math::interval::Interval< value_type_ >::assign ( T const &  l,
T const &  u 
) [inline]
template<typename value_type_>
void OpenTissue::math::interval::Interval< value_type_ >::clear (  )  [inline]

Clear Method. This method sets the interval bounds to their default values. I.e. both lower and upper bound is set to zero.

template<typename value_type_>
static Interval const& OpenTissue::math::interval::Interval< value_type_ >::empty (  )  [inline, static]
template<typename value_type_>
T OpenTissue::math::interval::Interval< value_type_ >::get_abs_lower (  )  const [inline]

Get Absolute Lower Interval Bound.

Returns:
The value of the absolute lower interval bound.
template<typename value_type_>
T OpenTissue::math::interval::Interval< value_type_ >::get_abs_upper (  )  const [inline]

Get Absolute Upper Interval Bound.

Returns:
The value of the absolute upper interval bound.
template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::is_empty (  )  const [inline]

Empty Test. This method tests whether the bounds indicate an empty interval.

By convention this means the lower bound is larger than the upper bound.

template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::is_valid (  )  const [inline]

Validity. This method tests whether the bounds indicate a valid interval range. This is useful for making integrity tests.

template<typename value_type_>
T& OpenTissue::math::interval::Interval< value_type_ >::lower (  )  [inline]
template<typename value_type_>
T const& OpenTissue::math::interval::Interval< value_type_ >::lower (  )  const [inline]
template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::operator!= ( Interval< value_type_ > const &  i  )  const [inline]
template<typename value_type_>
T& OpenTissue::math::interval::Interval< value_type_ >::operator() ( index_type  index  )  [inline]

Interval Bound Operator Accessor

Parameters:
The index of the interval bound one want to access. Use zero to get lower bound and one to get upper bound.
Returns:
The interval bound corresponding to the specified index.
template<typename value_type_>
T const& OpenTissue::math::interval::Interval< value_type_ >::operator() ( index_type  index  )  const [inline]

Interval Bound Operator Accessor

Parameters:
The index of the interval bound one want to access. Use zero to get lower bound and one to get upper bound.
Returns:
The interval bound corresponding to the specified index.
template<typename value_type_>
Interval OpenTissue::math::interval::Interval< value_type_ >::operator* ( T const &  val  )  const [inline]

Scalar Multiplication. Performance Warning: Copy Constructor is invoked to create return value.

Parameters:
val The scalar value to multiply this interval instance with.
Returns:
A reference to this interval reference.
template<typename value_type_>
Interval OpenTissue::math::interval::Interval< value_type_ >::operator* ( Interval< value_type_ > const &  i  )  const [inline]
template<typename value_type_>
Interval& OpenTissue::math::interval::Interval< value_type_ >::operator*= ( T const &  val  )  [inline]

Scalar Multiplication.

Parameters:
val The scalar value to multiply this interval instance with.
Returns:
A reference to this interval reference.
template<typename value_type_>
Interval& OpenTissue::math::interval::Interval< value_type_ >::operator*= ( Interval< value_type_ > const &  i  )  [inline]

Interval Multiplication.

Parameters:
i The interval to multiply with.
Returns:
A reference to this interval instance.
template<typename value_type_>
Interval OpenTissue::math::interval::Interval< value_type_ >::operator+ ( Interval< value_type_ > const &  i  )  const [inline]

Interval Addition. Performance Warning: Copy Constructor is invoked to create return value.

Parameters:
The interval that should be added to this interval.
Returns:
A refrence to the resulting interval (this interval instance).
template<typename value_type_>
Interval& OpenTissue::math::interval::Interval< value_type_ >::operator+= ( Interval< value_type_ > const &  i  )  [inline]

Interval Addition.

Parameters:
The interval that should be added to this interval.
Returns:
A refrence to the resulting interval (this interval instance).
template<typename value_type_>
Interval OpenTissue::math::interval::Interval< value_type_ >::operator- (  )  const [inline]

Negation Operator. Performance Warning: Copy Constructor is invoked to create return value.

Returns:
An interval that holds the negated bounds of this interval reference.
template<typename value_type_>
Interval OpenTissue::math::interval::Interval< value_type_ >::operator- ( Interval< value_type_ > const &  i  )  const [inline]

Interval Subtraction. Performance Warning: Copy Constructor is invoked to create return value.

Parameters:
The interval that should be subtracted to this interval.
Returns:
A refrence to the resulting interval (this interval instance).
template<typename value_type_>
Interval& OpenTissue::math::interval::Interval< value_type_ >::operator-= ( Interval< value_type_ > const &  i  )  [inline]

Interval Subtraction.

Parameters:
The interval that should be subtracted to this interval.
Returns:
A refrence to the resulting interval (this interval instance).
template<typename value_type_>
Interval OpenTissue::math::interval::Interval< value_type_ >::operator/ ( Interval< value_type_ > const &  i  )  const [inline]

Interval Division. Performance Warning: Copy Constructor is invoked to create return value.

Parameters:
i The interval to divided by.
Returns:
A new interval instance holding the result of the division.
template<typename value_type_>
Interval& OpenTissue::math::interval::Interval< value_type_ >::operator/= ( Interval< value_type_ > const &  i  )  [inline]

Interval Division.

Parameters:
i The interval to divided by.
Returns:
A reference to this interval instance holding the result of the division.
template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::operator< ( Interval< value_type_ > const &  i  )  const [inline]

Interval Comparison Operators. The following operators are implemented as they are in interval aritchmetic, see for example (18) in "Continuous Collision Detection for Rigid and Articulated Bodies" by Stephane Redon

or

(2)-(6) in "Interval Computations: Introduction, Uses, and Resources" by R.B. Kearfott

Parameters:
i A reference to an interval for comparison.
Returns:
The result of the comparison.
template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::operator<= ( Interval< value_type_ > const &  i  )  const [inline]
template<typename value_type_>
Interval& OpenTissue::math::interval::Interval< value_type_ >::operator= ( Interval< value_type_ > const &  rhs  )  [inline]

Assignment Operator.

ToDo jackj: should this be explicit type conversrion?

Parameters:
rhs The interval whos bounds are assigned to this interval.
Returns:
A reference to this interval instance.
template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::operator== ( Interval< value_type_ > const &  i  )  const [inline]
template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::operator> ( Interval< value_type_ > const &  i  )  const [inline]
template<typename value_type_>
bool OpenTissue::math::interval::Interval< value_type_ >::operator>= ( Interval< value_type_ > const &  i  )  const [inline]
template<typename value_type_>
T& OpenTissue::math::interval::Interval< value_type_ >::operator[] ( index_type  index  )  [inline]

Interval Bound Operator Accessor

Parameters:
The index of the interval bound one want to access. Use zero to get lower bound and one to get upper bound.
Returns:
The interval bound corresponding to the specified index.
template<typename value_type_>
T const& OpenTissue::math::interval::Interval< value_type_ >::operator[] ( index_type  index  )  const [inline]

Interval Bound Operator Accessor

Parameters:
The index of the interval bound one want to access. Use zero to get lower bound and one to get upper bound.
Returns:
The interval bound corresponding to the specified index.
template<typename value_type_>
T const& OpenTissue::math::interval::Interval< value_type_ >::upper (  )  const [inline]
template<typename value_type_>
T& OpenTissue::math::interval::Interval< value_type_ >::upper (  )  [inline]

Member Data Documentation

template<typename value_type_>
T OpenTissue::math::interval::Interval< value_type_ >::m_lower [protected]

The lower value of the interval. Default value is zero.

template<typename value_type_>
T OpenTissue::math::interval::Interval< value_type_ >::m_upper [protected]

The upper value of the interval. Default value is zero.


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