-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEdge2D.cpp
72 lines (39 loc) · 1.26 KB
/
Edge2D.cpp
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
62
63
64
65
66
67
68
69
70
71
72
// Edge2D Class
// Damien MATTEI
#include "Edge2D.hpp"
// implementations
template <class T> Edge2D<T>::Edge2D() : a(), b() {
#ifdef DISPLAY_CONSTRUCTOR
cout << "# constructor " << this->display() << " #" << endl;
#endif
}
// create edge AB from point A and B
//template <class T> Edge2D<T>::Edge2D(Point2D<T> a,Point2D<T> b) : a(a), b(b) {*
template <class T> Edge2D<T>::Edge2D(Point2D<T> ap,Point2D<T> bp) {
a = ap;
b = bp;
#ifdef DISPLAY_CONSTRUCTOR
cout << "# constructor " << this->display() << " #" << endl;
#endif
}
template <class T> Edge2D<T>::~Edge2D() {
#ifdef DISPLAY_CONSTRUCTOR
cout << "# destructor " << this->display() << " #" << endl;
#endif
}
template <class T> string Edge2D<T>::display(void) {
std::stringstream stream;
stream << "Edge2D @" << " 0x" << std::hex << (long)this << " "
<< " [" << this->a.display() << " <--> " << this->b.display() << "]";
return stream.str();
}
template <class T> ostream& operator<< (ostream &out, Edge2D<T> &e)
{
out << " [" << e.a << " <--> " << e.b << "]";
return out;
}
// template<class T> T Edge2D<T>::norm() {
// return ( sqrt(x * x + y * y + z * z) );
// }
template class Edge2D<double>;
template ostream& operator<< (ostream &out, Edge2D<double> &e);