|
3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
|
Represents a axis aligned bounding box in 3D space defined by position and scale. More...
#include <BoundingBox.hpp>

Public Member Functions | |
| BoundingBox (Vector3 p, Vector3 s) | |
| BoundingBox ()=default | |
| Creates a null bounding box. | |
| BoundingBox (const Vector3 &pos, const Vector3 &scale) | |
| Creates a bounding box from position and scale. | |
| BoundingBox (const BoundingSphere &sphere) | |
| Create a bounding box that contains the given bounding sphere. | |
| BoundingBox (const BoundingBox &box1, const BoundingBox &box2) | |
| Creates a bounding box that contains both given bounding boxes. | |
| BoundingBox (const BoundingBox &box, const BoundingSphere &sphere) | |
| Creates a bounding box that contains the given bounding box and bounding sphere. | |
| BoundingBox (const BoundingSphere &sph1, const BoundingSphere &sph2) | |
| Creates a bounding box that contains both given bounding spheres. | |
| Vector3 | Min () const noexcept |
| Minimal point. | |
| Vector3 | Center () const noexcept |
| Returns the center of the bounding box. | |
| Vector3 | Max () const noexcept |
| Returns the maximal point. | |
| bool | Intersects (const BoundingBox &box) const noexcept |
| Does this intersect with the given bounding box? | |
| bool | Intersects (const BoundingSphere &sphere) const noexcept |
| Does this intersect with the given bounding sphere? | |
| bool | Intersects (const BoundingPlane &plane) const noexcept |
| Does this intersect with the given bounding plane? | |
| bool | Intersects (const Ray &ray) const noexcept |
| Does this intersect with the given ray? | |
| bool | Contains (const Vector3 &p) const noexcept |
| Is p inside this bounding box? | |
| Vector3 | operator[] (int i) const |
| Returns a corner of this BoundingBox. | |
| BoundingBox | Transform (const Matrix4x4 &m) const noexcept |
| Returns the smallest axis-aligned BoundingBox that contains this BoundingBox after being transformed by m. | |
Public Attributes | |
| Vector3 | Position |
| Minimal point of the bounding box. | |
| Vector3 | Scale |
| Abs(Max-Min). All components need to be positive. | |
Represents a axis aligned bounding box in 3D space defined by position and scale.
This bounding box has the boundaries specified as (Position, Position + Scale). The scale should be positive in all coordinates.
|
default |
Creates a null bounding box.
| BoundingBox::BoundingBox | ( | const Vector3 & | pos, |
| const Vector3 & | scale ) |
Creates a bounding box from position and scale.
| pos | Position. |
| scale | Scale. Every coordinate should be positive. |
|
explicit |
Create a bounding box that contains the given bounding sphere.
| sphere | Bounding sphere |
| BoundingBox::BoundingBox | ( | const BoundingBox & | box1, |
| const BoundingBox & | box2 ) |
Creates a bounding box that contains both given bounding boxes.
| box1 | First |
| box2 | Second |
| BoundingBox::BoundingBox | ( | const BoundingBox & | box, |
| const BoundingSphere & | sphere ) |
Creates a bounding box that contains the given bounding box and bounding sphere.
| box | Box. |
| sphere | Sphere. |
| BoundingBox::BoundingBox | ( | const BoundingSphere & | sph1, |
| const BoundingSphere & | sph2 ) |
Creates a bounding box that contains both given bounding spheres.
| sph1 | Sphere. |
| sph2 | Sphere. |
|
noexcept |
Returns the center of the bounding box.
Is p inside this bounding box?
| p | Point p |
|
noexcept |
Does this intersect with the given bounding box?
| box | The bounding box to test for intersection |
|
noexcept |
Does this intersect with the given bounding plane?
| plane | The bounding plane to test for intersection |
|
noexcept |
Does this intersect with the given bounding sphere?
| sphere | The bounding sphere to test for intersection |
Does this intersect with the given ray?
| ray | The ray to test for intersection |
|
noexcept |
Returns the maximal point.
|
noexcept |
Minimal point.
Returns a corner of this BoundingBox.
| i | Ranged from 0 to 7. |
0: Min 1: (Max.X, Min.Y, Min.Z) 2: (Min.X, Max.Y, Min.Z) 3: (Min.X, Min.Y, Max.Z) 4: (Max.X, Max.Y, Min.Z) 5: (Max.X, Min.Y, Max.Z) 6: (Min.X, Max.Y, Max.Z) 7: Max
|
noexcept |
Returns the smallest axis-aligned BoundingBox that contains this BoundingBox after being transformed by m.
| m | Transformation matrix (translation, rotation and/or scale). |
Unlike transforming Position and Scale directly, this correctly accounts for rotation by re-deriving the axis-aligned extents from the transformed center/half-extents, guaranteeing the result always contains every corner of the original box.
| Vector3 Engine3DRadSpace.Math.BoundingBox.Position |
Minimal point of the bounding box.
| Vector3 Engine3DRadSpace.Math.BoundingBox.Scale |
Abs(Max-Min). All components need to be positive.