00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _EDGE_H
00030 #define _EDGE_H
00031
00032 #include "Tuple.h"
00033
00034 class Element;
00035
00036 class Edge {
00037
00038 Tuple p[2];
00039
00040 public:
00041 Edge() {}
00042 Edge(const Tuple& a, const Tuple& b)
00043 {
00044 if (a < b) {
00045 p[0] = a;
00046 p[1] = b;
00047 } else {
00048 p[0] = b;
00049 p[1] = a;
00050 }
00051 }
00052 Edge(const Edge &rhs) {
00053 p[0] = rhs.p[0];
00054 p[1] = rhs.p[1];
00055 }
00056
00057 bool operator==(const Edge& rhs) const {
00058 return p[0] == rhs.p[0] && p[1] == rhs.p[1];
00059 }
00060 bool operator!=(const Edge& rhs) const {
00061 return !(*this == rhs);
00062 }
00063 bool operator<(const Edge& rhs) const {
00064 return ((p[0] < rhs.p[0]) || ((p[0] == rhs.p[0]) && (p[1] < rhs.p[1])));
00065 }
00066
00067 bool operator>(const Edge& rhs) const {
00068 return ((p[0] > rhs.p[0]) || ((p[0] == rhs.p[0]) && (p[1] > rhs.p[1])));
00069 }
00070
00071 Tuple getPoint(int i) const {
00072 return p[i];
00073 }
00074 };
00075 #endif