22 template <
class T,
class ENABLE =
void>
27 static_assert(IsNumeric<T>::value,
"CVB: Unsupported data type - must be numeric!");
31 class Rect<T, typename EnableIfNumeric<T>::type> final
46 : left_(static_cast<T>(0))
47 , top_(static_cast<T>(0))
48 , right_(static_cast<T>(-1))
49 , bottom_(static_cast<T>(-1)) {};
59 Rect(T left, T top, T right, T bottom)
noexcept
59 Rect(T left, T top, T right, T bottom)
noexcept {
…}
166 return right_ - left_ +
static_cast<T
>(1);
176 right_ = left_ + width -
static_cast<T
>(1);
186 return bottom_ - top_ +
static_cast<T
>(1);
196 bottom_ = top_ + height -
static_cast<T
>(1);
237 right_ = location.X() +
Width();
238 bottom_ = location.Y() +
Height();
239 left_ = location.X();
251 return (point.X() >=
Left()) && (point.Y() >=
Top()) && (point.X() <=
Right()) && (point.Y() <=
Bottom());
273 return (top_ == rect.top_ && left_ == rect.left_ && bottom_ == rect.bottom_ && right_ == rect.right_);
284 return !(*
this == rect);
295 explicit operator Rect<C, typename std::enable_if<!std::is_integral<C>::value>::type>()
const noexcept
318 static_assert(IsNumeric<T>::value,
"CVB: Unsupported data type - must be numeric!");
Multi-purpose 2D vector class.
Definition point_2d.hpp:20
Rectangle object.
Definition rect.hpp:24
T Bottom() const noexcept
Gets bottom row of the rectangle (still inside the rectangle).
Definition rect.hpp:144
bool Contains(Point2D< T > point) const noexcept
Checks if this rectangle contains a point.
Definition rect.hpp:249
T Height() const noexcept
Gets the height of the rectangle.
Definition rect.hpp:184
void SetRight(T right) noexcept
Sets rightmost column of the rectangle (still inside the rectangle).
Definition rect.hpp:134
void SetWidth(T width) noexcept
Sets the width of the rectangle.
Definition rect.hpp:174
Rect() noexcept
Default rectangle in the integral type system.
Definition rect.hpp:45
void SetBottom(T bottom) noexcept
Sets bottom row of the rectangle (still inside the rectangle).
Definition rect.hpp:154
bool operator!=(const Rect< T > &rect) const noexcept
Compares to another rectangle.
Definition rect.hpp:282
Rect(T left, T top, T right, T bottom) noexcept
Constructor for a rectangle.
Definition rect.hpp:59
CoordinateSystemType CoordinateSystem() const noexcept
Indicates the coordinate system in which this object is being measured (when used as an area of inter...
Definition rect.hpp:260
Size2D< T > Size() const noexcept
Gets the size of the rectangle.
Definition rect.hpp:204
void SetLeft(T left) noexcept
Sets first column of the rectangle.
Definition rect.hpp:94
void SetLocation(Point2D< T > location) noexcept
Sets the location of the top left corner of the rectangle.
Definition rect.hpp:235
T Top() const noexcept
Gets first row of the rectangle.
Definition rect.hpp:104
bool operator==(const Rect< T > &rect) const noexcept
Compares to another rectangle.
Definition rect.hpp:271
T Right() const noexcept
Gets rightmost column of the rectangle (still inside the rectangle).
Definition rect.hpp:124
T Left() const noexcept
Gets first column of the rectangle.
Definition rect.hpp:84
void SetHeight(T height) noexcept
Sets the height of the rectangle.
Definition rect.hpp:194
void SetTop(T top) noexcept
Sets first row of the rectangle.
Definition rect.hpp:114
void SetSize(Size2D< T > size) noexcept
Gets the size of the rectangle.
Definition rect.hpp:214
Rect(Point2D< T > location, Size2D< T > size) noexcept
Constructor for a rectangle.
Definition rect.hpp:73
T Width() const noexcept
Gets the width of the rectangle.
Definition rect.hpp:164
Point2D< T > Location() const noexcept
Gets the location of the top left corner of the rectangle.
Definition rect.hpp:225
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition size_2d.hpp:20
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
CoordinateSystemType
Enumeration of the different available coordinate systems that an Area of interest may be defined in.
Definition global.hpp:290
@ PixelCoordinates
Definition global.hpp:298
Point2D< int > Round(const Point2D< T > &rhs) noexcept
Round to an integer point.
Definition point_2d.hpp:371