--- /dev/null
+/*
+ * AABB.h
+ *
+ * Created on: Apr 30, 2012
+ * Author: holy
+ */
+
+#ifndef SHAPE_AABB_H_
+#define SHAPE_AABB_H_
+
+#include "Shape.h"
+
+namespace shape {
+
+class AABB
+: public Shape {
+
+ public:
+ AABB(void) { };
+ AABB(Scalar width, Scalar height) : leftTop(-width/2, -height/2), rightBottom(width/2, height/2) { };
+ virtual ~AABB(void) { };
+
+ public:
+ Scalar Left(void) const { return leftTop.X(); };
+ Scalar Top(void) const { return leftTop.Y(); };
+ Scalar Right(void) const { return rightBottom.X(); };
+ Scalar Bottom(void) const { return rightBottom.Y(); };
+
+ Vector Center(void) const { return leftTop + (rightBottom - leftTop) / 2; };
+ Scalar Width(void) const { return Right() - Left(); };
+ Scalar Height(void) const { return Bottom() - Top(); };
+
+ public:
+ virtual void Translate(const Vector &delta);
+ virtual void Rotate(Scalar delta);
+
+ public:
+ virtual bool CheckCollision(const Shape &, Ray &) const;
+ virtual bool CheckCollision(const AABB &, Ray &) const;
+ virtual bool CheckCollision(const Circle &, Ray &) const;
+
+ public:
+ virtual std::ostream &Write(std::ostream &) const;
+
+ private:
+ Vector leftTop, rightBottom;
+
+};
+
+}
+
+#endif /* SHAPE_AABB_H_ */