LibreOffice Module basegfx (master) 1
Public Member Functions | Private Attributes | List of all members
basegfx::B1DRange Class Reference

A one-dimensional interval over doubles. More...

#include <b1drange.hxx>

Collaboration diagram for basegfx::B1DRange:
[legend]

Public Member Functions

 B1DRange ()
 
 B1DRange (double fStartValue)
 Create degenerate interval consisting of a single double number. More...
 
 B1DRange (double fStartValue1, double fStartValue2)
 Create proper interval between the two given double values. More...
 
bool isEmpty () const
 Check if the interval set is empty. More...
 
bool operator== (const B1DRange &rRange) const
 
bool operator!= (const B1DRange &rRange) const
 
double getMinimum () const
 get lower bound of the set. returns arbitrary values for empty sets. More...
 
double getMaximum () const
 get upper bound of the set. returns arbitrary values for empty sets. More...
 
double getRange () const
 return difference between upper and lower value. returns 0 for empty sets. More...
 
double getCenter () const
 return middle of upper and lower value. returns 0 for empty sets. More...
 
bool isInside (double fValue) const
 yields true if value is contained in set More...
 
bool overlaps (const B1DRange &rRange) const
 yields true if rRange at least partly inside set More...
 
bool overlapsMore (const B1DRange &rRange) const
 yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal More...
 
void expand (double fValue)
 add fValue to the set, expanding as necessary More...
 
void expand (const B1DRange &rRange)
 add rRange to the set, expanding as necessary More...
 
void intersect (const B1DRange &rRange)
 calc set intersection More...
 
double clamp (double fValue) const
 clamp value on range More...
 

Private Attributes

::basegfx::BasicRange< double, DoubleTraitsmaRange
 

Detailed Description

A one-dimensional interval over doubles.

This is a set of real numbers, bounded by a lower and an upper value. All inbetween values are included in the set (see also http://en.wikipedia.org/wiki/Interval_%28mathematics%29).

The set is closed, i.e. the upper and the lower bound are included (if you're used to the notation - we're talking about [a,b] here, compared to half-open [a,b) or open intervals (a,b)).

That means, isInside(val) will return true also for values of val=a or val=b.

Definition at line 42 of file b1drange.hxx.

Constructor & Destructor Documentation

◆ B1DRange() [1/3]

basegfx::B1DRange::B1DRange ( )
inline

Definition at line 47 of file b1drange.hxx.

◆ B1DRange() [2/3]

basegfx::B1DRange::B1DRange ( double  fStartValue)
inlineexplicit

Create degenerate interval consisting of a single double number.

Definition at line 50 of file b1drange.hxx.

◆ B1DRange() [3/3]

basegfx::B1DRange::B1DRange ( double  fStartValue1,
double  fStartValue2 
)
inline

Create proper interval between the two given double values.

Definition at line 56 of file b1drange.hxx.

References expand().

Member Function Documentation

◆ clamp()

double basegfx::B1DRange::clamp ( double  fValue) const
inline

clamp value on range

Definition at line 143 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::clamp(), and maRange.

◆ expand() [1/2]

void basegfx::B1DRange::expand ( const B1DRange rRange)
inline

add rRange to the set, expanding as necessary

Definition at line 131 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::expand(), and maRange.

◆ expand() [2/2]

void basegfx::B1DRange::expand ( double  fValue)
inline

add fValue to the set, expanding as necessary

Definition at line 125 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::expand(), and maRange.

Referenced by B1DRange().

◆ getCenter()

double basegfx::B1DRange::getCenter ( ) const
inline

return middle of upper and lower value. returns 0 for empty sets.

Definition at line 101 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::getCenter(), and maRange.

◆ getMaximum()

double basegfx::B1DRange::getMaximum ( ) const
inline

get upper bound of the set. returns arbitrary values for empty sets.

Definition at line 89 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::getMaximum(), and maRange.

◆ getMinimum()

double basegfx::B1DRange::getMinimum ( ) const
inline

get lower bound of the set. returns arbitrary values for empty sets.

Definition at line 83 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::getMinimum(), and maRange.

◆ getRange()

double basegfx::B1DRange::getRange ( ) const
inline

return difference between upper and lower value. returns 0 for empty sets.

Definition at line 95 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::getRange(), and maRange.

◆ intersect()

void basegfx::B1DRange::intersect ( const B1DRange rRange)
inline

calc set intersection

Definition at line 137 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::intersect(), and maRange.

◆ isEmpty()

bool basegfx::B1DRange::isEmpty ( ) const
inline

Check if the interval set is empty.

Returns
false, if no value is in this set - having a single value included will already return true.

Definition at line 67 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::isEmpty(), and maRange.

◆ isInside()

bool basegfx::B1DRange::isInside ( double  fValue) const
inline

yields true if value is contained in set

Definition at line 107 of file b1drange.hxx.

References basegfx::BasicRange< T, Traits >::isInside(), and maRange.

◆ operator!=()

bool basegfx::B1DRange::operator!= ( const B1DRange rRange) const
inline

Definition at line 77 of file b1drange.hxx.

References maRange.

◆ operator==()

bool basegfx::B1DRange::operator== ( const B1DRange rRange) const
inline

Definition at line 72 of file b1drange.hxx.

References maRange.

◆ overlaps()

bool basegfx::B1DRange::overlaps ( const B1DRange rRange) const
inline

yields true if rRange at least partly inside set

Definition at line 113 of file b1drange.hxx.

References maRange, and basegfx::BasicRange< T, Traits >::overlaps().

◆ overlapsMore()

bool basegfx::B1DRange::overlapsMore ( const B1DRange rRange) const
inline

yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal

Definition at line 119 of file b1drange.hxx.

References maRange, and basegfx::BasicRange< T, Traits >::overlapsMore().

Member Data Documentation

◆ maRange

::basegfx::BasicRange< double, DoubleTraits > basegfx::B1DRange::maRange
private

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