#include <nCine/Primitives/AABB.h>
template<class S>
AABB class
Axis-aligned bounding box in a two-dimensional space.
Stored as the left, top, right and bottom edges (L, T, R, B). Provides width and height accessors, center, extents and perimeter queries, containment and overlap tests, intersection and combination of two boxes, and translation by a Vector2.
Public static functions
Constructors, destructors, conversion operators
Public functions
-
template<class U>auto As() -> AABB<U> constexpr
- Converts the bounding box to a different element type.
- auto GetWidth() const -> S constexpr
- Returns the width of the box.
- auto GetHeight() const -> S constexpr
- Returns the height of the box.
- auto GetCenter() const -> Vector2<S>
- Returns the center of the box.
- auto GetExtents() const -> Vector2<S>
- Returns the half-width and half-height of the box.
- auto GetPerimeter() const -> S
- Returns the perimeter of the box.
- auto Contains(S px, S py) const -> bool
- Returns
trueif the point is inside the box. - auto Contains(const Vector2<S>& p) const -> bool
- Returns
trueif the point vector is inside the box. - auto Contains(const AABB<S>& aabb) const -> bool
- Returns
trueif the other box is fully contained within this one. - auto Overlaps(const AABB<S>& aabb) const -> bool
- Returns
trueif this box overlaps the other one in any way. - auto operator==(const AABB& aabb) const -> bool
- 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