110 Rect(
int x,
int y,
int width,
int height){
114 this->height = height;
121 this->width = s.width;
122 this->height = s.height;
129 this->width = r.width;
130 this->height = r.height;
137 bool isNull()
const {
return (*
this)==
null; }
141 return x==s.x && y==s.y && width==s.width && height==s.height;
146 return x!=s.x || y!= s.y || width!=s.width || height!=s.height;
151 return Rect((
int)(d*x),(
int)(d*y),(
int)(d*width),(
int)(d*height));
156 return Rect((
int)(x/d),(
int)(y/d),(
int)(width/d),(
int)(height/d));
162 return Rect(x,y,width+s.width,height+s.height);
167 return Rect(x,y,width-s.width,height-s.height);
172 width+=s.width; height+=s.height;
return *
this;
177 width-=s.width; height-=s.height;
return *
this;
182 return Rect(x+p.x,y+p.y,width,height);
187 return Rect(x-p.x,y-p.y,width,height);
192 x+=p.x; y+=p.y;
return *
this;
197 x-=p.x; y-=p.y;
return *
this;
204 width=(int)((
float)width*d);
205 height=(int)((
float)height*d);
212 width=(int)((
float)width/d);
213 height=(int)((
float)height/d);
217 int getDim()
const {
return width*height;}
223 Rect result (ul.x, ul.y, lr.x-ul.x, lr.y-ul.y);
224 if (result.width > 0 && result.height > 0)
return result;
238 return Rect (ul.x, ul.y, lr.x-ul.x, lr.y-ul.y);
251 if (r.width < 0) {r.x += r.width; r.width = -r.width; }
252 if (r.height < 0) {r.y += r.height; r.height = -r.height; }
258 return x<=r.x && y <= r.y && right() >= r.
right() && bottom() >= r.
bottom();
268 return this->x<=x && right()>x && this->y<=y && bottom()>y;
278 x-=k; y-=k; width+=2*k; height+=2*k;
295 return Point(x,y+height);
299 return Point(x+width,y);
303 return Point(x+width,y+height);
308 return Point(x+width/2,y+height/2);
315 int right()
const {
return x+width; }
321 int top()
const {
return y; }
327 return Rect((
int)(xfac*x),(
int)(yfac*y),(
int)(xfac*width), (
int)(yfac*height));
bool contains(int x, int y) const
returns if the Rect contains a given point (pixel-based)
Definition: Rect.h:267
Rect operator-(const Size &s) const
substracts a size for the rects size
Definition: Rect.h:166
bool isNull() const
checks wether the object instance is null, i.e. all elements are zero
Definition: Rect.h:137
undocument this line if you encounter any issues!
Definition: Any.h:37
Rect(const Point &p, const Size &s)
creates a new Rect with specified offset and size
Definition: Rect.h:118
Rect & operator-=(const Size &s)
substracs a size from the rects size
Definition: Rect.h:176
#define ICLUtils_API
this macros are important for creating dll's
Definition: CompatMacros.h:171
Rect operator|(const Rect &r) const
union of two Rects
Definition: Rect.h:235
Point ur() const
returns upper right point of the rect
Definition: Rect.h:298
Rect & operator+=(const Size &s)
adds a size to the rects size
Definition: Rect.h:171
Rect transform(double xfac, double yfac) const
Definition: Rect.h:326
Rect operator+(const Size &s) const
adds a size to the rects size
Definition: Rect.h:161
Rect()
default constructor
Definition: Rect.h:102
Rect & enlarge(int k)
let the rect grow by k pixles into each direction
Definition: Rect.h:277
#define iclMin(A, B)
Definition: Macros.h:204
int bottom() const
returns the position of the bottom border
Definition: Rect.h:318
int left() const
returns the left border position
Definition: Rect.h:312
int top() const
returns the position of the upper border
Definition: Rect.h:321
bool operator==(const Rect &s) const
checks if two rects are equal
Definition: Rect.h:140
Rect operator+(const Point &p) const
adds a Point to the rects offset
Definition: Rect.h:181
Rect & operator|=(const Rect &r)
inplace union of two rects
Definition: Rect.h:242
bool operator!=(const Rect &s) const
checks if two rects are not equal
Definition: Rect.h:145
Floating point precision implementation of the Rect class.
Definition: Rect32f.h:45
Point ul() const
returns upper left point of the rect
Definition: Rect.h:290
Point center() const
returns the center Point of the rect
Definition: Rect.h:307
FixedMatrix< T, V_COLS, M_ROWS_AND_COLS > & operator *=(FixedMatrix< T, V_COLS, M_ROWS_AND_COLS > &v, const FixedMatrix< T, M_ROWS_AND_COLS, M_ROWS_AND_COLS > &m)
Matrix multiplication (inplace)
Definition: FixedMatrix.h:959
int getDim() const
returns width*height
Definition: Rect.h:217
Rect normalized() const
rects with negative sizes are normalized to Positive sizes
Definition: Rect.h:249
Rect operator/(double d) const
scales all parameters of the rect by a double value
Definition: Rect.h:155
Size getSize() const
returns the size of the rect
Definition: Rect.h:324
Size class of the ICL.
Definition: Size.h:61
bool contains(const Rect &r) const
returns if a Rect containes another rect
Definition: Rect.h:257
#define iclMax(A, B)
Definition: Macros.h:207
ICLUtils_API std::ostream & operator<<(std::ostream &s, const ConfigFile &cf)
Default ostream operator to put a ConfigFile into a stream.
int right() const
returns the right border position
Definition: Rect.h:315
Rect(const Rect &r)
create a deep copy of a rect
Definition: Rect.h:126
ICLUtils_API std::istream & operator>>(std::istream &s, Point &p)
istream operator
Rect & operator/=(double d)
scales all rect params inplace
Definition: Rect.h:209
Rect enlarged(int k) const
returns an enlarged instance of this rect
Definition: Rect.h:284
ICLQt_API ImgQ operator *(const ImgQ &a, const ImgQ &b)
multiplies two images pixel-wise
Rect & operator&=(const Rect &r)
inplace intersection of two rects
Definition: Rect.h:229
Point class of the ICL used e.g. for the Images ROI offset.
Definition: Point.h:58
Point ll() const
returns lower left point of the rect
Definition: Rect.h:294
Rect(int x, int y, int width, int height)
creates a defined Rect
Definition: Rect.h:110
Rect & operator-=(const Point &p)
substracts a Point from the rects offset
Definition: Rect.h:196
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Definition: Rect.h:95
Rect & operator+=(const Point &p)
adds a Point to the rects offset
Definition: Rect.h:191
Rect operator-(const Point &p) const
substracts a Point from the rects offset
Definition: Rect.h:186
Point lr() const
returns lower right point of the rect
Definition: Rect.h:302