Box: Remove unnecessary constructors
parent
e6c159fb70
commit
f85e3765db
16
src/zm_box.h
16
src/zm_box.h
|
@ -28,16 +28,9 @@
|
||||||
// defined by two coordinates
|
// defined by two coordinates
|
||||||
//
|
//
|
||||||
class Box {
|
class Box {
|
||||||
private:
|
|
||||||
Vector2 lo, hi;
|
|
||||||
Vector2 size;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline Box() : lo(0, 0), hi(0, 0), size(0, 0) {}
|
Box() = default;
|
||||||
explicit inline Box(unsigned int p_size) : lo(0, 0), hi(p_size - 1, p_size - 1), size(Vector2::Range(hi, lo)) {}
|
Box(Vector2 p_lo, Vector2 p_hi) : lo(p_lo), hi(p_hi), size(Vector2::Range(hi, lo)) {}
|
||||||
inline Box(int p_x_size, int p_y_size) : lo(0, 0), hi(p_x_size - 1, p_y_size - 1), size(Vector2::Range(hi, lo)) {}
|
|
||||||
inline Box(int lo_x, int lo_y, int hi_x, int hi_y) : lo(lo_x, lo_y), hi(hi_x, hi_y), size(Vector2::Range(hi, lo)) {}
|
|
||||||
inline Box(const Vector2 &p_lo, const Vector2 &p_hi) : lo(p_lo), hi(p_hi), size(Vector2::Range(hi, lo)) {}
|
|
||||||
|
|
||||||
inline const Vector2 &Lo() const { return lo; }
|
inline const Vector2 &Lo() const { return lo; }
|
||||||
inline int LoX() const { return lo.x_; }
|
inline int LoX() const { return lo.x_; }
|
||||||
|
@ -62,6 +55,11 @@ class Box {
|
||||||
inline bool Inside(const Vector2 &coord) const {
|
inline bool Inside(const Vector2 &coord) const {
|
||||||
return (coord.x_ >= lo.x_ && coord.x_ <= hi.x_ && coord.y_ >= lo.y_ && coord.y_ <= hi.y_);
|
return (coord.x_ >= lo.x_ && coord.x_ <= hi.x_ && coord.y_ >= lo.y_ && coord.y_ <= hi.y_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vector2 lo;
|
||||||
|
Vector2 hi;
|
||||||
|
Vector2 size;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ZM_BOX_H
|
#endif // ZM_BOX_H
|
||||||
|
|
|
@ -62,7 +62,7 @@ Polygon::Polygon(int p_n_coords, const Vector2 *p_coords) : n_coords(p_n_coords)
|
||||||
if (max_y == -1 || coords[i].y_ > max_y)
|
if (max_y == -1 || coords[i].y_ > max_y)
|
||||||
max_y = coords[i].y_;
|
max_y = coords[i].y_;
|
||||||
}
|
}
|
||||||
extent = Box(min_x, min_y, max_x, max_y);
|
extent = Box({min_x, min_y}, {max_x, max_y});
|
||||||
calcArea();
|
calcArea();
|
||||||
calcCentre();
|
calcCentre();
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ Image *StreamBase::prepareImage(Image *image) {
|
||||||
hi_y = act_image_height - 1;
|
hi_y = act_image_height - 1;
|
||||||
lo_y = hi_y - (send_image_height - 1);
|
lo_y = hi_y - (send_image_height - 1);
|
||||||
}
|
}
|
||||||
last_crop = Box( lo_x, lo_y, hi_x, hi_y );
|
last_crop = Box({lo_x, lo_y}, {hi_x, hi_y});
|
||||||
} // end if ( mag != last_mag || x != last_x || y != last_y )
|
} // end if ( mag != last_mag || x != last_x || y != last_y )
|
||||||
|
|
||||||
Debug(3, "Cropping to %d,%d -> %d,%d", last_crop.LoX(), last_crop.LoY(), last_crop.HiX(), last_crop.HiY());
|
Debug(3, "Cropping to %d,%d -> %d,%d", last_crop.LoX(), last_crop.LoY(), last_crop.HiX(), last_crop.HiY());
|
||||||
|
|
|
@ -35,8 +35,6 @@ class ZoneStats {
|
||||||
alarm_blobs_(0),
|
alarm_blobs_(0),
|
||||||
min_blob_size_(0),
|
min_blob_size_(0),
|
||||||
max_blob_size_(0),
|
max_blob_size_(0),
|
||||||
alarm_box_({}),
|
|
||||||
alarm_centre_({}),
|
|
||||||
score_(0) {};
|
score_(0) {};
|
||||||
|
|
||||||
void Reset() {
|
void Reset() {
|
||||||
|
@ -47,10 +45,7 @@ class ZoneStats {
|
||||||
alarm_blobs_ = 0;
|
alarm_blobs_ = 0;
|
||||||
min_blob_size_ = 0;
|
min_blob_size_ = 0;
|
||||||
max_blob_size_ = 0;
|
max_blob_size_ = 0;
|
||||||
alarm_box_.LoX(0);
|
alarm_box_ = {};
|
||||||
alarm_box_.LoY(0);
|
|
||||||
alarm_box_.HiX(0);
|
|
||||||
alarm_box_.HiY(0);
|
|
||||||
alarm_centre_ = {};
|
alarm_centre_ = {};
|
||||||
score_ = 0;
|
score_ = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue