-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAABB2.h
43 lines (38 loc) · 1.05 KB
/
AABB2.h
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
33
34
35
36
37
38
39
40
41
42
43
#ifndef AABB2_H
#define AABB2_H
#include "Vector2.h"
#include "MathUtilities.h"
#include <limits>
namespace math
{
/**
* Axis Aligned Bounding Box 2D (AABB2).
*/
class AABB2
{
public:
// ctor & dtor
AABB2();
AABB2(const Vector2& min, const Vector2& max);
AABB2(const Vector2& center, const real radius);
~AABB2();
// functions
void Empty();
AABB2& Add(const Vector2 &rhs);
AABB2& Move(const Vector2 &rhs);
AABB2& Enlarge(const real displacement);
bool IsInside(const Vector2& rhs);
bool Intersects(const AABB2& aabb2);
Vector2 GetMax() const;
Vector2 GetMin() const;
Vector2 GetCenter() const;
Vector2 GetSize() const;
Vector2 GetRadius() const;
real GetWidth() const;
real GetHeight() const;
// properties
Vector2 min;
Vector2 max;
};
}
#endif