Collision Checker
aabb.h
Go to the documentation of this file.
1 #ifndef CPP_COLLISION_INCLUDE_COLLISION_FASTAABB_H_
2 #define CPP_COLLISION_INCLUDE_COLLISION_FASTAABB_H_
3 
5 
6 namespace collision {
7 class AABB {
8  public:
9  double x_min;
10  double x_max;
11  double y_min;
12  double y_max;
13 
14  AABB(void) : x_min(0), x_max(0), y_min(0), y_max(0) {}
15 
16  AABB(double x_min, double x_max, double y_min, double y_max) {
17  this->x_min = x_min;
18  this->x_max = x_max;
19 
20  this->y_min = y_min;
21  this->y_max = y_max;
22  }
23 
24  AABB(const RectangleAABB& aabb_rect) {
25  x_min = aabb_rect.min()[0];
26  y_min = aabb_rect.min()[1];
27  x_max = aabb_rect.max()[0];
28  y_max = aabb_rect.max()[1];
29  }
30 
31  bool collides(const AABB& other);
32 
33  void swapAxes(void) {
34  std::swap(x_min, y_min);
35  std::swap(x_max, y_max);
36  }
37 };
38 } // namespace collision
39 
40 #endif /* CPP_COLLISION_INCLUDE_COLLISION_FASTAABB_H_ */
double y_min
Definition: aabb.h:11
AABB(double x_min, double x_max, double y_min, double y_max)
Definition: aabb.h:16
bool collides(const AABB &other)
Definition: aabb.cc:6
Eigen::Vector2d min() const
AABB(const RectangleAABB &aabb_rect)
Definition: aabb.h:24
Axis-aligned rectangle.
AABB(void)
Definition: aabb.h:14
double x_max
Definition: aabb.h:10
double x_min
Definition: aabb.h:9
void swapAxes(void)
Definition: aabb.h:33
Eigen::Vector2d max() const
double y_max
Definition: aabb.h:12