Public Member Functions | Protected Member Functions | Protected Attributes

Geom::Rectangle< T > Class Template Reference

basic 2D rectangle class More...

Inheritance diagram for Geom::Rectangle< T >:
Geom::PixRectangle< T > Geom::PosRectangle< T >

List of all members.

Public Member Functions

 Rectangle (T l=0, T t=0, T r=0, T b=0)
 Rectangle (const Point2D< T > &tl, const Point2D< T > &br)
 Rectangle (const Point2D< T > &tl, const Size2D< T > &sz)
bool operator== (const Rectangle< T > &) const
bool operator!= (const Rectangle< T > &) const
Point2D< T > topLeft () const
Point2D< T > topRight () const
Point2D< T > bottomLeft () const
Point2D< T > bottomRight () const
Point2D< T > centre () const
void setTopLeft (Point2D< T >)
void setBottomRight (Point2D< T >)
void setTopRight (Point2D< T >)
void setBottomLeft (Point2D< T >)
void setTopBottom (const Interval< T > &)
void setLeftRight (const Interval< T > &)
Point2D< T > moveInside (const Point2D< T > &) const
void include (const Rectangle< T > &)
void limitTo (const Rectangle< T > &)
bool operator> (const Rectangle< T > &) const
width () const
height () const
left () const
top () const
right () const
bottom () const
void setLeft (T val)
void setTop (T val)
void setRight (T val)
void setBottom (T val)
void checkCorners (bool leftislow=true, bool topislow=true)
Size2D< T > size () const
void zero ()
Rectangle< T > & operator+= (const Point2D< T > &)
Rectangle< T > & operator-= (const Point2D< T > &)
Rectangle< T > & operator+= (const Size2D< T > &)
Rectangle< T > & operator-= (const Size2D< T > &)
void swapHor ()
void swapVer ()

Protected Member Functions

bool revX () const
bool revY () const

Protected Attributes

Point2D< T > topleft_
Point2D< T > bottomright_

Detailed Description

template<class T>
class Geom::Rectangle< T >

basic 2D rectangle class

This class is a bit more complicated than would be expected at first sight. This is caused by the problem of coordinate system sign. For example, in user interfaces, top is a lower number than bottom. But for normal coordinates, this is (of course) not the case. Still, also for floating point types, reverse axes are common.


Constructor & Destructor Documentation

template<class T >
Geom::Rectangle< T >::Rectangle ( l = 0,
t = 0,
r = 0,
b = 0 
) [inline]
template<class T >
Geom::Rectangle< T >::Rectangle ( const Point2D< T > &  tl,
const Point2D< T > &  br 
) [inline]
template<class T >
Geom::Rectangle< T >::Rectangle ( const Point2D< T > &  tl,
const Size2D< T > &  sz 
) [inline]

Member Function Documentation

template<class T >
T Geom::Rectangle< T >::bottom (  )  const [inline]
template<class T >
Point2D< T > Geom::Rectangle< T >::bottomLeft (  )  const [inline]
template<class T >
Point2D< T > Geom::Rectangle< T >::bottomRight (  )  const [inline]
template<class T >
Point2D< T > Geom::Rectangle< T >::centre (  )  const [inline]
template<class T >
void Geom::Rectangle< T >::checkCorners ( bool  leftislow = true,
bool  topislow = true 
) [inline]
template<class T >
T Geom::Rectangle< T >::height (  )  const [inline]
template<class T >
void Geom::Rectangle< T >::include ( const Rectangle< T > &  r  )  [inline]
template<class T >
T Geom::Rectangle< T >::left (  )  const [inline]
template<class T >
void Geom::Rectangle< T >::limitTo ( const Rectangle< T > &  r  )  [inline]
template<class T >
Point2D< T > Geom::Rectangle< T >::moveInside ( const Point2D< T > &  pt  )  const [inline]
template<class T >
bool Geom::Rectangle< T >::operator!= ( const Rectangle< T > &  r  )  const [inline]
template<class T >
Rectangle< T > & Geom::Rectangle< T >::operator+= ( const Size2D< T > &  sz  )  [inline]
template<class T >
Rectangle< T > & Geom::Rectangle< T >::operator+= ( const Point2D< T > &  p  )  [inline]
template<class T >
Rectangle< T > & Geom::Rectangle< T >::operator-= ( const Point2D< T > &  p  )  [inline]
template<class T >
Rectangle< T > & Geom::Rectangle< T >::operator-= ( const Size2D< T > &  sz  )  [inline]
template<class T >
bool Geom::Rectangle< T >::operator== ( const Rectangle< T > &  r  )  const [inline]
template<class T >
bool Geom::Rectangle< T >::operator> ( const Rectangle< T > &  r  )  const [inline]
template<class T >
bool Geom::Rectangle< T >::revX (  )  const [inline, protected]
template<class T >
bool Geom::Rectangle< T >::revY (  )  const [inline, protected]
template<class T >
T Geom::Rectangle< T >::right (  )  const [inline]
template<class T >
void Geom::Rectangle< T >::setBottom ( val  )  [inline]
template<class T >
void Geom::Rectangle< T >::setBottomLeft ( Point2D< T >  tr  )  [inline]
template<class T >
void Geom::Rectangle< T >::setBottomRight ( Point2D< T >  br  )  [inline]
template<class T >
void Geom::Rectangle< T >::setLeft ( val  )  [inline]
template<class T >
void Geom::Rectangle< T >::setLeftRight ( const Interval< T > &  rg  )  [inline]
template<class T >
void Geom::Rectangle< T >::setRight ( val  )  [inline]
template<class T >
void Geom::Rectangle< T >::setTop ( val  )  [inline]
template<class T >
void Geom::Rectangle< T >::setTopBottom ( const Interval< T > &  rg  )  [inline]
template<class T >
void Geom::Rectangle< T >::setTopLeft ( Point2D< T >  tl  )  [inline]
template<class T >
void Geom::Rectangle< T >::setTopRight ( Point2D< T >  tr  )  [inline]
template<class T >
Size2D< T > Geom::Rectangle< T >::size (  )  const [inline]
template<class T >
void Geom::Rectangle< T >::swapHor (  )  [inline]
template<class T >
void Geom::Rectangle< T >::swapVer (  )  [inline]
template<class T >
T Geom::Rectangle< T >::top (  )  const [inline]
template<class T >
Point2D< T > Geom::Rectangle< T >::topLeft (  )  const [inline]
template<class T >
Point2D< T > Geom::Rectangle< T >::topRight (  )  const [inline]
template<class T >
T Geom::Rectangle< T >::width (  )  const [inline]
template<class T >
void Geom::Rectangle< T >::zero (  )  [inline]

Member Data Documentation

template<class T>
Point2D<T> Geom::Rectangle< T >::bottomright_ [protected]
template<class T>
Point2D<T> Geom::Rectangle< T >::topleft_ [protected]