![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Represents a 2D axis-aligned bounding box. More...
#include <BoundingBox2D.h>
Public Member Functions | |
BoundingBox2D () | |
Default constructor initializing the bounding box to zero dimensions. | |
BoundingBox2D (const Vector2D &min, const Vector2D &max) | |
Constructs a BoundingBox2D with specified minimum and maximum corners. | |
void | UpdateBounds (const Vector2D ¤t) |
Updates the bounds of the bounding box to include the specified point. | |
Vector2D | GetMinimum () |
Gets the minimum corner of the bounding box. | |
Vector2D | GetMaximum () |
Gets the maximum corner of the bounding box. | |
Vector2D | GetCenter () |
Gets the center point of the bounding box. | |
bool | Overlaps (BoundingBox2D *bb) |
Checks if this bounding box overlaps with another BoundingBox2D. | |
bool | Overlaps (const Vector2D &minI, const Vector2D &maxI) |
Checks if this bounding box overlaps with another box defined by min and max corners. | |
bool | Contains (const Vector2D &v) |
Checks if this bounding box contains a specified point. | |
Private Attributes | |
Vector2D | min |
Minimum corner of the bounding box. | |
Vector2D | max |
Maximum corner of the bounding box. | |
Vector2D | mid |
Center point of the bounding box. | |
Represents a 2D axis-aligned bounding box.
Definition at line 21 of file BoundingBox2D.h.
BoundingBox2D | ( | ) |
Default constructor initializing the bounding box to zero dimensions.
Definition at line 3 of file BoundingBox2D.cpp.
BoundingBox2D | ( | const Vector2D & | min, |
const Vector2D & | max | ||
) |
Constructs a BoundingBox2D with specified minimum and maximum corners.
min | Minimum corner of the bounding box. |
max | Maximum corner of the bounding box. |
Definition at line 10 of file BoundingBox2D.cpp.
References max, mid, min, Vector2D::X, and Vector2D::Y.
Checks if this bounding box contains a specified point.
v | The point to check. |
Definition at line 52 of file BoundingBox2D.cpp.
References max, min, Vector2D::X, and Vector2D::Y.
Referenced by QuadTree::Intersect().
Vector2D GetCenter | ( | ) |
Gets the center point of the bounding box.
Definition at line 34 of file BoundingBox2D.cpp.
References mid.
Referenced by Node::CreateChildNodes().
Vector2D GetMaximum | ( | ) |
Gets the maximum corner of the bounding box.
Definition at line 30 of file BoundingBox2D.cpp.
References max.
Referenced by Node::CreateChildNodes(), Triangle2D::DidIntersectSAT(), and Overlaps().
Vector2D GetMinimum | ( | ) |
Gets the minimum corner of the bounding box.
Definition at line 26 of file BoundingBox2D.cpp.
References min.
Referenced by Node::CreateChildNodes(), Triangle2D::DidIntersectSAT(), and Overlaps().
bool Overlaps | ( | BoundingBox2D * | bb | ) |
Checks if this bounding box overlaps with another BoundingBox2D.
bb | Pointer to the other BoundingBox2D. |
Definition at line 38 of file BoundingBox2D.cpp.
References GetMaximum(), GetMinimum(), max, min, Vector2D::X, and Vector2D::Y.
Referenced by Triangle2D::DidIntersect().
Checks if this bounding box overlaps with another box defined by min and max corners.
minI | Minimum corner of the other box. |
maxI | Maximum corner of the other box. |
Definition at line 45 of file BoundingBox2D.cpp.
References max, min, Vector2D::X, and Vector2D::Y.
Updates the bounds of the bounding box to include the specified point.
current | The point to include in the bounding box. |
Definition at line 18 of file BoundingBox2D.cpp.
References max, Vector2D::Maximum(), mid, min, Vector2D::Minimum(), Vector2D::X, and Vector2D::Y.
|
private |
Maximum corner of the bounding box.
Definition at line 24 of file BoundingBox2D.h.
Referenced by BoundingBox2D(), BoundingBox2D(), Contains(), GetMaximum(), Overlaps(), Overlaps(), and UpdateBounds().
|
private |
Center point of the bounding box.
Definition at line 25 of file BoundingBox2D.h.
Referenced by BoundingBox2D(), BoundingBox2D(), GetCenter(), and UpdateBounds().
|
private |
Minimum corner of the bounding box.
Definition at line 23 of file BoundingBox2D.h.
Referenced by BoundingBox2D(), BoundingBox2D(), Contains(), GetMinimum(), Overlaps(), Overlaps(), and UpdateBounds().