template<class S>
nCine::AABB class

Axis-Aligned Bounding Box in a two dimensional space.

Public static functions

static auto Intersect(const AABB<S>& a, const AABB<S>& b) -> AABB<S>
Intersects this AABB with the other AABB.
static auto Combine(const AABB<S>& a, const AABB<S>& b) -> AABB<S>
Combines two AABBs.

Constructors, destructors, conversion operators

AABB() constexpr noexcept
AABB(NoInitT) explicit noexcept
AABB(S l, S t, S r, S b) constexpr noexcept
AABB(const Vector2<S>& min, const Vector2<S>& max) constexpr noexcept

Public functions

template<class U>
auto As() -> AABB<U> constexpr
auto GetWidth() const -> S constexpr
auto GetHeight() const -> S constexpr
auto GetCenter() const -> Vector2<S>
Calculates the center of the rectangle.
auto GetExtents() const -> Vector2<S>
Returns extents.
auto GetPerimeter() const -> S
Returns perimeter.
auto Contains(S px, S py) const -> bool
Returns true if the point is inside this rectangle.
auto Contains(const Vector2<S>& p) const -> bool
Returns true if the point vector is inside this rectangle.
auto Contains(const AABB<S>& aabb) const -> bool
Returns true if the other rectangle is contained inside this one.
auto Overlaps(const AABB<S>& aabb) const -> bool
Returns true if this rect does overlap the other rectangle in any way.
auto operator==(const AABB& aabb) const -> bool
Eqality operator.
auto operator!=(const AABB& aabb) const -> bool
auto operator+=(const Vector2<S>& v) -> AABB&
auto operator-=(const Vector2<S>& v) -> AABB&
auto operator+(const Vector2<S>& v) const -> AABB
auto operator-(const Vector2<S>& v) const -> AABB
auto Contains(std::int32_t px, std::int32_t py) const -> bool

Public variables

S L
Top-left X coordinate.
S T
Top-left Y coordinate.
S R
Bottom-right X coordinate.
S B
Bottom-right Y coordinate.