27 #include <glm/vec2.hpp>
28 #include <glm/common.hpp>
68 constexpr glm::vec2
size()
const {
80 constexpr
void size(T x, T y) {
81 size(glm::vec2(x, y));
104 constexpr
void scale(glm::vec2 factor) {
113 scale(glm::vec2(x, y));
158 const auto i_left = glm::max(this->left, rect.
left);
159 const auto i_top = glm::max(this->
top, rect.
top);
160 const auto i_right = glm::min(this->
right, rect.
right);
161 const auto i_bottom = glm::min(this->
bottom, rect.
bottom);
162 return Eng3D::Rectangle{ i_left, i_top, i_right - i_left, i_bottom - i_top };
169 const auto i_left = glm::min(this->left, rect.
left);
170 const auto i_top = glm::min(this->
top, rect.
top);
171 const auto i_right = glm::max(this->
right, rect.
right);
172 const auto i_bottom = glm::max(this->
bottom, rect.
bottom);
173 return Eng3D::Rectangle{ i_left, i_top, i_right - i_left, i_bottom - i_top };
176 typedef struct Rectangle
Rect;
constexpr void position(T x, T y)
constexpr glm::vec2 size() const
Obtains the current size of the rectangle.
constexpr void scale(T x, T y)
constexpr bool contains(const Rectangle &rect) const
Checks if the rectangle is contains the rectangle.
constexpr Rectangle join(const Rectangle &rect) const
Obtains the intersection rectangle from two other rectangles R1 and R2.
constexpr Rectangle(glm::vec2 position, glm::vec2 size)
constexpr float height() const
Obtains the height.
constexpr void size(glm::vec2 size)
Sets the size of the rectangle.
constexpr Rectangle()=default
constexpr Rectangle intersection(const Rectangle &rect) const
Obtains the intersection rectangle from two other rectangles R1 and R2.
constexpr void size(T x, T y)
constexpr Rectangle(float x, float y, float width, float height)
constexpr bool contains(T x, T y) const
constexpr void offset(glm::vec2 offset)
Offset the rectangle by the given parameter.
constexpr void scale(glm::vec2 factor)
Scales the rectangle by factor.
constexpr float width() const
Obtains the width.
constexpr glm::vec2 position() const
Obtains the current position of the rectangle.
constexpr bool contains(glm::vec2 pos) const
Checks if the point is contains the point.
constexpr void position(glm::vec2 position)
Sets the base position of the rectangle, modifying it's size.
constexpr void offset(T x, T y)