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

#include <interval.h>

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
 
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
 
double Size () const
 
bool Contains (double d) const
 
bool In (double d) const
 
bool Contains (const GfInterval &i) const
 
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 49 of file interval.h.

Constructor & Destructor Documentation

GfInterval::GfInterval ( )
inline

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

Definition at line 56 of file interval.h.

GfInterval::GfInterval ( double  val)
inline

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

Definition at line 62 of file interval.h.

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

Construct an interval with the given arguments.

Definition at line 68 of file interval.h.

Member Function Documentation

bool GfInterval::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 181 of file interval.h.

bool GfInterval::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 192 of file interval.h.

static GfInterval GfInterval::GetFullInterval ( )
inlinestatic

Returns the full interval (-inf, inf).

Definition at line 342 of file interval.h.

double GfInterval::GetMax ( ) const
inline

Maximum value.

Definition at line 112 of file interval.h.

double GfInterval::GetMin ( ) const
inline

Minimum value.

Definition at line 109 of file interval.h.

double GfInterval::GetSize ( ) const
inline

Width of the interval. An empty interval has size 0.

Definition at line 172 of file interval.h.

size_t GfInterval::Hash ( ) const
inline

Hash value. Just a basic hash function, not particularly high quality.

Definition at line 102 of file interval.h.

bool GfInterval::In ( double  d) const
inline

Definition at line 187 of file interval.h.

bool GfInterval::Intersects ( const GfInterval i) const
inline

Return true iff the given interval i intersects this interval.

Definition at line 197 of file interval.h.

bool GfInterval::IsEmpty ( ) const
inline

Return true iff the interval is empty.

Definition at line 164 of file interval.h.

bool GfInterval::IsFinite ( ) const
inline

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

Definition at line 159 of file interval.h.

bool GfInterval::IsMaxClosed ( ) const
inline

Maximum boundary condition.

Definition at line 138 of file interval.h.

bool GfInterval::IsMaxFinite ( ) const
inline

Returns true if the maximum value is finite.

Definition at line 147 of file interval.h.

bool GfInterval::IsMaxOpen ( ) const
inline

Maximum boundary condition.

Definition at line 144 of file interval.h.

bool GfInterval::IsMinClosed ( ) const
inline

Minimum boundary condition.

Definition at line 135 of file interval.h.

bool GfInterval::IsMinFinite ( ) const
inline

Returns true if the minimum value is finite.

Definition at line 153 of file interval.h.

bool GfInterval::IsMinOpen ( ) const
inline

Minimum boundary condition.

Definition at line 141 of file interval.h.

bool GfInterval::operator!= ( const GfInterval rhs) const
inline

Inequality operator.

Definition at line 82 of file interval.h.

GfInterval GfInterval::operator& ( const GfInterval rhs) const
inline

Intersection operator.

Definition at line 308 of file interval.h.

GfInterval& GfInterval::operator&= ( const GfInterval rhs)
inline

Boolean intersection.

Definition at line 205 of file interval.h.

GfInterval GfInterval::operator* ( const GfInterval rhs) const
inline

Multiplication operator.

Definition at line 332 of file interval.h.

GfInterval& GfInterval::operator*= ( const GfInterval rhs)
inline

Interval multiplication.

Definition at line 271 of file interval.h.

GfInterval GfInterval::operator+ ( const GfInterval rhs) const
inline

Addition operator.

Definition at line 316 of file interval.h.

GfInterval& GfInterval::operator+= ( const GfInterval rhs)
inline

Interval addition.

Definition at line 250 of file interval.h.

GfInterval GfInterval::operator- ( ) const
inline

Interval unary minus.

Definition at line 266 of file interval.h.

GfInterval GfInterval::operator- ( const GfInterval rhs) const
inline

Subtraction operator.

Definition at line 324 of file interval.h.

GfInterval& GfInterval::operator-= ( const GfInterval rhs)
inline

Interval subtraction.

Definition at line 261 of file interval.h.

bool GfInterval::operator< ( const GfInterval rhs) const
inline

Less-than operator.

Definition at line 87 of file interval.h.

bool GfInterval::operator<= ( const GfInterval rhs)
inline

Less than or equal operator.

Definition at line 288 of file interval.h.

bool GfInterval::operator== ( const GfInterval rhs) const
inline

Equality operator.

Definition at line 77 of file interval.h.

bool GfInterval::operator> ( const GfInterval rhs)
inline

Greater than operator.

Definition at line 282 of file interval.h.

bool GfInterval::operator>= ( const GfInterval rhs)
inline

Greater than or equal operator.

Definition at line 294 of file interval.h.

GfInterval GfInterval::operator| ( const GfInterval rhs) const
inline

Union operator.

Definition at line 300 of file interval.h.

GfInterval& GfInterval::operator|= ( const GfInterval rhs)
inline

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

Definition at line 228 of file interval.h.

void GfInterval::SetMax ( double  v)
inline

Set maximum value.

Definition at line 125 of file interval.h.

void GfInterval::SetMax ( double  v,
bool  maxClosed 
)
inline

Set maximum value and boundary condition.

Definition at line 130 of file interval.h.

void GfInterval::SetMin ( double  v)
inline

Set minimum value.

Definition at line 115 of file interval.h.

void GfInterval::SetMin ( double  v,
bool  minClosed 
)
inline

Set minimum value and boundary condition.

Definition at line 120 of file interval.h.

double GfInterval::Size ( ) const
inline

Definition at line 177 of file interval.h.

Friends And Related Function Documentation

size_t hash_value ( GfInterval const &  i)
friend

Definition at line 104 of file interval.h.


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