|
Saga
Saga Game Engine
|
Represents a bounding box. More...
#include <boundingBox.h>
Public Member Functions | |
| glm::vec3 | centroid () |
| Compute the centroid of the BoundingBox. | |
| glm::vec3 | size () |
| Compute the size of the BoundingBox. | |
| float | surfaceArea () |
| Compute the surface area of the BoundinBox. | |
| float | volume () |
| Compute the volume of the BoundingBox. | |
| bool | inside (glm::vec3 point) |
| Determins if a point is inside of the bounding box. | |
| bool | collidesWithRay (glm::vec4 point, glm::vec4 dir) |
| Determine if the BoundingBox collide with a ray. | |
| std::optional< float > | findCollisionWithRay (glm::vec4 point, glm::vec4 dir) |
| Find the point of collision between a ray and the BoundingBox. | |
| bool | intersectWith (const BoundingBox &other) |
| Determines if a BoundingBox intersects with another. | |
| float | lowerBoundSquareDistanceTo (const glm::vec3 point) |
| Compute the Lower-Bound squared distance from a point to the BoundingBox. | |
| std::optional< float > | findCollisionWithBox (glm::vec3 centroid, glm::vec3 dir, glm::vec3 size) |
| Find the collision between a moving bounding box and this one. | |
Static Public Member Functions | |
| static BoundingBox | getExtremeBound () |
| Get a special invalid BoundingBox used as a starting point for mergeBox and confineBox. This bounding box has the lower left corner at infinitiy and upper right corner at negative infinity. | |
| static BoundingBox | mergeBox (const BoundingBox &a, const BoundingBox &b) |
| Compute a BoundingBox that is the union of the two input boxes. | |
| static BoundingBox | confineBox (const BoundingBox &a, const BoundingBox &b) |
| Confine a BoundingBox within the other, effectively computing their intersection. | |
| static BoundingBox | pointBox (const glm::vec3 &point) |
| Create a bounding box containing only one point. | |
Public Attributes | |
| glm::vec3 | bounds [2] |
| coordinates of the lower-left and upper-right corners of the bounding box, respectively. | |
Static Public Attributes | |
| static float const | oo = 1e9f |
| infinity value. No bounding box's absolute value in any dimension can exceed this. | |
Represents a bounding box.
| vec3 Saga::BoundingBox::centroid | ( | ) |
Compute the centroid of the BoundingBox.
| bool Saga::BoundingBox::collidesWithRay | ( | glm::vec4 | point, |
| glm::vec4 | dir | ||
| ) |
Determine if the BoundingBox collide with a ray.
| point | the start of the ray. |
| dir | the direction of the ray. |

|
static |
Confine a BoundingBox within the other, effectively computing their intersection.
| a | the first bounding box. |
| b | the second bounding box. |
| std::optional< float > Saga::BoundingBox::findCollisionWithBox | ( | glm::vec3 | centroid, |
| glm::vec3 | dir, | ||
| glm::vec3 | size | ||
| ) |
Find the collision between a moving bounding box and this one.
| centroid | centroid of the box. |
| dir | direction the box is moving. |
| size | the size of the box. |

| std::optional< float > Saga::BoundingBox::findCollisionWithRay | ( | glm::vec4 | point, |
| glm::vec4 | dir | ||
| ) |
Find the point of collision between a ray and the BoundingBox.
| point | the start of the ray. |
| dir | the direction of the ray. |

|
static |
Get a special invalid BoundingBox used as a starting point for mergeBox and confineBox. This bounding box has the lower left corner at infinitiy and upper right corner at negative infinity.
| bool Saga::BoundingBox::inside | ( | glm::vec3 | point | ) |
Determins if a point is inside of the bounding box.
| bool Saga::BoundingBox::intersectWith | ( | const BoundingBox & | other | ) |
Determines if a BoundingBox intersects with another.
| other | the other bounding box. |
| float Saga::BoundingBox::lowerBoundSquareDistanceTo | ( | const glm::vec3 | point | ) |
Compute the Lower-Bound squared distance from a point to the BoundingBox.
| point | the point to compute distance to. |
|
static |
Compute a BoundingBox that is the union of the two input boxes.
| a | the first bounding box. |
| b | the second bounding box. |
|
static |
Create a bounding box containing only one point.
| point | the point the bounding box contains. |
| vec3 Saga::BoundingBox::size | ( | ) |
Compute the size of the BoundingBox.
| float Saga::BoundingBox::surfaceArea | ( | ) |
Compute the surface area of the BoundinBox.

| float Saga::BoundingBox::volume | ( | ) |
Compute the volume of the BoundingBox.

| glm::vec3 Saga::BoundingBox::bounds[2] |
coordinates of the lower-left and upper-right corners of the bounding box, respectively.
|
static |
infinity value. No bounding box's absolute value in any dimension can exceed this.