| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "Prerequisites/BsPrerequisitesUtil.h"
- #include "Math/BsVector3.h"
- #include "Math/BsAABox.h"
- #include "Math/BsSphere.h"
- #include "Math/BsMatrix4.h"
- namespace bs
- {
- /** @addtogroup Math
- * @{
- */
- /** Bounds represented by an axis aligned box and a sphere. */
- class BS_UTILITY_EXPORT Bounds
- {
- public:
- Bounds();
- Bounds(const AABox& box, const Sphere& sphere);
- ~Bounds() { }
- /** Returns the axis aligned box representing the bounds. */
- const AABox& getBox() const { return mBox; }
- /** Returns the sphere representing the bounds. */
- const Sphere& getSphere() const { return mSphere; }
- /** Updates the bounds by setting the new bounding box and sphere. */
- void setBounds(const AABox& box, const Sphere& sphere);
- /** Merges the two bounds, creating a new bounds that encapsulates them both. */
- void merge(const Bounds& rhs);
- /** Expands the bounds so it includes the provided point. */
- void merge(const Vector3& point);
- /**
- * Transforms the bounds by the given matrix.
- *
- * @note
- * As the resulting box will no longer be axis aligned, an axis align box
- * is instead created by encompassing the transformed oriented bounding box.
- * Retrieving the value as an actual OBB would provide a tighter fit.
- */
- void transform(const Matrix4& matrix);
- /**
- * Transforms the bounds by the given matrix.
- *
- * @note
- * As the resulting box will no longer be axis aligned, an axis align box
- * is instead created by encompassing the transformed oriented bounding box.
- * Retrieving the value as an actual OBB would provide a tighter fit.
- *
- * @note
- * Provided matrix must be affine.
- */
- void transformAffine(const Matrix4& matrix);
- protected:
- AABox mBox;
- Sphere mSphere;
- };
- /** @} */
- }
|