00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef INCL_PLPOINT
00012 #define INCL_PLPOINT
00013
00014
00015
00016
00017 class PLPoint
00018 {
00019 public:
00020
00021 int x;
00022
00023 int y;
00024
00025
00026 PLPoint
00027 ();
00028
00029
00030 PLPoint
00031 ( int X,
00032 int Y
00033 );
00034
00035
00036 bool operator ==
00037 ( const PLPoint & pt
00038 ) const;
00039
00040
00041 bool operator !=
00042 ( const PLPoint & pt
00043 ) const;
00044
00045
00046 void operator +=
00047 ( const PLPoint & pt
00048 );
00049
00050
00051 void operator -=
00052 ( const PLPoint & pt
00053 );
00054
00055
00056 PLPoint operator -
00057 () const;
00058
00059
00060 PLPoint operator +
00061 ( const PLPoint & pt
00062 ) const;
00063
00064
00065 PLPoint operator -
00066 ( const PLPoint & pt
00067 ) const;
00068
00069
00070 PLPoint operator /
00071 ( double f
00072 ) const;
00073 };
00074
00075 inline PLPoint::PLPoint
00076 ()
00077 {}
00078
00079
00080 inline PLPoint::PLPoint
00081 ( int X,
00082 int Y
00083 )
00084 {
00085 x = X;
00086 y = Y;
00087 }
00088
00089 inline bool PLPoint::operator ==
00090 ( const PLPoint & pt
00091 ) const
00092 {
00093 return (x == pt.x && y == pt.y);
00094 }
00095
00096 inline bool PLPoint::operator !=
00097 ( const PLPoint & pt
00098 ) const
00099 {
00100 return (x != pt.x || y != pt.y);
00101 }
00102
00103 inline void PLPoint::operator +=
00104 ( const PLPoint & pt
00105 )
00106 {
00107 x += pt.x;
00108 y += pt.y;
00109 }
00110
00111 inline void PLPoint::operator -=
00112 ( const PLPoint & pt
00113 )
00114 {
00115 x -= pt.x;
00116 y -= pt.y;
00117 }
00118
00119 inline PLPoint PLPoint::operator -
00120 () const
00121 {
00122 return PLPoint(-x, -y);
00123 }
00124
00125 inline PLPoint PLPoint::operator +
00126 ( const PLPoint & pt
00127 ) const
00128 {
00129 return PLPoint(x + pt.x, y + pt.y);
00130 }
00131
00132 inline PLPoint PLPoint::operator -
00133 ( const PLPoint & pt
00134 ) const
00135 {
00136 return PLPoint(x - pt.x, y - pt.y);
00137 }
00138
00139 inline PLPoint PLPoint::operator /
00140 ( double f
00141 ) const
00142 {
00143 return PLPoint (int(x/f), int(y/f));
00144 }
00145
00146 #endif
00147
00148
00149
00150
00151