|
Rendu
A lightweight rendering engine for experimentations
|
Represent the smallest axis-aligne box containing a given object or region of space. More...
#include <Bounds.hpp>
Public Member Functions | |
| BoundingBox ()=default | |
| BoundingBox (const glm::vec3 &v0, const glm::vec3 &v1) | |
| BoundingBox (const glm::vec3 &v0, const glm::vec3 &v1, const glm::vec3 &v2) | |
| void | merge (const BoundingBox &box) |
| void | merge (const glm::vec3 &point) |
| BoundingSphere | getSphere () const |
| glm::vec3 | getSize () const |
| std::vector< glm::vec3 > | getCorners () const |
| std::vector< glm::vec4 > | getHomogeneousCorners () const |
| glm::vec3 | getCentroid () const |
| BoundingBox | transformed (const glm::mat4 &trans) const |
| bool | contains (const glm::vec3 &point) const |
| bool | empty () const |
Represent the smallest axis-aligne box containing a given object or region of space.
|
default |
Empty box constructor.
| BoundingBox::BoundingBox | ( | const glm::vec3 & | v0, |
| const glm::vec3 & | v1 | ||
| ) |
Corner-based box constructor.
| v0 | first corner |
| v1 | second corner |
| BoundingBox::BoundingBox | ( | const glm::vec3 & | v0, |
| const glm::vec3 & | v1, | ||
| const glm::vec3 & | v2 | ||
| ) |
Triangle-based box constructor.
| v0 | first triangle vertex |
| v1 | second triangle vertex |
| v2 | third triangle vertex |
| bool BoundingBox::contains | ( | const glm::vec3 & | point | ) | const |
Indicates if a point is inside the bounding box.
| point | the point to check |
| bool BoundingBox::empty | ( | ) | const |
| glm::vec3 BoundingBox::getCentroid | ( | ) | const |
Query the center of the bounding box.
| std::vector< glm::vec3 > BoundingBox::getCorners | ( | ) | const |
Query the positions of the eight corners of the box, in the following order (with m=mini, M=maxi): (m,m,m), (m,m,M), (m,M,m), (m,M,M), (M,m,m), (M,m,M), (M,M,m), (M,M,M)
| std::vector< glm::vec4 > BoundingBox::getHomogeneousCorners | ( | ) | const |
Query the homogeneous positions of the eight corners of the box, in the following order (with m=mini, M=maxi): (m,m,m,1), (m,m,M,1), (m,M,m,1), (m,M,M,1), (M,m,m,1), (M,m,M,1), (M,M,m,1), (M,M,M,1)
| glm::vec3 BoundingBox::getSize | ( | ) | const |
Query the size of this box.
| BoundingSphere BoundingBox::getSphere | ( | ) | const |
Query the bounding sphere of this box.
| void BoundingBox::merge | ( | const BoundingBox & | box | ) |
Extends the current box by another one. The result is the bounding box of the two boxes union.
| box | the bounding box to include |
| void BoundingBox::merge | ( | const glm::vec3 & | point | ) |
Extends the current box by a point
| point | the point to include |
| BoundingBox BoundingBox::transformed | ( | const glm::mat4 & | trans | ) | const |
Compute the bounding box of the transformed current box.
| trans | the transformation to apply |