-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsupport.cpp
More file actions
48 lines (43 loc) · 1.23 KB
/
Copy pathsupport.cpp
File metadata and controls
48 lines (43 loc) · 1.23 KB
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
#include "provided.h"
#include "support.h"
#include <string>
using namespace std;
bool operator<(const GeoCoord& g1, const GeoCoord& g2) {
return g1.latitudeText + g1.longitudeText < g2.latitudeText + g2.longitudeText;
}
bool operator==(const GeoCoord& g1, const GeoCoord& g2) {
return g1.latitudeText + g1.longitudeText == g2.latitudeText + g2.longitudeText;
}
bool operator>(const GeoCoord& g1, const GeoCoord& g2) {
return g1.latitudeText + g1.longitudeText > g2.latitudeText + g2.longitudeText;
}
string directionOfLine(const GeoSegment& gs) {
double angle = angleOfLine(gs);
if(angle >= 0 && angle <= 22.5) {
return "east";
}
else if(angle > 22.5 && angle <= 67.5) {
return "northeast";
}
else if(angle > 67.5 && angle <= 112.5) {
return "north";
}
else if(angle > 112.5 && angle <= 157.5) {
return "northwest";
}
else if(angle > 157.5 && angle <= 202.5) {
return "west";
}
else if(angle > 202.5 && angle <= 247.5) {
return "southwest";
}
else if(angle > 247.5 && angle <= 292.5) {
return "south";
}
else if(angle > 292.5 && angle <= 337.5) {
return "southeast";
}
else {
return "east";
}
}