Box.hpp 756 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef CORE_BOX_HPP
  2. #define CORE_BOX_HPP
  3. #include "core/math/Vector.hpp"
  4. #include "core/utils/ArrayString.hpp"
  5. namespace Core {
  6. class Box final {
  7. Vector3 min;
  8. Vector3 max;
  9. Box(const Vector3& min, const Vector3& max);
  10. public:
  11. Box(const Vector3& size);
  12. Box offset(const Vector3& offset) const;
  13. bool collidesWith(const Box& other) const;
  14. Box expand(const Vector3& offset) const;
  15. Box grow(const Vector3& growth) const;
  16. const Vector3& getMin() const;
  17. const Vector3& getMax() const;
  18. void toString(BufferString& s) const {
  19. s.append("Box(");
  20. s.append(min).append(", ");
  21. s.append(max).append(")");
  22. }
  23. };
  24. }
  25. #endif