Struct Rect
Defined in File Rect.hpp
Struct Documentation
-
struct Rect
Rect structure
x,y coordinates together with width and height that define a rectangle. Can be either normalized [0,1] or absolute representation.
Public Functions
-
Rect() = default
-
inline Rect(float x, float y, float width, float height)
Construct Rectangle from (x, y) coordinates of the top-left corner, width and height.
-
inline Rect(float x, float y, float width, float height, bool normalized)
Construct Rectangle from (x, y) coordinates of the top-left corner, width, height and normalization flag.
- Parameters:
x – Top-left x coordinate
y – Top-left y coordinate
width – Width of the rectangle
height – Height of the rectangle
normalized – Whether the rectangle is normalized (coordinates in [0,1] range) or not
-
inline Rect(const Point2f &org, const Size2f &sz, bool normalized)
Construct Rectangle from top left point, size and normalization flag.
Note
: if normalized is true, the coordinates are in [0,1] range
-
inline Rect(const Point2f &pt1, const Point2f &pt2)
Construct Rectangle between any two given points. Constructor will determine top-left and bottom-right points.
- Parameters:
pt1 – First point
pt2 – Second point
-
inline Rect(const Point2f &pt1, const Point2f &pt2, bool normalized)
Construct Rectangle between any two given points with normalization flag. Constructor will determine top-left and bottom-right points.
- Parameters:
pt1 – First point
pt2 – Second point
normalized – Whether the rectangle is normalized (coordinates in [0,1] range) or not
-
inline float area() const
Area (width*height) of the rectangle
-
inline bool empty() const
True if rectangle is empty.
-
inline bool isNormalized() const
Whether rectangle is normalized (coordinates in [0,1] range) or not.
-
Rect() = default