78 #include <visp3/core/vpException.h>
79 #include <visp3/core/vpImagePoint.h>
87 vpRect(
double left,
double top,
double width,
double height);
91 vpRect(
const std::vector<vpImagePoint> &ip);
100 inline double getBottom()
const {
return (this->top + this->height - 1.0); }
107 bottomRight.
set_u( getRight() );
108 bottomRight.
set_v( getBottom() );
124 x = this->left + this->width / 2.0 - 0.5;
125 y = this->top + this->height / 2.0 - 0.5;
140 center.
set_u( this->left + this->width / 2.0 - 0.5 );
141 center.
set_v( this->top + this->height / 2.0 - 0.5 );
152 inline double getHeight()
const {
return this->height; }
159 inline double getLeft()
const {
return this->left; }
165 inline double getRight()
const {
return (this->left + this->width - 1.0); }
171 inline double getSize()
const {
return (this->width * this->height); }
178 inline double getTop()
const {
return this->top; }
187 topLeft.
set_u( this->left );
188 topLeft.
set_v( this->top );
199 inline double getWidth()
const {
return this->width; }
206 bool operator==(
const vpRect &r)
const;
207 bool operator!=(
const vpRect &r)
const;
212 friend VISP_EXPORT std::ostream& operator<< (std::ostream &os,
const vpRect& r);
213 void set(
double left,
double top,
double width,
double height);
214 void set(
const vpImagePoint &topLeft,
double width,
double height);
216 void set(
const vpRect& r);
217 void set(
const std::vector<vpImagePoint> &ip);
226 inline void setBottom(
double pos) { this->height = pos - this->top + 1.0; }
235 this->height = bottomRight.
get_v() - this->top + 1.0;
236 this->width = bottomRight.
get_u() - this->left + 1.0;
257 inline void setLeft(
double pos) { this->left = pos; }
269 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; }
302 this->left = topLeft.
get_u();
303 this->top = topLeft.
get_v();
324 this->left = x - this->width/2 + 0.5;
325 this->top = y - this->height/2 + 0.5;
335 this->left = center.
get_u() - this->width/2 + 0.5;
336 this->top = center.
get_v() - this->height/2 + 0.5;
void getCenter(double &x, double &y) const
vpImagePoint getTopLeft() const
void set_u(const double u)
vpImagePoint getBottomRight() const
void moveCenter(const vpImagePoint ¢er)
void set_v(const double v)
void moveCenter(double x, double y)
void setTopLeft(const vpImagePoint &topLeft)
void setRight(double pos)
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 ...
vpImagePoint getCenter() const
void setRect(double l, double t, double w, double h)
void setBottomRight(const vpImagePoint &bottomRight)
void setBottom(double pos)