Image Component Library (ICL)
|
Rectangle class of the ICL used e.g. for the Images ROI-rect. More...
#include <Rect.h>
Public Member Functions | |
Rect () | |
default constructor | |
Rect (int x, int y, int width, int height) | |
creates a defined Rect | |
Rect (const Point &p, const Size &s) | |
creates a new Rect with specified offset and size | |
Rect (const Rect &r) | |
create a deep copy of a rect | |
Rect (const Rect32f &other) | |
creates a Rect from given Rect32f instance | |
bool | isNull () const |
checks wether the object instance is null, i.e. all elements are zero | |
bool | operator== (const Rect &s) const |
checks if two rects are equal | |
bool | operator!= (const Rect &s) const |
checks if two rects are not equal | |
Rect | operator* (double d) const |
scales all parameters of the rect by a double value | |
Rect | operator/ (double d) const |
scales all parameters of the rect by a double value | |
Rect | operator+ (const Size &s) const |
adds a size to the rects size | |
Rect | operator- (const Size &s) const |
substracts a size for the rects size | |
Rect & | operator+= (const Size &s) |
adds a size to the rects size | |
Rect & | operator-= (const Size &s) |
substracs a size from the rects size | |
Rect | operator+ (const Point &p) const |
adds a Point to the rects offset | |
Rect | operator- (const Point &p) const |
substracts a Point from the rects offset | |
Rect & | operator+= (const Point &p) |
adds a Point to the rects offset | |
Rect & | operator-= (const Point &p) |
substracts a Point from the rects offset | |
Rect & | operator*= (double d) |
scales all rect params inplace | |
Rect & | operator/= (double d) |
scales all rect params inplace | |
int | getDim () const |
returns width*height | |
Rect | operator& (const Rect &r) const |
intersection of two Rects | |
Rect & | operator&= (const Rect &r) |
inplace intersection of two rects | |
Rect | operator| (const Rect &r) const |
union of two Rects | |
Rect & | operator|= (const Rect &r) |
inplace union of two rects | |
Rect | normalized () const |
rects with negative sizes are normalized to Positive sizes | |
bool | contains (const Rect &r) const |
returns if a Rect containes another rect | |
bool | contains (int x, int y) const |
returns if the Rect contains a given point (pixel-based) | |
Rect & | enlarge (int k) |
let the rect grow by k pixles into each direction | |
Rect | enlarged (int k) const |
returns an enlarged instance of this rect | |
Point | ul () const |
returns upper left point of the rect | |
Point | ll () const |
returns lower left point of the rect | |
Point | ur () const |
returns upper right point of the rect | |
Point | lr () const |
returns lower right point of the rect | |
Point | center () const |
returns the center Point of the rect | |
int | left () const |
returns the left border position | |
int | right () const |
returns the right border position | |
int | bottom () const |
returns the position of the bottom border | |
int | top () const |
returns the position of the upper border | |
Size | getSize () const |
returns the size of the rect | |
Rect | transform (double xfac, double yfac) const |
Static Public Attributes | |
static const Rect | null |
null Rect is w=0, h=0, x=0, y=0 |
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Please take care of the following conventions when using Rects in the ICL library:
|------ width ------>| ............................ ............................ origin(x,y)---->Xooooooooooooooooooooo.... ___ ..oooooooooooooooooooooo.... /|\ ..oooooooooooooooooooooo.... | ..oooooooooooooooooooooo.... height ..oooooooooooooooooooooo.... | ..oooooooooooooooooooooo.... _|_ ............................ ............................
Please note, that a rect fits a discrete set of points: For instance the Rect (x=2,y=1,width=3,height=4) contains exactly 3x4=12 points i.e. those ones with and . Hence a full image roi of an image of size 640x480 has an offset of (0,0), a size of 640x480, but it contains only x-values within the range 0-639 and y-values within range 0-479.
icl::utils::Rect::Rect | ( | ) | [inline] |
default constructor
icl::utils::Rect::Rect | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) | [inline] |
creates a defined Rect
icl::utils::Rect::Rect | ( | const Point & | p, |
const Size & | s | ||
) | [inline] |
creates a new Rect with specified offset and size
icl::utils::Rect::Rect | ( | const Rect & | r | ) | [inline] |
create a deep copy of a rect
icl::utils::Rect::Rect | ( | const Rect32f & | other | ) |
int icl::utils::Rect::bottom | ( | ) | const [inline] |
returns the position of the bottom border
Point icl::utils::Rect::center | ( | ) | const [inline] |
returns the center Point of the rect
bool icl::utils::Rect::contains | ( | const Rect & | r | ) | const [inline] |
returns if a Rect containes another rect
bool icl::utils::Rect::contains | ( | int | x, |
int | y | ||
) | const [inline] |
returns if the Rect contains a given point (pixel-based)
Note: We are talking here in terms of pixel-based rects: The rect x=5,y=5,width=10,height=20 contains the x-indices withing the interval [5,15[ (half-opened interval). In terms of discrete X-values, the intervall meets the set {5,6,...13,14}. The same is true for Y-values.
Rect& icl::utils::Rect::enlarge | ( | int | k | ) | [inline] |
let the rect grow by k pixles into each direction
if k<0 the rect becomes smaller E.g. Rect(10,10,90,90).enlarge(10) creates a Rect (0,0,100,100)
k | amount of pixel the rectangle is enlarged by |
Rect icl::utils::Rect::enlarged | ( | int | k | ) | const [inline] |
returns an enlarged instance of this rect
int icl::utils::Rect::getDim | ( | ) | const [inline] |
returns width*height
Size icl::utils::Rect::getSize | ( | ) | const [inline] |
returns the size of the rect
bool icl::utils::Rect::isNull | ( | ) | const [inline] |
checks wether the object instance is null, i.e. all elements are zero
int icl::utils::Rect::left | ( | ) | const [inline] |
returns the left border position
Point icl::utils::Rect::ll | ( | ) | const [inline] |
returns lower left point of the rect
Point icl::utils::Rect::lr | ( | ) | const [inline] |
returns lower right point of the rect
Rect icl::utils::Rect::normalized | ( | ) | const [inline] |
rects with negative sizes are normalized to Positive sizes
e.g. the rect (5,5,-5,-5) is normalized to (0,0,5,5)
bool icl::utils::Rect::operator!= | ( | const Rect & | s | ) | const [inline] |
checks if two rects are not equal
Rect icl::utils::Rect::operator* | ( | double | d | ) | const [inline] |
scales all parameters of the rect by a double value
Rect& icl::utils::Rect::operator*= | ( | double | d | ) | [inline] |
scales all rect params inplace
substracts a size for the rects size
substracts a Point from the rects offset
substracts a Point from the rects offset
Rect icl::utils::Rect::operator/ | ( | double | d | ) | const [inline] |
scales all parameters of the rect by a double value
Rect& icl::utils::Rect::operator/= | ( | double | d | ) | [inline] |
scales all rect params inplace
bool icl::utils::Rect::operator== | ( | const Rect & | s | ) | const [inline] |
checks if two rects are equal
int icl::utils::Rect::right | ( | ) | const [inline] |
returns the right border position
int icl::utils::Rect::top | ( | ) | const [inline] |
returns the position of the upper border
Rect icl::utils::Rect::transform | ( | double | xfac, |
double | yfac | ||
) | const [inline] |
Point icl::utils::Rect::ul | ( | ) | const [inline] |
returns upper left point of the rect
Point icl::utils::Rect::ur | ( | ) | const [inline] |
returns upper right point of the rect
const Rect icl::utils::Rect::null [static] |
null Rect is w=0, h=0, x=0, y=0