4 * Created on: Apr 30, 2012
20 AABB(Scalar width, Scalar height) : leftTop(-width/2, -height/2), rightBottom(width/2, height/2) { };
21 virtual ~AABB(void) { };
24 Scalar Left(void) const { return leftTop.X(); };
25 Scalar Top(void) const { return leftTop.Y(); };
26 Scalar Right(void) const { return rightBottom.X(); };
27 Scalar Bottom(void) const { return rightBottom.Y(); };
29 Vector Center(void) const { return leftTop + (rightBottom - leftTop) / 2; };
30 Scalar Width(void) const { return Right() - Left(); };
31 Scalar Height(void) const { return Bottom() - Top(); };
34 virtual void Translate(const Vector &delta);
35 virtual void Rotate(Scalar delta);
38 virtual bool CheckCollision(const Shape &, Ray &) const;
39 virtual bool CheckCollision(const AABB &, Ray &) const;
40 virtual bool CheckCollision(const Circle &, Ray &) const;
43 virtual std::ostream &Write(std::ostream &) const;
46 Vector leftTop, rightBottom;
52 #endif /* SHAPE_AABB_H_ */