Box.h 609 B

1234567891011121314151617181920212223242526272829
  1. #ifndef COLLISION_BOX_H
  2. #define COLLISION_BOX_H
  3. #include "math/Vector.h"
  4. #include "utils/StringBuffer.h"
  5. class Box {
  6. Vector3 min;
  7. Vector3 max;
  8. Box(const Vector3& min, const Vector3& max);
  9. public:
  10. Box(const Vector3& size);
  11. Box offset(const Vector3& offset) const;
  12. bool collidesWith(const Box& other) const;
  13. Box expand(const Vector3& offset) const;
  14. const Vector3& getMin() const;
  15. const Vector3& getMax() const;
  16. template<int L>
  17. void toString(StringBuffer<L>& s) const {
  18. s.append("Box(").append(min).append(", ").append(max).append(")");
  19. }
  20. };
  21. #endif