12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef CORE_BOX_HPP
- #define CORE_BOX_HPP
- #include "core/math/Vector.hpp"
- #include "core/utils/ArrayString.hpp"
- 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;
- template<typename String>
- check_return Error toString(String& s) const {
- CORE_RETURN_ERROR(s.append("Box("));
- CORE_RETURN_ERROR(s.append(min));
- CORE_RETURN_ERROR(s.append(", "));
- CORE_RETURN_ERROR(s.append(max));
- CORE_RETURN_ERROR(s.append(")"));
- return ErrorCode::NONE;
- }
- };
- }
- #endif
|