From d2fcba381aa77380d763e3ec320d0b3667043fc7 Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 13 Jul 2024 19:38:07 +0200 Subject: [PATCH] Add constructor to AABB --- openVulkanoCpp/Math/AABB.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openVulkanoCpp/Math/AABB.hpp b/openVulkanoCpp/Math/AABB.hpp index 45f065c..4f9b944 100644 --- a/openVulkanoCpp/Math/AABB.hpp +++ b/openVulkanoCpp/Math/AABB.hpp @@ -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)); } /**