blob: 66fa0dce7694df7945ceefa8f80cdf522f25b1bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef __POINT_H__
#define __POINT_H__
#include "Common.h"
namespace Sexy
{
template<class _T> class TPoint
{
public:
_T mX;
_T mY;
public:
TPoint(_T theX, _T theY) :
mX(theX),
mY(theY)
{
}
TPoint(const TPoint<_T>& theTPoint) :
mX(theTPoint.mX),
mY(theTPoint.mY)
{
}
TPoint() :
mX(0),
mY(0)
{
}
inline bool operator==(const TPoint& p)
{
return ((p.mX == mX) && (p.mY == mY));
}
inline bool operator!=(const TPoint& p)
{
return ((p.mX != mX) || (p.mY != mY));
}
TPoint operator+(const TPoint& p) const {return TPoint(mX+p.mX, mY+p.mY);}
TPoint operator-(const TPoint& p) const {return TPoint(mX-p.mX, mY-p.mY);}
TPoint operator*(const TPoint& p) const {return TPoint(mX*p.mX, mY*p.mY);}
TPoint operator/(const TPoint& p) const {return TPoint(mX/p.mX, mY/p.mY);}
TPoint& operator+=(const TPoint& p) {mX+=p.mX; mY+=p.mY; return *this;}
TPoint& operator-=(const TPoint& p) {mX-=p.mX; mY-=p.mY; return *this;}
TPoint& operator*=(const TPoint& p) {mX*=p.mX; mY*=p.mY; return *this;}
TPoint& operator/=(const TPoint& p) {mX/=p.mX; mY/=p.mY; return *this;}
TPoint operator*(_T s) const {return TPoint(mX*s, mY*s);}
TPoint operator/(_T s) const {return TPoint(mX/s, mY/s);}
};
typedef TPoint<int> Point;
typedef TPoint<double> FPoint;
};
#endif //__POINT_H__
|