24template<
class T,
class ENABLE =
void>
52 : left_(static_cast<T>(0))
53 , top_(static_cast<T>(0))
54 , right_(static_cast<T>(-1))
55 , bottom_(static_cast<T>(-1))
68 Rect(T left, T top, T right, T bottom)
noexcept
175 return right_ - left_ +
static_cast<T
>(1);
185 right_ = left_ + width -
static_cast<T
>(1);
195 return bottom_ - top_ +
static_cast<T
>(1);
205 bottom_ = top_ + height -
static_cast<T
>(1);
246 right_ = location.X() +
Width();
247 bottom_ = location.Y() +
Height();
248 left_ = location.X();
260 return (point.X() >=
Left()) && (point.Y() >=
Top()) && (point.X() <=
Right()) && (point.Y() <=
Bottom());
282 return (top_ == rect.top_
283 && left_ == rect.left_
284 && bottom_ == rect.bottom_
285 && right_ == rect.right_);
297 return !(*
this == rect);
305 static_cast<C
>(
Left()),
306 static_cast<C
>(
Top()),
307 static_cast<C
>(
Right()),
313 explicit operator Rect<C, typename std::enable_if<!std::is_integral<C>::value>::type>()
const noexcept
316 static_cast<C
>(
Left()),
317 static_cast<C
>(
Top()),
318 static_cast<C
>(
Right()),
344 return Rect<int>(
static_cast<int>(std::round(rhs.Left())),
345 static_cast<int>(std::round(rhs.Top())),
346 static_cast<int>(std::round(rhs.Right())),
347 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:153
bool Contains(Point2D< T > point) const noexcept
Checks if this rectangle contains a point.
Definition: rect.hpp:258
T Height() const noexcept
Gets the height of the rectangle.
Definition: rect.hpp:193
void SetRight(T right) noexcept
Sets rightmost column of the rectangle (still inside the rectangle).
Definition: rect.hpp:143
void SetWidth(T width) noexcept
Sets the width of the rectangle.
Definition: rect.hpp:183
Rect() noexcept
Default rectangle in the integral type system.
Definition: rect.hpp:51
void SetBottom(T bottom) noexcept
Sets bottom row of the rectangle (still inside the rectangle).
Definition: rect.hpp:163
bool operator!=(const Rect< T > &rect) const noexcept
Compares to another rectangle.
Definition: rect.hpp:295
Rect(T left, T top, T right, T bottom) noexcept
Constructor for a rectangle.
Definition: rect.hpp:68
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:269
Size2D< T > Size() const noexcept
Gets the size of the rectangle.
Definition: rect.hpp:213
void SetLeft(T left) noexcept
Sets first column of the rectangle.
Definition: rect.hpp:103
void SetLocation(Point2D< T > location) noexcept
Sets the location of the top left corner of the rectangle.
Definition: rect.hpp:244
T Top() const noexcept
Gets first row of the rectangle.
Definition: rect.hpp:113
bool operator==(const Rect< T > &rect) const noexcept
Compares to another rectangle.
Definition: rect.hpp:280
T Right() const noexcept
Gets rightmost column of the rectangle (still inside the rectangle).
Definition: rect.hpp:133
T Left() const noexcept
Gets first column of the rectangle.
Definition: rect.hpp:93
void SetHeight(T height) noexcept
Sets the height of the rectangle.
Definition: rect.hpp:203
void SetTop(T top) noexcept
Sets first row of the rectangle.
Definition: rect.hpp:123
void SetSize(Size2D< T > size) noexcept
Gets the size of the rectangle.
Definition: rect.hpp:223
Rect(Point2D< T > location, Size2D< T > size) noexcept
Constructor for a rectangle.
Definition: rect.hpp:82
T Width() const noexcept
Gets the width of the rectangle.
Definition: rect.hpp:173
Point2D< T > Location() const noexcept
Gets the location of the top left corner of the rectangle.
Definition: rect.hpp:234
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:80
T Width() const noexcept
Gets the horizontal component of the size.
Definition: size_2d.hpp:60
Root namespace for the Image Manager interface.
Definition: c_barcode.h:15
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:382