]> git.localhorst.tv Git - sdl-test7.git/blob - src/geometry/Shape.h
imported current version
[sdl-test7.git] / src / geometry / Shape.h
1 /*
2  * Shape.h
3  *
4  *  Created on: Apr 20, 2012
5  *      Author: holy
6  */
7
8 #ifndef GEOMETRY_SHAPE_H_
9 #define GEOMETRY_SHAPE_H_
10
11 #include "Vector2D.h"
12
13 #include <limits>
14 #include <ostream>
15
16 namespace geometry {
17
18 class AABB;
19 class Circle;
20 class FakeLens;
21
22 class Shape {
23
24         public:
25                 typedef float Scalar;
26                 typedef Vector2D<Scalar> Vector;
27                 typedef std::numeric_limits<Scalar> Limits;
28
29         protected:
30                 Shape(void) { };
31                 virtual ~Shape(void) { };
32
33         public:
34                 virtual bool Overlaps(const Shape &, Vector &normal) const = 0;
35
36                 virtual bool Overlaps(const AABB &, Vector &normal) const = 0;
37                 virtual bool Overlaps(const Circle &, Vector &normal) const = 0;
38                 virtual bool Overlaps(const FakeLens &, Vector &normal) const = 0;
39
40         public:
41                 virtual std::ostream &Write(std::ostream &out) const = 0;
42
43         public:
44                 virtual void SetPosition(const Vector &) = 0;
45                 virtual Vector Center(void) const = 0;
46
47 };
48
49 }
50
51
52 namespace std {
53
54 inline ostream &operator <<(ostream &out, const geometry::Shape &s) {
55         return s.Write(out);
56 };
57
58 }
59
60 #endif /* GEOMETRY_SHAPE_H_ */