45 #include <visp3/core/vpDebug.h> 46 #include <visp3/core/vpRect.h> 64 vpRect::vpRect(
double l,
double t,
double w,
double h) : left(l), top(t), width(w), height(h) {}
75 : left(topLeft.get_u()), top(topLeft.get_v()), width(w), height(h)
84 : left(topLeft.get_u()), top(topLeft.get_v()), width(0), height(0)
86 this->left = topLeft.
get_u();
87 this->top = topLeft.
get_v();
106 this->width = r.width;
107 this->height = r.height;
116 vpRect::vpRect(
const std::vector<vpImagePoint> &ip) : left(0), top(0), width(0), height(0) {
set(ip); }
157 left = topLeft.
get_u();
158 top = topLeft.
get_v();
174 minu = maxu = ip[0].get_u();
175 minv = maxv = ip[0].get_v();
177 for (
size_t i = 1; i < ip.size(); i++) {
178 double u = ip[i].get_u();
179 double v = ip[i].get_v();
205 this->left = topLeft.
get_u();
206 this->top = topLeft.
get_v();
225 return (std::fabs(top - r.top) <= std::fabs(top) * std::numeric_limits<double>::epsilon() &&
226 std::fabs(left - r.left) <= std::fabs(left) * std::numeric_limits<double>::epsilon() &&
227 std::fabs(width - r.width) <= std::fabs(width) * std::numeric_limits<double>::epsilon() &&
228 std::fabs(height - r.height) <= std::fabs(height) * std::numeric_limits<double>::epsilon());
247 return !(*
this == r);
258 double x1 = (std::max)(left, r.left);
259 double y1 = (std::max)(top, r.top);
260 width = (std::min)(left + width, r.left + r.width) - x1;
261 height = (std::min)(top + height, r.top + r.height) - y1;
265 if (width <= 0 || height <= 0) {
error that can be emited by ViSP classes.
bool operator!=(const vpRect &r) const
void set(double left, double top, double width, double height)
vpRect operator &(const vpRect &r) const
bool isInside(const vpImagePoint &ip) const
friend VISP_EXPORT bool inRectangle(const vpImagePoint &ip, const vpRect &rect)
vpRect & operator &=(const vpRect &r)
void setRight(double pos)
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpRect &r)
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 ...
vpRect & operator=(const vpRect &r)
void setBottom(double pos)
bool operator==(const vpRect &r) const