Add constructor to AABB
This commit is contained in:
@@ -21,6 +21,12 @@ namespace OpenVulkano::Math
|
||||
|
||||
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)
|
||||
* \param point The point that should be used as min and max of the AABB
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user