12345678910111213141516171819202122232425262728293031323334 |
- #ifndef CORE_BOX_H
- #define CORE_BOX_H
- #include "math/Vector.h"
- #include "utils/ArrayString.h"
- namespace Core {
- class Box final {
- Vector3 min;
- Vector3 max;
- Box(const Vector3& min, const Vector3& max);
- public:
- Box(const Vector3& size);
- Box offset(const Vector3& offset) const;
- bool collidesWith(const Box& other) const;
- Box expand(const Vector3& offset) const;
- Box grow(const Vector3& growth) const;
- const Vector3& getMin() const;
- const Vector3& getMax() const;
- // returns true on error and calls the error callback
- template<int L>
- check_return bool toString(ArrayString<L>& s) const {
- return s.append("Box(") || s.append(min) || s.append(", ") ||
- s.append(max) || s.append(")");
- }
- };
- }
- #endif
|