An object containing a coarse simplified representation, AABB, of spatially queryable objects.
More...
#include <spatial_query_math.hpp>
|
using | Extents = std::pair<glm::vec3, glm::vec3> |
| Pair where first : right top front corner; second : left back bottom corner of an AABB.
|
|
|
| AxisAlignedBounds () |
| Constructs a new empty Axis Aligned Bounds object.
|
|
| AxisAlignedBounds (const ObjectBounds &objectBounds) |
| Construct a new Axis Aligned Bounds object based on ObjectBounds.
|
|
| AxisAlignedBounds (const Extents &axisAlignedExtents) |
| Constructs a new Axis Aligned Bounds object based on a pair of coordinates representing the top-right-front and bottom-left-back corners of the axis aligned box.
|
|
| AxisAlignedBounds (const glm::vec3 &position, const glm::vec3 &dimensions) |
| Constructs a new Axis Aligned Bounds object based on the position of the origin and the dimensions of the box.
|
|
AxisAlignedBounds | operator+ (const AxisAlignedBounds &other) const |
| Creates a new axis-aligned box which just contains both this object and the box being added to it.
|
|
std::array< glm::vec3, 8 > | getAxisAlignedBoxCorners () const |
| Gets an array of coordinates of the corners of this box.
|
|
std::array< AreaTriangle, 12 > | getAxisAlignedBoxFaceTriangles () const |
| Gets an array of triangles in the world which make up the surface of this box.
|
|
Extents | getAxisAlignedBoxExtents () const |
| Gets the pair of coordinates representing the extreme corners of this box.
|
|
glm::vec3 | getDimensions () const |
| Gets the dimensions of this box.
|
|
glm::vec3 | getPosition () const |
| Gets the position of the origin of this box.
|
|
bool | isSensible () const |
| Tests whether this box is sensible (it has a finite position, and finite positive dimensions).
|
|
void | setPosition (const glm::vec3 &position) |
| Sets the position of this box.
|
|
void | setDimensions (const glm::vec3 &dimensions) |
| Sets the dimensions of this box.
|
|
|
Extents | mExtents {glm::vec3{0.f}, glm::vec3{0.f}} |
| The pair of coordinates at the extreme corners of this box (i.e., the top-right-front and bottom-left-back corners)
|
|
An object containing a coarse simplified representation, AABB, of spatially queryable objects.
AABBs, Axis-aligned bounding boxes, are defined by two 3D coordinates, each corresponding to opposite corners of an axis-aligned box in the world. The axes here are the unit vectors of the world space (in which exists the node owning this component).
An AABB will just encapsulate all the corners of the ObjectBounds it is derived from.
- See also
- ECSWorld::registerComponentTypes()
◆ AxisAlignedBounds() [1/3]
AxisAlignedBounds::AxisAlignedBounds |
( |
const ObjectBounds & | objectBounds | ) |
|
Construct a new Axis Aligned Bounds object based on ObjectBounds.
- Parameters
-
objectBounds | The basis for the new AABB. |
◆ AxisAlignedBounds() [2/3]
AxisAlignedBounds::AxisAlignedBounds |
( |
const Extents & | axisAlignedExtents | ) |
|
Constructs a new Axis Aligned Bounds object based on a pair of coordinates representing the top-right-front and bottom-left-back corners of the axis aligned box.
- Parameters
-
axisAlignedExtents | A pair of coordinates representing the top-right-front and bottom-left-back corners of an axis aligned box. |
◆ AxisAlignedBounds() [3/3]
ToyMaker::AxisAlignedBounds::AxisAlignedBounds |
( |
const glm::vec3 & | position, |
|
|
const glm::vec3 & | dimensions ) |
|
inline |
Constructs a new Axis Aligned Bounds object based on the position of the origin and the dimensions of the box.
- Parameters
-
position | Box origin. |
dimensions | Box breadth, height, and depth. |
◆ getAxisAlignedBoxCorners()
std::array< glm::vec3, 8 > AxisAlignedBounds::getAxisAlignedBoxCorners |
( |
| ) |
const |
Gets an array of coordinates of the corners of this box.
- Returns
- std::array<glm::vec3, 8> This box's corner coordinates.
least significant 3 bits represent corners of a box, where
- 0th bit represents x, 1 is right, 0 is left
- 1st bit represents y, 1 is up, 0 is down
- 2nd bit represents z, 1 is front, 0 is back
◆ getAxisAlignedBoxExtents()
Gets the pair of coordinates representing the extreme corners of this box.
- Returns
- Extents This box's top-front-right and bottom-back-left corners.
◆ getAxisAlignedBoxFaceTriangles()
std::array< AreaTriangle, 12 > ToyMaker::AxisAlignedBounds::getAxisAlignedBoxFaceTriangles |
( |
| ) |
const |
|
inline |
Gets an array of triangles in the world which make up the surface of this box.
- Returns
- std::array<AreaTriangle, 12> This box's surface triangles.
◆ getComponentTypeName()
static std::string ToyMaker::AxisAlignedBounds::getComponentTypeName |
( |
| ) |
|
|
inlinestatic |
Gets the component type string for this object.
- Returns
- std::string The component type string of this class.
◆ getDimensions()
glm::vec3 ToyMaker::AxisAlignedBounds::getDimensions |
( |
| ) |
const |
|
inline |
Gets the dimensions of this box.
- Returns
- glm::vec3 In order: breadth, height, depth.
◆ getPosition()
glm::vec3 ToyMaker::AxisAlignedBounds::getPosition |
( |
| ) |
const |
|
inline |
Gets the position of the origin of this box.
- Returns
- glm::vec3
◆ isSensible()
bool ToyMaker::AxisAlignedBounds::isSensible |
( |
| ) |
const |
|
inline |
Tests whether this box is sensible (it has a finite position, and finite positive dimensions).
- Return values
-
true | This box is sensible; |
false | This box is not sensible; |
◆ operator+()
Creates a new axis-aligned box which just contains both this object and the box being added to it.
- Parameters
-
other | The box being added to this box. |
- Returns
- AxisAlignedBounds Bounds just containing the boxes being added.
◆ setByExtents()
void AxisAlignedBounds::setByExtents |
( |
const Extents & | axisAlignedExtents | ) |
|
|
private |
Sets the extents of this box.
- Parameters
-
axisAlignedExtents | A pair of coordinates representing the top-right-front and bottom-left-back corners of this box. |
◆ setDimensions()
void ToyMaker::AxisAlignedBounds::setDimensions |
( |
const glm::vec3 & | dimensions | ) |
|
|
inline |
Sets the dimensions of this box.
- Parameters
-
dimensions | The new dimensions of this box. |
◆ setPosition()
void ToyMaker::AxisAlignedBounds::setPosition |
( |
const glm::vec3 & | position | ) |
|
|
inline |
Sets the position of this box.
- Parameters
-
position | The new position of this box. |
The documentation for this class was generated from the following files: