Searching...
No Matches
GfInterval Class Reference

A basic mathematical interval class. More...

`#include <interval.h>`

## Public Member Functions

bool operator== (const GfInterval &rhs) const
Equality operator.

bool operator!= (const GfInterval &rhs) const
Inequality operator.

bool operator< (const GfInterval &rhs) const
Less-than operator.

size_t Hash () const
Hash value.

double GetMin () const
Minimum value.

double GetMax () const
Maximum value.

void SetMin (double v)
Set minimum value.

void SetMin (double v, bool minClosed)
Set minimum value and boundary condition.

void SetMax (double v)
Set maximum value.

void SetMax (double v, bool maxClosed)
Set maximum value and boundary condition.

bool IsMinClosed () const
Minimum boundary condition.

bool IsMaxClosed () const
Maximum boundary condition.

bool IsMinOpen () const
Minimum boundary condition.

bool IsMaxOpen () const
Maximum boundary condition.

bool IsMaxFinite () const
Returns true if the maximum value is finite.

bool IsMinFinite () const
Returns true if the minimum value is finite.

bool IsFinite () const
Returns true if both the maximum and minimum value are finite.

bool IsEmpty () const
Return true iff the interval is empty.

double GetSize () const
Width of the interval.

double Size () const

bool Contains (double d) const
Return true iff the value d is contained in the interval.

bool In (double d) const

bool Contains (const GfInterval &i) const
Return true iff the interval i is entirely contained in the interval.

bool Intersects (const GfInterval &i) const
Return true iff the given interval i intersects this interval.

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

GfInterval (double val)
Construct a closed interval representing the single point, as [val,val].

GfInterval (double min, double max, bool minClosed=true, bool maxClosed=true)
Construct an interval with the given arguments.

Math operations
GfIntervaloperator&= (const GfInterval &rhs)
Boolean intersection.

GfIntervaloperator|= (const GfInterval &rhs)
Returns the interval that bounds the union of this interval and rhs.

GfIntervaloperator+= (const GfInterval &rhs)

GfIntervaloperator-= (const GfInterval &rhs)
Interval subtraction.

GfInterval operator- () const
Interval unary minus.

GfIntervaloperator*= (const GfInterval &rhs)
Interval multiplication.

bool operator> (const GfInterval &rhs)
Greater than operator.

bool operator<= (const GfInterval &rhs)
Less than or equal operator.

bool operator>= (const GfInterval &rhs)
Greater than or equal operator.

GfInterval operator| (const GfInterval &rhs) const
Union operator.

GfInterval operator& (const GfInterval &rhs) const
Intersection operator.

GfInterval operator+ (const GfInterval &rhs) const

GfInterval operator- (const GfInterval &rhs) const
Subtraction operator.

GfInterval operator* (const GfInterval &rhs) const
Multiplication operator.

## Static Public Member Functions

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

## 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.

## ◆ GfInterval() [1/3]

 GfInterval ( )
inline

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

Definition at line 56 of file interval.h.

## ◆ GfInterval() [2/3]

 GfInterval ( double val )
inline

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

Definition at line 62 of file interval.h.

## ◆ GfInterval() [3/3]

 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.

## ◆ Contains() [1/2]

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

## ◆ Contains() [2/2]

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

## ◆ GetFullInterval()

 static GfInterval GetFullInterval ( )
inlinestatic

Returns the full interval (-inf, inf).

Definition at line 342 of file interval.h.

## ◆ GetMax()

 double GetMax ( ) const
inline

Maximum value.

Definition at line 112 of file interval.h.

## ◆ GetMin()

 double GetMin ( ) const
inline

Minimum value.

Definition at line 109 of file interval.h.

## ◆ GetSize()

 double GetSize ( ) const
inline

Width of the interval.

An empty interval has size 0.

Definition at line 172 of file interval.h.

## ◆ Hash()

 size_t Hash ( ) const
inline

Hash value.

Just a basic hash function, not particularly high quality.

Definition at line 102 of file interval.h.

## ◆ In()

 bool In ( double d ) const
inline

Definition at line 187 of file interval.h.

## ◆ Intersects()

 bool Intersects ( const GfInterval & i ) const
inline

Return true iff the given interval i intersects this interval.

Definition at line 197 of file interval.h.

## ◆ IsEmpty()

 bool IsEmpty ( ) const
inline

Return true iff the interval is empty.

Definition at line 164 of file interval.h.

## ◆ IsFinite()

 bool IsFinite ( ) const
inline

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

Definition at line 159 of file interval.h.

## ◆ IsMaxClosed()

 bool IsMaxClosed ( ) const
inline

Maximum boundary condition.

Definition at line 138 of file interval.h.

## ◆ IsMaxFinite()

 bool IsMaxFinite ( ) const
inline

Returns true if the maximum value is finite.

Definition at line 147 of file interval.h.

## ◆ IsMaxOpen()

 bool IsMaxOpen ( ) const
inline

Maximum boundary condition.

Definition at line 144 of file interval.h.

## ◆ IsMinClosed()

 bool IsMinClosed ( ) const
inline

Minimum boundary condition.

Definition at line 135 of file interval.h.

## ◆ IsMinFinite()

 bool IsMinFinite ( ) const
inline

Returns true if the minimum value is finite.

Definition at line 153 of file interval.h.

## ◆ IsMinOpen()

 bool IsMinOpen ( ) const
inline

Minimum boundary condition.

Definition at line 141 of file interval.h.

## ◆ operator!=()

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

Inequality operator.

Definition at line 82 of file interval.h.

## ◆ operator&()

 GfInterval operator& ( const GfInterval & rhs ) const
inline

Intersection operator.

Definition at line 308 of file interval.h.

## ◆ operator&=()

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

Boolean intersection.

Definition at line 205 of file interval.h.

## ◆ operator*()

 GfInterval operator* ( const GfInterval & rhs ) const
inline

Multiplication operator.

Definition at line 332 of file interval.h.

## ◆ operator*=()

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

Interval multiplication.

Definition at line 271 of file interval.h.

## ◆ operator+()

 GfInterval operator+ ( const GfInterval & rhs ) const
inline

Definition at line 316 of file interval.h.

## ◆ operator+=()

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

Definition at line 250 of file interval.h.

## ◆ operator-() [1/2]

 GfInterval operator- ( ) const
inline

Interval unary minus.

Definition at line 266 of file interval.h.

## ◆ operator-() [2/2]

 GfInterval operator- ( const GfInterval & rhs ) const
inline

Subtraction operator.

Definition at line 324 of file interval.h.

## ◆ operator-=()

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

Interval subtraction.

Definition at line 261 of file interval.h.

## ◆ operator<()

 bool operator< ( const GfInterval & rhs ) const
inline

Less-than operator.

Definition at line 87 of file interval.h.

## ◆ operator<=()

 bool operator<= ( const GfInterval & rhs )
inline

Less than or equal operator.

Definition at line 288 of file interval.h.

## ◆ operator==()

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

Equality operator.

Definition at line 77 of file interval.h.

## ◆ operator>()

 bool operator> ( const GfInterval & rhs )
inline

Greater than operator.

Definition at line 282 of file interval.h.

## ◆ operator>=()

 bool operator>= ( const GfInterval & rhs )
inline

Greater than or equal operator.

Definition at line 294 of file interval.h.

## ◆ operator|()

 GfInterval operator| ( const GfInterval & rhs ) const
inline

Union operator.

Definition at line 300 of file interval.h.

## ◆ operator|=()

 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.

## ◆ SetMax() [1/2]

 void SetMax ( double v )
inline

Set maximum value.

Definition at line 125 of file interval.h.

## ◆ SetMax() [2/2]

 void SetMax ( double v, bool maxClosed )
inline

Set maximum value and boundary condition.

Definition at line 130 of file interval.h.

## ◆ SetMin() [1/2]

 void SetMin ( double v )
inline

Set minimum value.

Definition at line 115 of file interval.h.

## ◆ SetMin() [2/2]

 void SetMin ( double v, bool minClosed )
inline

Set minimum value and boundary condition.

Definition at line 120 of file interval.h.

## ◆ Size()

 double Size ( ) const
inline

Definition at line 177 of file interval.h.

## ◆ hash_value

 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: