8#ifndef GALAXY_MATH_RECT_HPP_
9#define GALAXY_MATH_RECT_HPP_
24 template<meta::is_arithmetic Type>
41 Rect(const Type x, const Type y, const Type width, const Type height) noexcept;
57 bool contains(const Type _x, const Type _y) const noexcept;
140 auto operator<=>(const
Rect&) const noexcept = default;
188 template<
meta::is_arithmetic Type>
197 template<meta::is_arithmetic Type>
198 inline Rect<Type>::Rect(
const Type x,
const Type y,
const Type width,
const Type height) noexcept
206 template<meta::is_arithmetic Type>
211 template<meta::is_arithmetic Type>
218 template<meta::is_arithmetic Type>
224 template<meta::is_arithmetic Type>
234 template<meta::is_arithmetic Type>
240 template<meta::is_arithmetic Type>
243 m_xpos =
static_cast<Type
>(pos.x);
244 m_ypos =
static_cast<Type
>(pos.y);
247 template<meta::is_arithmetic Type>
253 template<meta::is_arithmetic Type>
259 template<meta::is_arithmetic Type>
262 return {
static_cast<float>(
m_xpos),
static_cast<float>(
m_ypos)};
265 template<meta::is_arithmetic Type>
271 template<meta::is_arithmetic Type>
277 template<meta::is_arithmetic Type>
281 return (value >= min) && (value <= max);
Represents a rectangle object.
bool intersects(const Rect< Type > &b) const noexcept
bool contains(const Type _x, const Type _y) const noexcept
ray::Vector2 get_top_left() const noexcept
ray::Vector2 get_size() const noexcept
bool overlaps(const Rect< Type > &b) noexcept
Type get_right() const noexcept
ray::Vector2 get_center() const noexcept
bool value_in_range(const Type value, const Type min, const Type max) noexcept
void set_top_left(const ray::Vector2 &pos) noexcept
~Rect() noexcept
Destructor.
Type get_bottom() const noexcept
Rect() noexcept
Constructor.
Rect< int > iRect
Type definition for an int rectangle.
Rect< float > fRect
Type definition for a floating point rectangle.