Axis-aligned bounding box.
More...
#include <OxygenEngine/scene/aabb.h>
|
| AABB ()=default |
| Create an empty box centered at origin.
|
|
| AABB (const glm::vec3 &extents) |
| Create a box centered at origin.
|
|
| AABB (const glm::vec3 &mini, const glm::vec3 &maxi) |
| Create a box by providing bounds.
|
|
glm::vec3 | getCenter () const noexcept |
| Get coordinates of the box center.
|
|
void | setBounds (const glm::vec3 &mini, const glm::vec3 &maxi) noexcept |
| Update box bounds.
|
|
void | extendToPoint (const glm::vec3 &point) noexcept |
| Update box size to contain the point.
|
|
AABB | transform (const glm::mat4 &model) const noexcept |
| Returns a new AABB transformed according to a model matrix.
|
|
void | extendToAABB (const oe::scene::AABB &aabb) noexcept |
| Increase box size to contain another AABB.
|
|
AABB & | operator+= (const AABB &aabb) noexcept |
| Increase box size to contain another AABB.
|
|
void | scale (const glm::vec3 &scale) noexcept |
| Scale the bounding box.
|
|
glm::vec3 | getExtents () const noexcept |
| Get the box distance between min and max.
|
|
float | getVolume () const noexcept |
| Get the box volume.
|
|
bool | isEmpty () const noexcept |
| Check if the box is empty.
|
|
bool | hasCollision (const AABB &box) const noexcept |
| Check an box collision with this box.
|
|
bool | hasCollision (const glm::vec3 ¢er, const float &radius) const noexcept |
| Check a sphere collision with this box.
|
|
bool | contains (const glm::vec3 &point) const noexcept |
| Check if a point is in this box.
|
|
bool | contains (const AABB &box) const noexcept |
| Check if another AABB is completely inside this box.
|
|
|
glm::vec3 | min = glm::vec3(0.0) |
| Minimum point of bounds.
|
|
glm::vec3 | max = glm::vec3(0.0) |
| Maximum point of bounds.
|
|
Axis-aligned bounding box.
◆ AABB() [1/2]
oe::scene::AABB::AABB |
( |
const glm::vec3 & |
extents | ) |
|
|
inlineexplicit |
Create a box centered at origin.
- Parameters
-
extents | Dimensions of the bounding box |
◆ AABB() [2/2]
oe::scene::AABB::AABB |
( |
const glm::vec3 & |
mini, |
|
|
const glm::vec3 & |
maxi |
|
) |
| |
|
inline |
Create a box by providing bounds.
- Parameters
-
min | Minimum bounds |
max | Maximum bounds |
◆ contains() [1/2]
bool oe::scene::AABB::contains |
( |
const AABB & |
box | ) |
const |
|
inlinenoexcept |
Check if another AABB is completely inside this box.
- Parameters
-
- Returns
- True if this box entirely contains the provided box
◆ contains() [2/2]
bool oe::scene::AABB::contains |
( |
const glm::vec3 & |
point | ) |
const |
|
inlinenoexcept |
Check if a point is in this box.
- Parameters
-
- Returns
- True if this box contain the point at specified coordinates
◆ extendToAABB()
Increase box size to contain another AABB.
- Parameters
-
aabb | Box to include in this one |
◆ extendToPoint()
void oe::scene::AABB::extendToPoint |
( |
const glm::vec3 & |
point | ) |
|
|
inlinenoexcept |
Update box size to contain the point.
- Parameters
-
◆ getCenter()
glm::vec3 oe::scene::AABB::getCenter |
( |
| ) |
const |
|
inlinenoexcept |
Get coordinates of the box center.
- Returns
- Origin of the bounding box
◆ getExtents()
glm::vec3 oe::scene::AABB::getExtents |
( |
| ) |
const |
|
inlinenoexcept |
Get the box distance between min and max.
- Returns
- Distance between each edges
◆ getVolume()
float oe::scene::AABB::getVolume |
( |
| ) |
const |
|
inlinenoexcept |
Get the box volume.
- Returns
- volume in cubical units
◆ hasCollision() [1/2]
bool oe::scene::AABB::hasCollision |
( |
const AABB & |
box | ) |
const |
|
inlinenoexcept |
Check an box collision with this box.
- Parameters
-
box | Remote AABB to check collision |
- Returns
- True if this box collides with the provided box
◆ hasCollision() [2/2]
bool oe::scene::AABB::hasCollision |
( |
const glm::vec3 & |
center, |
|
|
const float & |
radius |
|
) |
| const |
|
inlinenoexcept |
Check a sphere collision with this box.
- Parameters
-
center | Sphere center |
radius | Sphere radius |
- Returns
- True if this box collides with the sphere
◆ isEmpty()
bool oe::scene::AABB::isEmpty |
( |
| ) |
const |
|
inlinenoexcept |
Check if the box is empty.
- Returns
- True if the box has no volume
◆ operator+=()
AABB & oe::scene::AABB::operator+= |
( |
const AABB & |
aabb | ) |
|
|
inlinenoexcept |
◆ scale()
void oe::scene::AABB::scale |
( |
const glm::vec3 & |
scale | ) |
|
|
inlinenoexcept |
Scale the bounding box.
- Parameters
-
◆ setBounds()
void oe::scene::AABB::setBounds |
( |
const glm::vec3 & |
mini, |
|
|
const glm::vec3 & |
maxi |
|
) |
| |
|
inlinenoexcept |
Update box bounds.
- Parameters
-
mini | Minimum bounds |
maxi | Maximum bounds |
◆ transform()
AABB oe::scene::AABB::transform |
( |
const glm::mat4 & |
model | ) |
const |
|
inlinenoexcept |
Returns a new AABB transformed according to a model matrix.
- Note
- This one is kept as-is
- Parameters
-
- Returns
- New box transformed
The documentation for this class was generated from the following file:
- OxygenEngine/scene/aabb.h