0
|
1 |
#ifndef _POINT_H
|
|
2 |
#define _POINT_H
|
|
3 |
|
|
4 |
class Point{
|
|
5 |
public:
|
|
6 |
Point(int xCoord = -1, int yCoord= -1)
|
|
7 |
: fx(xCoord), fy(yCoord) {};
|
|
8 |
|
|
9 |
inline int & x(){return fx;}
|
|
10 |
inline int & y() {return fy;};
|
|
11 |
|
|
12 |
// Relational operators
|
|
13 |
|
|
14 |
inline bool operator ==(Point p)
|
|
15 |
{ return (fx == p.x() && fy == p.y());};
|
|
16 |
inline bool operator !=(Point p)
|
|
17 |
{ return (fx != p.x() || fy != p.y());};
|
|
18 |
inline bool operator < (Point p)
|
|
19 |
{ return (fx < p.x()) && (fy < p.y()); };
|
|
20 |
inline bool operator > (Point p)
|
|
21 |
{ return (fx > p.x()) && (fy > p.y()); };
|
|
22 |
inline bool operator <=(Point p)
|
|
23 |
{ return (fx <= p.x()) && (fy <= p.y()); };
|
|
24 |
inline bool operator >=(Point p)
|
|
25 |
{ return (fx >= p.x()) && (fy >= p.y()); };
|
|
26 |
|
|
27 |
private:
|
|
28 |
int fx;
|
|
29 |
int fy;
|
|
30 |
};
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
#endif
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|