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();
89 setBottom(bottomRight.
get_v());
90 setRight(bottomRight.
get_u());
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); }
139 void vpRect::set(
double l,
double t,
double w,
double h)
157 left = topLeft.
get_u();
158 top = topLeft.
get_v();
168 void vpRect::set(
const std::vector<vpImagePoint> &ip)
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);
257 double x1 = (std::max)(left, r.left);
258 double y1 = (std::max)(top, r.top);
259 width = (std::min)(left + width, r.left + r.width) - x1;
260 height = (std::min)(top + height, r.top + r.height) - y1;
264 if (width <= 0 || height <= 0) {