Interval< N, T > Class Template Reference

An axes-oriented interval in the specified dimension. More...

#include <Interval.h>

Inheritance diagram for Interval< N, T >:
BBox< N, T > SemiOpenInterval< N, T >

List of all members.

Public Types

typedef T Number
 The number type.
typedef ads::FixedArray< N, T > Point
 The point type.

Public Member Functions

Constructors etc.

 Interval ()
 Default constructor. Memory is uninitialized.
 Interval (const Point &min, const Point &max)
 Construct an interval from the min and max points.
 Interval (const Number xmin, const Number xmax)
 Construct a 1-D interval from the min and max coordinates.
 Interval (const Number xmin, const Number ymin, const Number xmax, const Number ymax)
 Construct an 2-D interval from the min and max coordinates.
 Interval (const Number xmin, const Number ymin, const Number zmin, const Number xmax, const Number ymax, const Number zmax)
 Construct a 3-D interval from the min and max coordinates.
 Interval (const Number *coordinates)
 Construct an interval from an array of the min and max coordinates.
 Interval (const Interval &other)
 Copy Constructor.
Intervaloperator= (const Interval &other)
 Assignment operator.
void add (const Point &p)
 Make the interval expand to contain the new point.
 ~Interval ()
 Trivial destructor. No need for virtual.
The bound operation.

void add (const Interval &x)
 Make the interval expand to contain the new interval.
template<class InputIterator >
void bound (InputIterator first, InputIterator last)
 Bound a range of points.
void bound (const Point &p)
 Bound a single point.
void bound (const Point &p, const Point &q)
 Bound two points.
void bound (const Point &p, const Point &q, const Point &r)
 Bound three points.
Accessors.

const PointgetLowerCorner () const
 Return the min point.
const PointgetUpperCorner () const
 Return the max point.
Number computeContent () const
 Return the content (length, area, volume, etc.) of the interval.
Manipulators.

void setLowerCorner (const Point &lowerCorner)
 Set the lower corner.
void setUpperCorner (const Point &upperCorner)
 Set the upper corner.
void setCorners (const Point &lowerCorner, const Point &upperCorner)
 Set the lower and upper corners.
void setLowerCoordinate (const int index, const Number value)
 Set a coordinate of the lower corner.
void setUpperCoordinate (const int index, const Number value)
 Set a coordinate of the upper corner.

Static Public Member Functions

Static member functions.

static int getDimension ()
 Return the dimension of the interval.

Related Functions

(Note that these are not member functions.)



template<int N, typename T >
void printFormatted (std::ostream &out, const Interval< N, T > &x)
 Print in a nice format.
template<int N, typename T >
std::istream & operator>> (std::istream &in, Interval< N, T > &x)
 Read the ranges.
template<int N, typename T >
std::ostream & operator<< (std::ostream &out, const Interval< N, T > &x)
 Write the ranges.
template<int N, typename T >
bool operator== (const Interval< N, T > &a, const Interval< N, T > &b)
 Equality.
template<int N, typename T >
bool operator!= (const Interval< N, T > &a, const Interval< N, T > &b)
 Inequality.
template<int N, typename T >
bool doOverlap (const Interval< N, T > &a, const Interval< N, T > &b)
 Return true if the open intervals overlap.
template<int N, typename T >
Interval< N, T > computeIntersection (const Interval< N, T > &a, const Interval< N, T > &b)
 Return the intersection of the intervals.
template<int N, typename T >
void computeIntersection (const Interval< N, T > &a, const Interval< N, T > &b, Interval< N, T > *x)
 Compute the intersection of the intervals.

Detailed Description

template<int N, typename T = double>
class Interval< N, T >

An axes-oriented interval in the specified dimension.

Parameters:
N is the dimension.
T is the number type. By default it is double.
Todo:
Use partial template specialization to get optimized versions for N = 1, 2 and 3.

Constructor & Destructor Documentation

template<int N, typename T = double>
Interval< N, T >::Interval ( const Number coordinates  )  [inline]

Construct an interval from an array of the min and max coordinates.

The coordinates should be in the same order as for the above constructors.


Friends And Related Function Documentation

template<int N, typename T >
void computeIntersection ( const Interval< N, T > &  a,
const Interval< N, T > &  b,
Interval< N, T > *  x 
) [related]

Compute the intersection of the intervals.

template<int N, typename T >
Interval< N, T > computeIntersection ( const Interval< N, T > &  a,
const Interval< N, T > &  b 
) [related]

Return the intersection of the intervals.

template<int N, typename T >
bool doOverlap ( const Interval< N, T > &  a,
const Interval< N, T > &  b 
) [related]

Return true if the open intervals overlap.

template<int N, typename T >
bool operator!= ( const Interval< N, T > &  a,
const Interval< N, T > &  b 
) [related]

Inequality.

template<int N, typename T >
std::ostream & operator<< ( std::ostream &  out,
const Interval< N, T > &  x 
) [related]

Write the ranges.

template<int N, typename T >
bool operator== ( const Interval< N, T > &  a,
const Interval< N, T > &  b 
) [related]
template<int N, typename T >
std::istream & operator>> ( std::istream &  in,
Interval< N, T > &  x 
) [related]
template<int N, typename T >
void printFormatted ( std::ostream &  out,
const Interval< N, T > &  x 
) [related]

Print in a nice format.


The documentation for this class was generated from the following file:
Generated on Thu Jun 30 02:14:58 2016 for Computational Geometry Package by  doxygen 1.6.3