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);
91 inline double getArea()
const {
return width * height; }
97 inline double getBottom()
const {
return (this->top + this->height - 1.0); }
107 bottomLeft.
set_u(getLeft());
108 bottomLeft.
set_v(getBottom());
120 bottomRight.
set_u(getRight());
121 bottomRight.
set_v(getBottom());
138 x = this->left + this->width / 2.0 - 0.5;
139 y = this->top + this->height / 2.0 - 0.5;
155 center.
set_u(this->left + this->width / 2.0 - 0.5);
156 center.
set_v(this->top + this->height / 2.0 - 0.5);
166 inline double getHeight()
const {
return this->height; }
173 inline double getLeft()
const {
return this->left; }
179 inline double getRight()
const {
return (this->left + this->width - 1.0); }
185 inline double getSize()
const {
return (this->width * this->height); }
192 inline double getTop()
const {
return this->top; }
202 topLeft.
set_u(getLeft());
203 topLeft.
set_v(getTop());
215 topRight.
set_u(getRight());
216 topRight.
set_v(getTop());
227 inline double getWidth()
const {
return this->width; }
234 bool operator==(
const vpRect &r)
const;
235 bool operator!=(
const vpRect &r)
const;
241 friend VISP_EXPORT std::ostream &operator<<(std::ostream &os,
const vpRect &r);
243 void set(
double left,
double top,
double width,
double height);
244 void set(
const vpImagePoint &topLeft,
double width,
double height);
246 void set(
const vpRect &r);
247 void set(
const std::vector<vpImagePoint> &ip);
256 inline void setBottom(
double pos) { this->height = pos - this->top + 1.0; }
266 this->height = bottomRight.
get_v() - this->top + 1.0;
267 this->width = bottomRight.
get_u() - this->left + 1.0;
289 inline void setLeft(
double pos) { this->left = pos; }
301 inline void setRect(
double l,
double t,
double w,
double h)
316 inline void setRight(
double pos) { this->width = pos - this->left + 1.0; }
325 inline void setTop(
double pos) { this->top = pos; }
336 this->left = topLeft.
get_u();
337 this->top = topLeft.
get_v();
360 this->left = x - this->width / 2 + 0.5;
361 this->top = y - this->height / 2 + 0.5;
372 this->left = center.
get_u() - this->width / 2 + 0.5;
373 this->top = center.
get_v() - this->height / 2 + 0.5;
vpImagePoint getTopRight() const
void getCenter(double &x, double &y) const
vpImagePoint getTopLeft() const
vpImagePoint getCenter() const
void moveCenter(const vpImagePoint ¢er)
void moveCenter(double x, double y)
void setTopLeft(const vpImagePoint &topLeft)
void setRight(double pos)
vpImagePoint getBottomRight() const
Defines a rectangle in the plane.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void setRect(double l, double t, double w, double h)
void setBottomRight(const vpImagePoint &bottomRight)
void setBottom(double pos)
vpImagePoint getBottomLeft() const