Horizon
edge.h
1 #ifndef H_EDGE
2 #define H_EDGE
3 
4 #include "vector2.h"
5 namespace delaunay{
6 template <class T>
7 class Edge
8 {
9  public:
10  using VertexType = Vector2<T>;
11 
12  Edge(const VertexType &ap1, const VertexType &ap2, double w=-1) : p1(ap1), p2(ap2), weight(w) {};
13  Edge(const Edge &e) : p1(e.p1), p2(e.p2), weight(e.weight) {};
14  Edge(): p1(0,0), p2(0,0) {}
15 
16  VertexType p1;
17  VertexType p2;
18  double weight=0;
19 };
20 
21 template <class T>
22 inline std::ostream &operator << (std::ostream &str, Edge<T> const &e)
23 {
24  return str << "Edge " << e.p1 << ", " << e.p2;
25 }
26 
27 template <class T>
28 inline bool operator == (const Edge<T> & e1, const Edge<T> & e2)
29 {
30  return (e1.p1 == e2.p1 && e1.p2 == e2.p2) ||
31  (e1.p1 == e2.p2 && e1.p2 == e2.p1);
32 }
33 }
34 #endif
35