75 #include <visp3/core/vpException.h>
76 #include <visp3/core/vpImagePoint.h>
82 vpRect(
double left,
double top,
double width,
double height);
86 explicit vpRect(
const std::vector<vpImagePoint> &ip);
94 inline double getBottom()
const {
return (this->top + this->height - 1.0); }
102 bottomRight.
set_u(getRight());
103 bottomRight.
set_v(getBottom());
118 inline void getCenter(
double &x,
double &y)
const
120 x = this->left + this->width / 2.0 - 0.5;
121 y = this->top + this->height / 2.0 - 0.5;
137 center.
set_u(this->left + this->width / 2.0 - 0.5);
138 center.
set_v(this->top + this->height / 2.0 - 0.5);
149 inline double getHeight()
const {
return this->height; }
156 inline double getLeft()
const {
return this->left; }
162 inline double getRight()
const {
return (this->left + this->width - 1.0); }
168 inline double getSize()
const {
return (this->width * this->height); }
175 inline double getTop()
const {
return this->top; }
185 topLeft.
set_u(this->left);
186 topLeft.
set_v(this->top);
197 inline double getWidth()
const {
return this->width; }
204 bool operator==(
const vpRect &r)
const;
205 bool operator!=(
const vpRect &r)
const;
210 friend VISP_EXPORT std::ostream &operator<<(std::ostream &os,
const vpRect &r);
211 void set(
double left,
double top,
double width,
double height);
212 void set(
const vpImagePoint &topLeft,
double width,
double height);
214 void set(
const vpRect &r);
215 void set(
const std::vector<vpImagePoint> &ip);
224 inline void setBottom(
double pos) { this->height = pos - this->top + 1.0; }
232 inline void setBottomRight(
const vpImagePoint &bottomRight)
234 this->height = bottomRight.
get_v() - this->top + 1.0;
235 this->width = bottomRight.
get_u() - this->left + 1.0;
244 inline void setHeight(
double h)
257 inline void setLeft(
double pos) { this->left = pos; }
268 inline void setRect(
double l,
double t,
double w,
double h)
283 inline void setRight(
double pos) { this->width = pos - this->left + 1.0; }
292 inline void setTop(
double pos) { this->top = pos; }
303 this->left = topLeft.
get_u();
304 this->top = topLeft.
get_v();
313 inline void setWidth(
double w)
325 inline void moveCenter(
double x,
double y)
327 this->left = x - this->width / 2 + 0.5;
328 this->top = y - this->height / 2 + 0.5;
339 this->left = center.
get_u() - this->width / 2 + 0.5;
340 this->top = center.
get_v() - this->height / 2 + 0.5;