forgot to add a few files
[supertux.git] / lib / math / aatriangle.h
1 #ifndef __AATRIANGLE_H__
2 #define __AATRIANGLE_H__
3
4 #include "rectangle.h"
5
6 namespace SuperTux
7 {
8
9 /**
10  * An axis aligned triangle (ie. a triangle where 2 sides are parallel to the x-
11  * and y-axis.
12  */
13 class AATriangle : public Rectangle
14 {
15 public:
16   /** Directions:
17    *
18    *    SOUTHEWEST    NORTHEAST   SOUTHEAST    NORTHWEST
19    *    *      or      *---*   or      *    or *---* 
20    *    | \             \  |         / |       |  /
21    *    |  \             \ |        /  |       | /
22    *    *---*              *       *---*       *
23    *
24    * Deform flags: (see docs/aatriangletypes.png for details)
25    */
26   enum Direction {
27     SOUTHWEST = 0,
28     NORTHEAST,
29     SOUTHEAST,
30     NORTHWEST,
31     DIRECTION_MASK = 0x0003,
32     DEFORM1 = 0x0010,
33     DEFORM2 = 0x0020,
34     DEFORM3 = 0x0030,
35     DEFORM4 = 0x0040,
36     DEFORM_MASK = 0x0070
37   };
38
39   AATriangle()
40     : dir(SOUTHWEST)
41   {
42   }
43   AATriangle(const Vector& v1, const Vector& v2, int newdir)
44     : Rectangle(v1, v2), dir(newdir)
45   {
46   }
47
48   int dir;
49 };
50
51 }
52
53 #endif
54