All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfInterval Class Reference

A basic mathematical interval class. More...

Public Member Functions

bool operator== (const GfInterval &rhs) const
 Equality operator. More...
 
bool operator!= (const GfInterval &rhs) const
 Inequality operator. More...
 
bool operator< (const GfInterval &rhs) const
 Less-than operator. More...
 
size_t Hash () const
 Hash value. More...
 
double GetMin () const
 Minimum value. More...
 
double GetMax () const
 Maximum value. More...
 
void SetMin (double v)
 Set minimum value. More...
 
void SetMin (double v, bool minClosed)
 Set minimum value and boundary condition. More...
 
void SetMax (double v)
 Set maximum value. More...
 
void SetMax (double v, bool maxClosed)
 Set maximum value and boundary condition. More...
 
bool IsMinClosed () const
 Minimum boundary condition. More...
 
bool IsMaxClosed () const
 Maximum boundary condition. More...
 
bool IsMinOpen () const
 Minimum boundary condition. More...
 
bool IsMaxOpen () const
 Maximum boundary condition. More...
 
bool IsMaxFinite () const
 Returns true if the maximum value is finite. More...
 
bool IsMinFinite () const
 Returns true if the minimum value is finite. More...
 
bool IsFinite () const
 Returns true if both the maximum and minimum value are finite. More...
 
bool IsEmpty () const
 Return true iff the interval is empty. More...
 
double GetSize () const
 Width of the interval. More...
 
double Size () const
 
bool Contains (double d) const
 Return true iff the value d is contained in the interval. More...
 
bool In (double d) const
 
bool Contains (const GfInterval &i) const
 Return true iff the interval i is entirely contained in the interval. More...
 
bool Intersects (const GfInterval &i) const
 Return true iff the given interval i intersects this interval. More...
 
Constructors
 GfInterval ()
 Construct an empty open interval, (0,0). More...
 
 GfInterval (double val)
 Construct a closed interval representing the single point, as [val,val]. More...
 
 GfInterval (double min, double max, bool minClosed=true, bool maxClosed=true)
 Construct an interval with the given arguments. More...
 
Math operations
GfIntervaloperator&= (const GfInterval &rhs)
 Boolean intersection. More...
 
GfIntervaloperator|= (const GfInterval &rhs)
 Returns the interval that bounds the union of this interval and rhs. More...
 
GfIntervaloperator+= (const GfInterval &rhs)
 Interval addition. More...
 
GfIntervaloperator-= (const GfInterval &rhs)
 Interval subtraction. More...
 
GfInterval operator- () const
 Interval unary minus. More...
 
GfIntervaloperator*= (const GfInterval &rhs)
 Interval multiplication. More...
 
bool operator> (const GfInterval &rhs)
 Greater than operator. More...
 
bool operator<= (const GfInterval &rhs)
 Less than or equal operator. More...
 
bool operator>= (const GfInterval &rhs)
 Greater than or equal operator. More...
 
GfInterval operator| (const GfInterval &rhs) const
 Union operator. More...
 
GfInterval operator& (const GfInterval &rhs) const
 Intersection operator. More...
 
GfInterval operator+ (const GfInterval &rhs) const
 Addition operator. More...
 
GfInterval operator- (const GfInterval &rhs) const
 Subtraction operator. More...
 
GfInterval operator* (const GfInterval &rhs) const
 Multiplication operator. More...
 

Static Public Member Functions

static GfInterval GetFullInterval ()
 Returns the full interval (-inf, inf). More...
 

Friends

size_t hash_value (GfInterval const &i)
 

Detailed Description

A basic mathematical interval class.

Can represent intervals with either open or closed boundary conditions.

Definition at line 50 of file interval.h.

Constructor & Destructor Documentation

GfInterval ( )
inline

Construct an empty open interval, (0,0).

Definition at line 57 of file interval.h.

GfInterval ( double  val)
inline

Construct a closed interval representing the single point, as [val,val].

Definition at line 63 of file interval.h.

GfInterval ( double  min,
double  max,
bool  minClosed = true,
bool  maxClosed = true 
)
inline

Construct an interval with the given arguments.

Definition at line 69 of file interval.h.

Member Function Documentation

bool Contains ( double  d) const
inline

Return true iff the value d is contained in the interval.

An empty interval contains no values.

Definition at line 185 of file interval.h.

bool Contains ( const GfInterval i) const
inline

Return true iff the interval i is entirely contained in the interval.

An empty interval contains no intervals, not even other empty intervals.

Definition at line 196 of file interval.h.

static GfInterval GetFullInterval ( )
inlinestatic

Returns the full interval (-inf, inf).

Definition at line 346 of file interval.h.

double GetMax ( ) const
inline

Maximum value.

Definition at line 116 of file interval.h.

double GetMin ( ) const
inline

Minimum value.

Definition at line 113 of file interval.h.

double GetSize ( ) const
inline

Width of the interval.

An empty interval has size 0.

Definition at line 176 of file interval.h.

size_t Hash ( ) const
inline

Hash value.

Just a basic hash function, not particularly high quality.

Definition at line 103 of file interval.h.

bool Intersects ( const GfInterval i) const
inline

Return true iff the given interval i intersects this interval.

Definition at line 201 of file interval.h.

bool IsEmpty ( ) const
inline

Return true iff the interval is empty.

Definition at line 168 of file interval.h.

bool IsFinite ( ) const
inline

Returns true if both the maximum and minimum value are finite.

Definition at line 163 of file interval.h.

bool IsMaxClosed ( ) const
inline

Maximum boundary condition.

Definition at line 142 of file interval.h.

bool IsMaxFinite ( ) const
inline

Returns true if the maximum value is finite.

Definition at line 151 of file interval.h.

bool IsMaxOpen ( ) const
inline

Maximum boundary condition.

Definition at line 148 of file interval.h.

bool IsMinClosed ( ) const
inline

Minimum boundary condition.

Definition at line 139 of file interval.h.

bool IsMinFinite ( ) const
inline

Returns true if the minimum value is finite.

Definition at line 157 of file interval.h.

bool IsMinOpen ( ) const
inline

Minimum boundary condition.

Definition at line 145 of file interval.h.

bool operator!= ( const GfInterval rhs) const
inline

Inequality operator.

Definition at line 83 of file interval.h.

GfInterval operator& ( const GfInterval rhs) const
inline

Intersection operator.

Definition at line 312 of file interval.h.

GfInterval& operator&= ( const GfInterval rhs)
inline

Boolean intersection.

Definition at line 209 of file interval.h.

GfInterval operator* ( const GfInterval rhs) const
inline

Multiplication operator.

Definition at line 336 of file interval.h.

GfInterval& operator*= ( const GfInterval rhs)
inline

Interval multiplication.

Definition at line 275 of file interval.h.

GfInterval operator+ ( const GfInterval rhs) const
inline

Addition operator.

Definition at line 320 of file interval.h.

GfInterval& operator+= ( const GfInterval rhs)
inline

Interval addition.

Definition at line 254 of file interval.h.

GfInterval operator- ( ) const
inline

Interval unary minus.

Definition at line 270 of file interval.h.

GfInterval operator- ( const GfInterval rhs) const
inline

Subtraction operator.

Definition at line 328 of file interval.h.

GfInterval& operator-= ( const GfInterval rhs)
inline

Interval subtraction.

Definition at line 265 of file interval.h.

bool operator< ( const GfInterval rhs) const
inline

Less-than operator.

Definition at line 88 of file interval.h.

bool operator<= ( const GfInterval rhs)
inline

Less than or equal operator.

Definition at line 292 of file interval.h.

bool operator== ( const GfInterval rhs) const
inline

Equality operator.

Definition at line 78 of file interval.h.

bool operator> ( const GfInterval rhs)
inline

Greater than operator.

Definition at line 286 of file interval.h.

bool operator>= ( const GfInterval rhs)
inline

Greater than or equal operator.

Definition at line 298 of file interval.h.

GfInterval operator| ( const GfInterval rhs) const
inline

Union operator.

Definition at line 304 of file interval.h.

GfInterval& operator|= ( const GfInterval rhs)
inline

Returns the interval that bounds the union of this interval and rhs.

Definition at line 232 of file interval.h.

void SetMax ( double  v)
inline

Set maximum value.

Definition at line 129 of file interval.h.

void SetMax ( double  v,
bool  maxClosed 
)
inline

Set maximum value and boundary condition.

Definition at line 134 of file interval.h.

void SetMin ( double  v)
inline

Set minimum value.

Definition at line 119 of file interval.h.

void SetMin ( double  v,
bool  minClosed 
)
inline

Set minimum value and boundary condition.

Definition at line 124 of file interval.h.


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