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);
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) {
bool operator==(const vpRect &r) const
error that can be emited by ViSP classes.
void set(double left, double top, double width, double height)
friend VISP_EXPORT bool inRectangle(const vpImagePoint &ip, const vpRect &rect)
void setRight(double pos)
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpRect &r)
Defines a rectangle in the plane.
bool isInside(const vpImagePoint &ip) const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
vpRect & operator&=(const vpRect &r)
bool operator!=(const vpRect &r) const
vpRect & operator=(const vpRect &r)
void setBottom(double pos)
vpRect operator&(const vpRect &r) const