Add constructor to AABB

This commit is contained in:
Georg Hagen
2024-07-13 19:38:07 +02:00
parent 0b8d889c86
commit d2fcba381a

View File

@@ -20,6 +20,12 @@ namespace OpenVulkano::Math
AABB() : Range(Math::Vector3f(INFINITY), Math::Vector3f(-INFINITY)) {}
AABB(const Math::Vector3f& min, const Math::Vector3f& max) : Range(min, max) {}
AABB(const Vector3f& point) : Range(point, point)
{}
AABB(const Vector3f& point, float radius) : Range(point - radius, point + radius)
{}
/**
* \brief Initiates the AABB to a single point (min=max=point)
@@ -92,12 +98,12 @@ namespace OpenVulkano::Math
[[nodiscard]] bool InBounds(const Math::Vector3f& position) const
{
return min >= position && position <= max;
return Math::Utils::all(Math::Utils::greaterThanEqual(min, position)) && Math::Utils::all(Math::Utils::lessThanEqual(position, max));
}
[[nodiscard]] bool Inside(const Math::Vector3f& position) const
{
return min > position && position < max;
return Math::Utils::all(Math::Utils::greaterThan(min, position)) && Math::Utils::all(Math::Utils::lessThan(position, max));
}
/**