]> Shamusworld >> Repos - architektonas/blob - src/rect.h
0098a8d54cd32066d2a0a5e6b3a969f4422206ec
[architektonas] / src / rect.h
1 #ifndef __RECT_H__
2 #define __RECT_H__
3
4 //
5 // We're doing this because the Qt implementation is non-Cartesian compliant.
6 // Also, it auto-normalizes rects constructed using the constructors. :-)
7 //
8
9 #include "vector.h"
10
11 struct Rect
12 {
13         double l, r, t, b;
14
15         Rect();
16         Rect(double ll, double rr, double tt, double bb);
17         Rect(Point tl, Point br);
18         Rect & operator*=(double scale);
19         Rect & operator|=(Rect x);
20         void Normalize(void);
21         void Translate(Point p);
22         void Expand(double amt);
23         double Width(void);
24         double Height(void);
25         bool Contains(Point p);
26         Point TopLeft(void);
27         Point TopRight(void);
28         Point BottomLeft(void);
29         Point BottomRight(void);
30 };
31
32 #endif  // __RECT_H__