Rectangle.H File Reference

#include "Image/Dims.H"
#include "Image/Point2D.H"
#include "Util/Assert.H"
#include <algorithm>
#include <string>
Include dependency graph for Rectangle.H:

Go to the source code of this file.

Classes

class  Rectangle
 A basic rectangle class. More...

Functions

std::string convertToString (const Rectangle &val)
 Rectangle overload: format is "<int>,<int>,<int>,<int>".
void convertFromString (const std::string &str, Rectangle &val)
 Rectangle overload: format is "<int>,<int>,<int>,<int>".
Rectangle constrainRect (const Rectangle &in, const Rectangle &bounds, int minw, int maxw, int minh, int maxh)
 Return a new rectangle that is a constrained version of the input.
Rectangle constrainRect (const Rectangle &in, const Rectangle &bounds, int minsz, int maxsz)
 Like the main constrainRect(), but use the same limits for width as for height.
bool operator== (const Rectangle &r1, const Rectangle &r2)
Rectangle operator* (const Rectangle &r, const double s)
Rectangle operator* (const Rectangle &r, const int s)
Rectangle operator/ (const Rectangle &r, const int div)
Rectangle operator+ (const Rectangle &r, const Point2D< int > &p)
Rectangleoperator+= (Rectangle &r, const Point2D< int > &p)
Rectangle operator- (const Rectangle &r, const Point2D< int > &p)
Rectangleoperator-= (Rectangle &r, const Point2D< int > &p)

Detailed Description

A basic rectangle class

Definition in file Rectangle.H.


Function Documentation

Rectangle constrainRect ( const Rectangle in,
const Rectangle bounds,
int  minsz,
int  maxsz 
) [inline]

Like the main constrainRect(), but use the same limits for width as for height.

Definition at line 290 of file Rectangle.H.

References constrainRect().

Rectangle constrainRect ( const Rectangle in,
const Rectangle bounds,
int  minw,
int  maxw,
int  minh,
int  maxh 
)

Return a new rectangle that is a constrained version of the input.

Parameters:
in The original rectangle on which to base the constrained output.
bounds The output rectangle will be constrained to be contained within these bounds.
minw The minimum width for the output rectangle. Caller must ensure minw>=0. If the output rectangle would naturally be narrower than this width, then it will be widened to the smaller of minw and bounds.width().
maxw The maximum width for the output rectangle. Caller must ensure maxw>=minw. If the output rectangle would naturally be wider than this width, then it will be narrowed to the smaller of maxw and bounds.width().
minh The minimum height for the output rectangle. Caller must ensure minh>=0. If the output rectangle would naturally be shorter than this height, then it will be lengthened to the smaller of minh and bounds.height().
maxh The maximum height for the output rectangle. Caller must ensure maxh>=minh. If the output rectangle would naturally be taller than this height, then it will be shortened to the smaller of maxh and bounds.height().
Returns:
The result is guaranteed to be such that the following conditions are all true:
    bounds.contains(result);
    result.width() >= std::min(minw, bounds.width());
    result.width() <= std::min(maxw, bounds.width());
    result.height() >= std::min(minh, bounds.height());
    result.height() <= std::min(maxh, bounds.height());

Definition at line 75 of file Rectangle.C.

References ASSERT, Rectangle::bottomO(), Rectangle::contains(), Rectangle::getOverlap(), Rectangle::height(), Rectangle::left(), min(), Rectangle::rightO(), Rectangle::tlbrO(), Rectangle::top(), and Rectangle::width().

Referenced by constrainRect().

void convertFromString ( const std::string str,
Rectangle val 
)

Rectangle overload: format is "<int>,<int>,<int>,<int>".

Definition at line 64 of file Rectangle.C.

References Rectangle::tlbrO().

std::string convertToString ( const Rectangle val  ) 

Rectangle overload: format is "<int>,<int>,<int>,<int>".

Format corresponds to "xtopleft,ytopleft,xbottomright,ybottomright"

Definition at line 51 of file Rectangle.C.

References Rectangle::bottomO(), Rectangle::isValid(), Rectangle::left(), Rectangle::rightO(), and Rectangle::top().

Generated on Sun May 8 08:42:42 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3