CollisionBox.h 724 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef COLLISION_BOX_H
  2. #define COLLISION_BOX_H
  3. #include "math/Vector.h"
  4. #include "utils/StringBuffer.h"
  5. class CollisionBox {
  6. Vector3 min;
  7. Vector3 max;
  8. CollisionBox(const Vector3& min, const Vector3& max);
  9. public:
  10. CollisionBox(const Vector3& size);
  11. CollisionBox offset(const Vector3& offset) const;
  12. bool collidesWith(const CollisionBox& other) const;
  13. CollisionBox 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("CollisionBox(")
  19. .append(min)
  20. .append(", ")
  21. .append(max)
  22. .append(")");
  23. }
  24. };
  25. #endif