Extend AABB class
This commit is contained in:
@@ -35,6 +35,12 @@ namespace OpenVulkano::Math
|
||||
this->min = min;
|
||||
this->max = max;
|
||||
}
|
||||
|
||||
void Init(const Math::Vector3f& point, float radius)
|
||||
{
|
||||
min = point - radius;
|
||||
max = point + radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Initiates the AABB from some other AABB
|
||||
@@ -83,6 +89,16 @@ namespace OpenVulkano::Math
|
||||
return !(other.min.x > max.x || other.max.x < min.x || other.min.y > max.y ||
|
||||
other.max.y < min.y || other.min.z > max.z || other.max.z < min.z);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool InBounds(const Math::Vector3f& position) const
|
||||
{
|
||||
return min >= position && position <= max;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool Inside(const Math::Vector3f& position) const
|
||||
{
|
||||
return min > position && position < max;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Resets the AABB to min=Inf, max=-Inf, same as Init()
|
||||
|
||||
Reference in New Issue
Block a user