-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (31 loc) · 938 Bytes
/
main.cpp
File metadata and controls
33 lines (31 loc) · 938 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
#include <fstream>
#include <iostream>
#include <vector>
#include "CSVReader.h"
#include "TriangleNet.h"
#include "VPoint.h"
#include "VTriangle.h"
using namespace std;
bool cmpPoint(VPoint p0, VPoint p1) {
return p0.getX() < p1.getX();
}
int main() {
vector<VPoint> pts = CSVReader::readCSVToPts("data\\pts2.csv");
TriangleNet tn(pts);
tn.buildTriangleNet();
tn.triangleGrownth();
vector<VTriangle> triangles = tn.getTriangles();
cout << triangles.size() << "\n";
ofstream out("data\\triangles.txt");
for (auto triangle : triangles) {
vector<VPoint> points = triangle.getPoints();
string str =
to_string(points[0].getX()) + " " + to_string(points[0].getY()) + "," +
to_string(points[1].getX()) + " " + to_string(points[1].getY()) + "," +
to_string(points[2].getX()) + " " + to_string(points[2].getY()) + "\n";
out << str.c_str();
}
out.close();
system("pause");
return 0;
}