summaryrefslogtreecommitdiffstats
path: root/core/math/aabb.hh
blob: 943eeeed52fcdeb5ffef5c6aa674adb797407a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef CORE_MATH_AABB_HH
#define CORE_MATH_AABB_HH 1
#pragma once

namespace math
{
class AABB final {
public:
    AABB(void) = default;
    explicit AABB(const glm::fvec3& min, const glm::fvec3& max);
    virtual ~AABB(void) = default;

    void set_bounds(const glm::fvec3& min, const glm::fvec3& max);
    void set_offset(const glm::fvec3& base, const glm::fvec3& size);

    const glm::fvec3& get_min(void) const;
    const glm::fvec3& get_max(void) const;

    bool contains(const glm::fvec3& point) const;
    bool intersect(const AABB& other_box) const;

    AABB combine_with(const AABB& other_box) const;
    AABB multiply_with(const AABB& other_box) const;
    AABB push(const glm::fvec3& vector) const;

public:
    glm::fvec3 min;
    glm::fvec3 max;
};
} // namespace math

#endif // CORE_MATH_AABB_HH