| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- $#include "BoundingBox.h"
- /// Three-dimensional axis-aligned bounding box.
- class BoundingBox
- {
- public:
- /// Construct with zero size.
- BoundingBox();
-
- /// Copy-construct from another bounding box.
- BoundingBox(const BoundingBox& box);
-
- /// Construct from a rect, with the Z dimension left zero.
- BoundingBox(const Rect& rect);
-
- /// Construct from minimum and maximum vectors.
- BoundingBox(const Vector3& min, const Vector3& max);
-
- /// Construct from minimum and maximum floats (all dimensions same.)
- BoundingBox(float min, float max);
-
- /// Construct from an array of vertices.
- BoundingBox(const Vector3* vertices, unsigned count);
-
- /// Construct from a frustum.
- BoundingBox(const Frustum& frustum);
-
- /// Construct from a polyhedron.
- BoundingBox(const Polyhedron& poly);
-
- /// Construct from a sphere.
- BoundingBox(const Sphere& sphere);
-
- /// Test for equality with another bounding box.
- bool operator == (const BoundingBox& rhs) const;
-
- /// Define from another bounding box.
- void Define(const BoundingBox& box);
-
- /// Define from a Rect.
- void Define(const Rect& rect);
-
- /// Define from minimum and maximum vectors.
- void Define(const Vector3& min, const Vector3& max);
-
- /// Define from minimum and maximum floats (all dimensions same.)
- void Define(float min, float max);
-
- /// Define from a point.
- void Define(const Vector3& point);
-
- /// Merge a point.
- void Merge(const Vector3& point);
-
- /// Merge another bounding box.
- void Merge(const BoundingBox& box);
-
- /// Define from an array of vertices.
- void Define(const Vector3* vertices, unsigned count);
-
- /// Define from a frustum.
- void Define(const Frustum& frustum);
-
- /// Define from a polyhedron.
- void Define(const Polyhedron& poly);
-
- /// Define from a sphere.
- void Define(const Sphere& sphere);
-
- /// Merge an array of vertices.
- void Merge(const Vector3* vertices, unsigned count);
-
- /// Merge a frustum.
- void Merge(const Frustum& frustum);
-
- /// Merge a polyhedron.
- void Merge(const Polyhedron& poly);
-
- /// Merge a sphere.
- void Merge(const Sphere& sphere);
-
- /// Clip with another bounding box.
- void Clip(const BoundingBox& box);
-
- /// Transform with a 3x3 matrix.
- void Transform(const Matrix3& transform);
-
- /// Transform with a 3x4 matrix.
- void Transform(const Matrix3x4& transform);
-
- /// Clear to undefined state.
- void Clear();
-
- /// Return center.
- Vector3 Center() const;
-
- /// Return size.
- Vector3 Size() const;
-
- /// Return half-size.
- Vector3 HalfSize() const;
-
- /// Return transformed by a 3x3 matrix.
- BoundingBox Transformed(const Matrix3& transform) const;
-
- /// Return transformed by a 3x4 matrix.
- BoundingBox Transformed(const Matrix3x4& transform) const;
-
- /// Return projected by a 4x4 projection matrix.
- Rect Projected(const Matrix4& projection) const;
-
- /// Test if a point is inside.
- Intersection IsInside(const Vector3& point) const;
-
- /// Test if another bounding box is inside, outside or intersects.
- Intersection IsInside(const BoundingBox& box) const;
-
- /// Test if another bounding box is (partially) inside or outside.
- Intersection IsInsideFast(const BoundingBox& box) const;
-
- /// Test if a sphere is inside, outside or intersects.
- Intersection IsInside(const Sphere& sphere) const;
-
- /// Test if a sphere is (partially) inside or outside.
- Intersection IsInsideFast(const Sphere& sphere) const;
-
- /// Minimum vector.
- Vector3 min_ @ min;
-
- /// Maximum vector.
- Vector3 max_ @ max;
- };
|