3#include <fsdk/Types/Vector2.h> 
    8    template <
typename Type>
 
   10        typedef Type ElementType;
 
   32        BaseRect(Type x_, Type y_, Type w_, Type h_) noexcept
 
 
   54        template <
typename OtherType>
 
   62            const auto r = 
right();
 
 
   94            return BaseRect(x0, y0, x1 - x0, y1 - y0);
 
 
  103            const float inter = (rect1 & rect2).
getArea();
 
  104            return inter / rect1.
getArea();
 
 
  113            const float inter = (rect1 & rect2).
getArea();
 
 
  133        template <
typename OtherType>
 
  135            if(
reinterpret_cast<const void*
>(
this) != 
reinterpret_cast<const void*
>(&other)) {
 
  136                x = 
static_cast<Type
>(other.x);
 
  137                y = 
static_cast<Type
>(other.y);
 
  138                width = 
static_cast<Type
>(other.width);
 
  139                height = 
static_cast<Type
>(other.height);
 
 
  148        template <
typename OtherType>
 
  150            return x == other.x && 
y == other.y && 
width == other.width && 
height == other.height;
 
 
  157        template <
typename OtherType>
 
  159            return !(*
this == other);
 
 
  168            newRect.
x = 
x > other.x ? 
x : other.x;
 
  169            newRect.
y = 
y > other.y ? 
y : other.y;
 
  170            newRect.
width = (
x + 
width < other.x + other.width ? 
x + 
width : other.x + other.width) - newRect.
x;
 
  172                (
y + 
height < other.y + other.height ? 
y + 
height : other.y + other.height) - newRect.
y;
 
 
  184                *
this = *
this & other;
 
 
  195            newRect.
x = 
x < other.x ? 
x : other.x;
 
  196            newRect.
y = 
y < other.y ? 
y : other.y;
 
  197            newRect.
width = (
x + 
width > other.x + other.width ? 
x + 
width : other.x + other.width) - newRect.
x;
 
  199                (
y + 
height > other.y + other.height ? 
y + 
height : other.y + other.height) - newRect.
y;
 
 
  210                *
this = *
this & other;
 
 
  221            newRect.
x = 
static_cast<Type
>(
x * scaleFactor);
 
  222            newRect.
y = 
static_cast<Type
>(
y * scaleFactor);
 
  223            newRect.
width = 
static_cast<Type
>(
width * scaleFactor);
 
  224            newRect.
height = 
static_cast<Type
>(
height * scaleFactor);
 
 
  235            newRect.
x = 
static_cast<Type
>(
x / scaleFactor);
 
  236            newRect.
y = 
static_cast<Type
>(
y / scaleFactor);
 
  237            newRect.
width = 
static_cast<Type
>(
width / scaleFactor);
 
  238            newRect.
height = 
static_cast<Type
>(
height / scaleFactor);
 
 
  251        BaseRect operator-(Vector2<typename BaseRect::ElementType> vec) {
 
  290        Type 
top() const noexcept {
 
 
  332        void adjust(Type dx, Type dy, Type dw, Type dh) 
noexcept {
 
 
  348            rect.
adjust(dx, dy, dw, dh);
 
 
 
  382    template <
typename Type>
 
  385        out.
x = in.x - 0.5 * (scaleFactor - 1) * in.width;
 
  386        out.
y = in.y - 0.5 * (scaleFactor - 1) * in.height;
 
  387        out.
width = in.width * scaleFactor;
 
  388        out.
height = in.height * scaleFactor;
 
 
  392    using Rect = BaseRect<int>;
 
  393    using FloatRect = BaseRect<float>;
 
SDK namespace.
Definition IAGSEstimator.h:8
 
BaseRect< Type > centerScale(const BaseRect< Type > &in, float scaleFactor) noexcept
scale rect out of center
Definition Rect.h:383
 
Rectangle.
Definition Rect.h:9
 
BaseRect(const BaseRect &other) noexcept
Copies another rect.
Definition Rect.h:50
 
static float intersectionOverFirstRect(const BaseRect &rect1, const BaseRect &rect2)
Calculates rects intersection rate over first rect.
Definition Rect.h:102
 
bool inside(const BaseRect &other) const noexcept
Checks whether this rect is inside of another rect.
Definition Rect.h:363
 
void setRight(Type r) noexcept
Set rect right.
Definition Rect.h:77
 
void setTop(Type t) noexcept
Set rect top.
Definition Rect.h:69
 
static float intersectionOverUnion(const BaseRect &rect1, const BaseRect &rect2)
Calculates rects intersection rate over union.
Definition Rect.h:112
 
static float intersectionOverForeground(const BaseRect &rect1, const BaseRect &rect2)
Calculates rects intersection rate over foreground.
Definition Rect.h:122
 
BaseRect(Type x_, Type y_, Type w_, Type h_) noexcept
Initializes a rectangle with given values.
Definition Rect.h:32
 
void set(const Vector2< Type > &topLeft, const Vector2< Type > &bottomRight) noexcept
Sets rect corner coordinates.
Definition Rect.h:319
 
BaseRect operator&(const BaseRect &other) const noexcept
Returns rect that is intersection of rects.
Definition Rect.h:166
 
BaseRect operator&=(const BaseRect &other) noexcept
Returns rect that is intersection of rects.
Definition Rect.h:182
 
BaseRect operator|=(const BaseRect &other) noexcept
Returns minimum area rectangle containing both rects.
Definition Rect.h:208
 
BaseRect() noexcept
Initializes a default invalid rectangle.
Definition Rect.h:19
 
void setBottom(Type b) noexcept
Set rect bottom.
Definition Rect.h:83
 
Vector2< Type > size() const noexcept
Gets rect size (width, height).
Definition Rect.h:262
 
Type right() const noexcept
Gets rect right x coordinate.
Definition Rect.h:311
 
BaseRect operator/(float scaleFactor) const noexcept
Divides Rect scale by specified scale factor.
Definition Rect.h:233
 
Vector2< Type > topLeft() const noexcept
Gets rect top-left corner coordinates.
Definition Rect.h:269
 
BaseRect & operator=(const BaseRect< OtherType > &other) noexcept
Copies another rect.
Definition Rect.h:134
 
Type top() const noexcept
Gets rect top y coordinate.
Definition Rect.h:290
 
static BaseRect coords(Type x0, Type y0, Type x1, Type y1) noexcept
Create new Rect by coordinates.
Definition Rect.h:93
 
Vector2< Type > bottomRight() const noexcept
Gets rect bottom-right corner coordinates.
Definition Rect.h:283
 
Type getArea() const noexcept
Computes rect area (width x height).
Definition Rect.h:355
 
Type height
Rectangle height.
Definition Rect.h:15
 
BaseRect operator|(const BaseRect &other) const noexcept
Returns minimum area rectangle containing both rects.
Definition Rect.h:193
 
Type left() const noexcept
Gets rect left x coordinate.
Definition Rect.h:304
 
void setLeft(Type l) noexcept
Set rect left.
Definition Rect.h:61
 
BaseRect(const Vector2< Type > &topLeft, const Vector2< Type > &bottomRight) noexcept
Initializes a rectangle with given values.
Definition Rect.h:43
 
bool operator!=(const BaseRect< OtherType > &other) const noexcept
Checks whether two rects are not equal.
Definition Rect.h:158
 
bool operator==(const BaseRect< OtherType > &other) const noexcept
Checks whether two rects are equal.
Definition Rect.h:149
 
void adjust(Type dx, Type dy, Type dw, Type dh) noexcept
Adjusts the rect by given amounts.
Definition Rect.h:332
 
BaseRect adjusted(Type dx, Type dy, Type dw, Type dh) const noexcept
Copies and adjusts the rect by given amounts.
Definition Rect.h:346
 
Type x
Upper left corner x-coordinate.
Definition Rect.h:12
 
Vector2< Type > center() const noexcept
Gets rect center coordinates.
Definition Rect.h:276
 
BaseRect operator*(float scaleFactor) const noexcept
Multiplicates Rect scale by specified scale factor.
Definition Rect.h:219
 
bool isValid() const noexcept
Checks whether a rect is valid.
Definition Rect.h:372
 
Type width
Rectangle width.
Definition Rect.h:14
 
Type y
Upper left corner y-coordinate.
Definition Rect.h:13
 
Type bottom() const noexcept
Gets rect bottom y coordinate.
Definition Rect.h:297
 
Generic 2D vector.
Definition Vector2.h:10
 
T x
x coordinate.
Definition Vector2.h:11
 
T y
y coordinate.
Definition Vector2.h:12