00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CARTESIAN_H
00012 #define CARTESIAN_H
00013
00014
00015 #include <iostream>
00016
00017 namespace mimas {
00018
00019
00020 template <typename T>
00021 class Cartesian
00022 {
00023
00024 public:
00025 typedef std::ostream ostream;
00026 T x, y;
00027
00028 Cartesian()
00029 {
00030 x=0;
00031 y=0;
00032 }
00033
00034 ~Cartesian(){}
00035
00036 Cartesian(const Cartesian ©coord)
00037 {
00038 x=copycoord.x;
00039 y=copycoord.y;
00040 }
00041
00042
00043 friend ostream &operator<<(ostream &output,
00044 const Cartesian &outcoord)
00045 {
00046 output << outcoord.x << ' ' << outcoord.y;
00047 return output;
00048 }
00049
00050
00051 Cartesian& operator=(const Cartesian &rhs)
00052 {
00053 this->x=rhs.x;
00054 this->y=rhs.y;
00055 return *this;
00056 }
00057
00058 int operator==(const Cartesian &rhs) const
00059 {
00060 if (this->x!=rhs.x) return 0;
00061 if (this->y!=rhs.y) return 0;
00062 return 1;
00063 }
00064
00065 int operator<(const Cartesian &rhs) const
00066 {
00067 if (this->x < rhs.x) return 1;
00068 if (this->y < rhs.y) return 1;
00069 return 0;
00070 }
00071
00072 };
00073
00074 }
00075 #endif