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

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

#include <b2drange.hxx>

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

Public Member Functions

 B2DRange ()
 
 B2DRange (const Tuple2D< ValueType > &rTuple)
 Create degenerate interval consisting of a single point. More...
 
 B2DRange (const Tuple2D< ValueType > &rTuple1, const Tuple2D< ValueType > &rTuple2)
 Create proper interval between the two given points. More...
 
 B2DRange (ValueType x1, ValueType y1, ValueType x2, ValueType y2)
 
BASEGFX_DLLPUBLIC B2DRange (const B2IRange &rRange)
 
B2DPoint getMinimum () const
 get lower bound of the set. returns arbitrary values for empty sets. More...
 
B2DPoint getMaximum () const
 get upper bound of the set. returns arbitrary values for empty sets. More...
 
B2DVector getRange () const
 return difference between upper and lower point. returns (0,0) for empty sets. More...
 
B2DPoint getCenter () const
 return center point of set. returns (0,0) for empty sets. More...
 
BASEGFX_DLLPUBLIC void transform (const B2DHomMatrix &rMatrix)
 Transform Range by given transformation matrix. More...
 
BASEGFX_DLLPUBLIC B2DRangeoperator*= (const ::basegfx::B2DHomMatrix &rMat)
 Transform Range by given transformation matrix. More...
 
- Public Member Functions inherited from basegfx::Range2D< double, DoubleTraits >
 Range2D ()=default
 
 Range2D (const Tuple2D< double > &rTuple)
 Create degenerate interval consisting of a single point. More...
 
 Range2D (const Tuple2D< double > &rTuple1, const Tuple2D< double > &rTuple2)
 Create proper interval between the two given points. More...
 
 Range2D (double x1, double y1, double x2, double 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
 
double getMinX () const
 get lower bound of the set. returns arbitrary values for empty sets. More...
 
double getMinY () const
 get lower bound of the set. returns arbitrary values for empty sets. More...
 
double getMaxX () const
 get upper bound of the set. returns arbitrary values for empty sets. More...
 
double getMaxY () const
 get upper bound of the set. returns arbitrary values for empty sets. More...
 
double getWidth () const
 return difference between upper and lower X value. returns 0 for empty sets. More...
 
double 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< double > &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< double > &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 (double fValue)
 grow set by fValue on all sides More...
 
void grow (const Tuple2D< double > &rTuple)
 grow set by axis aware values from rTuple More...
 
Tuple2D< double > clamp (const Tuple2D< double > &rTuple) const
 clamp value on range More...
 

Static Public Member Functions

static BASEGFX_DLLPUBLIC const B2DRangegetUnitB2DRange ()
 Get a range filled with (0.0, 0.0, 1.0, 1.0) More...
 

Additional Inherited Members

- Public Types inherited from basegfx::Range2D< double, DoubleTraits >
typedef double ValueType
 
typedef DoubleTraits TraitsType
 
- Protected Attributes inherited from basegfx::Range2D< double, DoubleTraits >
basegfx::BasicRange< double, DoubleTraitsmaRangeX
 
basegfx::BasicRange< double, DoubleTraitsmaRangeY
 

Detailed Description

A two-dimensional interval over doubles.

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

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
B1DRange

Definition at line 53 of file b2drange.hxx.

Constructor & Destructor Documentation

◆ B2DRange() [1/5]

basegfx::B2DRange::B2DRange ( )
inline

Definition at line 56 of file b2drange.hxx.

◆ B2DRange() [2/5]

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

Create degenerate interval consisting of a single point.

Definition at line 61 of file b2drange.hxx.

◆ B2DRange() [3/5]

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

Create proper interval between the two given points.

Definition at line 67 of file b2drange.hxx.

◆ B2DRange() [4/5]

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

Definition at line 73 of file b2drange.hxx.

◆ B2DRange() [5/5]

basegfx::B2DRange::B2DRange ( const B2IRange rRange)
explicit

Member Function Documentation

◆ getCenter()

B2DPoint basegfx::B2DRange::getCenter ( ) const
inline

return center point of set. returns (0,0) for empty sets.

Definition at line 107 of file b2drange.hxx.

Referenced by basegfx::utils::createAreaGeometryForLineStartEnd(), and basegfx::utils::createPolygonFromRect().

◆ getMaximum()

B2DPoint basegfx::B2DRange::getMaximum ( ) const
inline

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

Definition at line 89 of file b2drange.hxx.

Referenced by basegfx::utils::createAreaGeometryForLineStartEnd(), and basegfx::fround().

◆ getMinimum()

B2DPoint basegfx::B2DRange::getMinimum ( ) const
inline

◆ getRange()

B2DVector basegfx::B2DRange::getRange ( ) const
inline

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

Definition at line 98 of file b2drange.hxx.

Referenced by basegfx::utils::createRotateAroundCenterKeepAspectRatioStayInsideRange().

◆ getUnitB2DRange()

const B2DRange & basegfx::B2DRange::getUnitB2DRange ( )
static

Get a range filled with (0.0, 0.0, 1.0, 1.0)

Definition at line 57 of file b2drange.cxx.

◆ operator*=()

B2DRange & basegfx::B2DRange::operator*= ( const ::basegfx::B2DHomMatrix rMat)

Transform Range by given transformation matrix.

This operation transforms the Range by transforming all four possible extrema points (corners) of the given range and building a new one. This means that the range will grow evtl. when a shear and/or rotation is part of the transformation.

Definition at line 51 of file b2drange.cxx.

References transform().

◆ transform()

void basegfx::B2DRange::transform ( const B2DHomMatrix rMatrix)

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