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

A two-dimensional interval over integers. More...

#include <b2irange.hxx>

Inheritance diagram for basegfx::B2IRange:
[legend]
Collaboration diagram for basegfx::B2IRange:
[legend]

Public Member Functions

 B2IRange ()
 
 B2IRange (const Tuple2D< ValueType > &rTuple)
 Create degenerate interval consisting of a single point. More...
 
 B2IRange (const Tuple2D< ValueType > &rTuple1, const Tuple2D< ValueType > &rTuple2)
 Create proper interval between the two given points. More...
 
 B2IRange (ValueType x1, ValueType y1, ValueType x2, ValueType y2)
 
B2IPoint getMinimum () const
 get lower bound of the set. returns arbitrary values for empty sets. More...
 
B2IPoint getMaximum () const
 get upper bound of the set. returns arbitrary values for empty sets. More...
 
B2I64Tuple getRange () const
 return difference between upper and lower point. returns (0,0) for empty sets. More...
 
- Public Member Functions inherited from basegfx::Range2D< sal_Int32, Int32Traits >
 Range2D ()=default
 
 Range2D (const Tuple2D< sal_Int32 > &rTuple)
 Create degenerate interval consisting of a single point. More...
 
 Range2D (const Tuple2D< sal_Int32 > &rTuple1, const Tuple2D< sal_Int32 > &rTuple2)
 Create proper interval between the two given points. More...
 
 Range2D (sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2)
 Create proper interval between the two given pairs. More...
 
bool isEmpty () const
 Check if the interval set is empty. More...
 
void reset ()
 reset the object to empty state again, clearing all values More...
 
bool operator== (const Range2D &rRange) const
 
bool operator!= (const Range2D &rRange) const
 
bool equal (const Range2D &rRange) const
 
sal_Int32 getMinX () const
 get lower bound of the set. returns arbitrary values for empty sets. More...
 
sal_Int32 getMinY () const
 get lower bound of the set. returns arbitrary values for empty sets. More...
 
sal_Int32 getMaxX () const
 get upper bound of the set. returns arbitrary values for empty sets. More...
 
sal_Int32 getMaxY () const
 get upper bound of the set. returns arbitrary values for empty sets. More...
 
sal_Int32 getWidth () const
 return difference between upper and lower X value. returns 0 for empty sets. More...
 
sal_Int32 getHeight () const
 return difference between upper and lower Y value. returns 0 for empty sets. More...
 
double getCenterX () const
 return center X value of set. returns 0 for empty sets. More...
 
double getCenterY () const
 return center Y value of set. returns 0 for empty sets. More...
 
bool isInside (const Tuple2D< sal_Int32 > &rTuple) const
 yields true if given point is contained in set More...
 
bool isInside (const Range2D &rRange) const
 yields true if rRange is inside, or equal to set More...
 
bool overlaps (const Range2D &rRange) const
 yields true if rRange at least partly inside set More...
 
bool overlapsMore (const Range2D &rRange) const
 yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal More...
 
void expand (const Tuple2D< sal_Int32 > &rTuple)
 add point to the set, expanding as necessary More...
 
void expand (const Range2D &rRange)
 add rRange to the set, expanding as necessary More...
 
void intersect (const Range2D &rRange)
 calc set intersection More...
 
void grow (sal_Int32 fValue)
 grow set by fValue on all sides More...
 
void grow (const Tuple2D< sal_Int32 > &rTuple)
 grow set by axis aware values from rTuple More...
 
Tuple2D< sal_Int32 > clamp (const Tuple2D< sal_Int32 > &rTuple) const
 clamp value on range More...
 

Additional Inherited Members

- Public Types inherited from basegfx::Range2D< sal_Int32, Int32Traits >
typedef sal_Int32 ValueType
 
typedef Int32Traits TraitsType
 
- Protected Attributes inherited from basegfx::Range2D< sal_Int32, Int32Traits >
basegfx::BasicRange< sal_Int32, Int32TraitsmaRangeX
 
basegfx::BasicRange< sal_Int32, Int32TraitsmaRangeY
 

Detailed Description

A two-dimensional interval over integers.

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

Probably you rather want B2IBox for integers.

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.

See also
B2IBox

Definition at line 52 of file b2irange.hxx.

Constructor & Destructor Documentation

◆ B2IRange() [1/4]

basegfx::B2IRange::B2IRange ( )
inline

Definition at line 55 of file b2irange.hxx.

◆ B2IRange() [2/4]

basegfx::B2IRange::B2IRange ( const Tuple2D< ValueType > &  rTuple)
inlineexplicit

Create degenerate interval consisting of a single point.

Definition at line 60 of file b2irange.hxx.

◆ B2IRange() [3/4]

basegfx::B2IRange::B2IRange ( const Tuple2D< ValueType > &  rTuple1,
const Tuple2D< ValueType > &  rTuple2 
)
inline

Create proper interval between the two given points.

Definition at line 66 of file b2irange.hxx.

◆ B2IRange() [4/4]

basegfx::B2IRange::B2IRange ( ValueType  x1,
ValueType  y1,
ValueType  x2,
ValueType  y2 
)
inline

Definition at line 72 of file b2irange.hxx.

Member Function Documentation

◆ getMaximum()

B2IPoint basegfx::B2IRange::getMaximum ( ) const
inline

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

Definition at line 86 of file b2irange.hxx.

References basegfx::BasicRange< T, Traits >::getMaximum(), basegfx::Range2D< sal_Int32, Int32Traits >::maRangeX, and basegfx::Range2D< sal_Int32, Int32Traits >::maRangeY.

◆ getMinimum()

B2IPoint basegfx::B2IRange::getMinimum ( ) const
inline

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

Definition at line 77 of file b2irange.hxx.

References basegfx::BasicRange< T, Traits >::getMinimum(), basegfx::Range2D< sal_Int32, Int32Traits >::maRangeX, and basegfx::Range2D< sal_Int32, Int32Traits >::maRangeY.

◆ getRange()

B2I64Tuple basegfx::B2IRange::getRange ( ) const
inline

return difference between upper and lower point. returns (0,0) for empty sets.

Definition at line 95 of file b2irange.hxx.

References basegfx::BasicRange< T, Traits >::getRange(), basegfx::Range2D< sal_Int32, Int32Traits >::maRangeX, and basegfx::Range2D< sal_Int32, Int32Traits >::maRangeY.


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