-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (27 loc) · 859 Bytes
/
Copy pathmain.cpp
File metadata and controls
35 lines (27 loc) · 859 Bytes
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
#include <iostream>
#include "utils.h"
#include "polygon.h"
#include "tests.h"
using namespace GeomUtils;
int main() {
Polygon rect;
rect.addVertex(2, 4);
rect.addVertex(2, 6);
rect.addVertex(1, 6);
rect.addVertex(1, 4);
Polygon poly;
poly.addVertex(2.4, 4.4);
poly.addVertex(2.4, 3.6);
poly.addVertex(1.3, 3.6);
poly.addVertex(1.3, 3.8);
poly.addVertex(1.7, 4.4);
vector<vector<double>> intersections = computePgonIntersections(rect, poly);
cout << "Number of intersections: " + to_string(intersections.size());
cout << "\n\n";
for (int i = 0; i < intersections.size(); i++) {
cout << "Computed intersection: " + to_string(intersections[i][0]) + ", " + to_string(intersections[i][1]) + "\n";
}
cout << "\n";
pointInsidePgonTests();
Polygon testPgon = rect + poly;
};