24template<
class T,
class ENABLE =
void>
50 : left_(static_cast<T>(0))
51 , top_(static_cast<T>(0))
52 , right_(static_cast<T>(-1))
53 , bottom_(static_cast<T>(-1))
66 Rect(T left, T top, T right, T bottom)
noexcept
173 return right_ - left_ +
static_cast<T
>(1);
183 right_ = left_ + width -
static_cast<T
>(1);
193 return bottom_ - top_ +
static_cast<T
>(1);
203 bottom_ = top_ + height -
static_cast<T
>(1);
244 right_ = location.X() +
Width();
245 bottom_ = location.Y() +
Height();
246 left_ = location.X();
258 return (point.X() >=
Left()) && (point.Y() >=
Top()) && (point.X() <=
Right()) && (point.Y() <=
Bottom());
280 return (top_ == rect.top_
281 && left_ == rect.left_
282 && bottom_ == rect.bottom_
283 && right_ == rect.right_);
295 return !(*
this == rect);
303 static_cast<C
>(
Left()),
304 static_cast<C
>(
Top()),
305 static_cast<C
>(
Right()),
311 explicit operator Rect<C, typename std::enable_if<!std::is_integral<C>::value>::type>()
const noexcept
314 static_cast<C
>(
Left()),
315 static_cast<C
>(
Top()),
316 static_cast<C
>(
Right()),
342 return Rect<int>(
static_cast<int>(std::round(rhs.Left())),
343 static_cast<int>(std::round(rhs.Top())),
344 static_cast<int>(std::round(rhs.Right())),
345 static_cast<int>(std::round(rhs.Bottom())));
Multi-purpose 2D vector class.
Definition: point_2d.hpp:20
Rectangle object.
Definition: rect.hpp:26
T Bottom() const noexcept
Gets bottom row of the rectangle (still inside the rectangle).
Definition: rect.hpp:151
bool Contains(Point2D< T > point) const noexcept
Checks if this rectangle contains a point.
Definition: rect.hpp:256
T Height() const noexcept
Gets the height of the rectangle.
Definition: rect.hpp:191
void SetRight(T right) noexcept
Sets rightmost column of the rectangle (still inside the rectangle).
Definition: rect.hpp:141
void SetWidth(T width) noexcept
Sets the width of the rectangle.
Definition: rect.hpp:181
Rect() noexcept
Default rectangle in the integral type system.
Definition: rect.hpp:49
void SetBottom(T bottom) noexcept
Sets bottom row of the rectangle (still inside the rectangle).
Definition: rect.hpp:161
bool operator!=(const Rect< T > &rect) const noexcept
Compares to another rectangle.
Definition: rect.hpp:293
Rect(T left, T top, T right, T bottom) noexcept
Constructor for a rectangle.
Definition: rect.hpp:66
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:267
Size2D< T > Size() const noexcept
Gets the size of the rectangle.
Definition: rect.hpp:211
void SetLeft(T left) noexcept
Sets first column of the rectangle.
Definition: rect.hpp:101
void SetLocation(Point2D< T > location) noexcept
Sets the location of the top left corner of the rectangle.
Definition: rect.hpp:242
T Top() const noexcept
Gets first row of the rectangle.
Definition: rect.hpp:111
bool operator==(const Rect< T > &rect) const noexcept
Compares to another rectangle.
Definition: rect.hpp:278
T Right() const noexcept
Gets rightmost column of the rectangle (still inside the rectangle).
Definition: rect.hpp:131
T Left() const noexcept
Gets first column of the rectangle.
Definition: rect.hpp:91
void SetHeight(T height) noexcept
Sets the height of the rectangle.
Definition: rect.hpp:201
void SetTop(T top) noexcept
Sets first row of the rectangle.
Definition: rect.hpp:121
void SetSize(Size2D< T > size) noexcept
Gets the size of the rectangle.
Definition: rect.hpp:221
Rect(Point2D< T > location, Size2D< T > size) noexcept
Constructor for a rectangle.
Definition: rect.hpp:80
T Width() const noexcept
Gets the width of the rectangle.
Definition: rect.hpp:171
Point2D< T > Location() const noexcept
Gets the location of the top left corner of the rectangle.
Definition: rect.hpp:232
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition: size_2d.hpp:20
T Height() const noexcept
Gets the vertical component of the size.
Definition: size_2d.hpp:79
T Width() const noexcept
Gets the horizontal component of the size.
Definition: size_2d.hpp:59
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
CoordinateSystemType
Enumeration of the different available coordinate systems that an Area of interest may be defined in.
Definition: global.hpp:270
Point2D< int > Round(const Point2D< T > &rhs) noexcept
Round to an integer point.
Definition: point_2d.hpp:380