-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
89 lines (69 loc) · 2.67 KB
/
Copy pathmain.cpp
File metadata and controls
89 lines (69 loc) · 2.67 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include<iostream>
#include "GCP2D.hpp"
int main()
{
Point A{ 50, 50 }; //A._p[0] = 50; A._p[1] = 50;
Point B{ 550, 50 };
Point C{ 550, 700 };
Point D{ 50, 700 };
Point E{ 200, 50 };
Point F{ 200, 100 };
Point G{ 100, 100 };
Point H{ 100, 50 };
Point I{ 440, 660 };
Point J{ 480, 660 };
Point K{ 520, 620 };
Point L{ 520, 580 };
Point M{ 480, 540 };
Point N{ 400, 620 };
Point O{ 400, 580 };
Point P{ 440, 540 };
Point Q{ 440, 460 };
Point R{ 380, 400 };
Point S{ 480, 460 };
Point T{ 420, 400 };
Point U{ 380, 220 };
Point V{ 420, 220 };
Point W{ 340, 220 };
Point Z{ 340, 180 };
Point a1{ 460, 180 };
Point b1{ 460, 220 };
Point x1{ 150, 600 };
Point x2{ 250, 600 };
Point x3{ 250, 500 };
Point x4{ 150, 500 };
Point y1{ 150, 400 };
Point y2{ 250, 400 };
Point y3{ 250, 300 };
Point y4{ 150, 300 };
std::vector<Point> p; std::vector<Point> e;
p.push_back(A); p.push_back(B); p.push_back(C); p.push_back(D); p.push_back(E);
p.push_back(F); p.push_back(G); p.push_back(H); p.push_back(I);/*8*/ p.push_back(J);
p.push_back(K); p.push_back(L); p.push_back(M); p.push_back(N); /*13*/p.push_back(O);
p.push_back(P); p.push_back(Q); p.push_back(R); p.push_back(S);/*18*/ p.push_back(T);
p.push_back(U); p.push_back(V); p.push_back(W); p.push_back(Z); /*23*/
p.push_back(a1); p.push_back(b1);
p.push_back(x1); p.push_back(x2); p.push_back(x3); p.push_back(x4);
p.push_back(y1); p.push_back(y2); p.push_back(y3); p.push_back(y4);
e.push_back({ 1, 2 }); e.push_back({ 2, 3 }); e.push_back({ 3, 0 }); e.push_back({ 1, 4 });
e.push_back({ 4, 5 }); e.push_back({ 5, 6 }); e.push_back({ 7, 6 }); e.push_back({ 7, 0 });
e.push_back({ 8, 9 }); e.push_back({ 9, 10 }); e.push_back({ 10, 11 }); e.push_back({ 13, 14 });
e.push_back({ 14, 15 }); e.push_back({ 8, 13 }); e.push_back({ 11, 12 }); e.push_back({ 19, 21 });
e.push_back({ 15, 16 }); e.push_back({ 12, 18 }); e.push_back({ 22, 20 }); e.push_back({ 21, 25 });
e.push_back({ 17, 16 }); e.push_back({ 18, 19 });
e.push_back({ 20, 17 }); e.push_back({ 23, 22 }); e.push_back({ 24, 23 }); e.push_back({ 25, 24 });
e.push_back({ 26, 27 }); e.push_back({ 27, 28 }); e.push_back({ 28, 29 }); e.push_back({ 29, 26 });
e.push_back({ 30, 31 }); e.push_back({ 31, 32 }); e.push_back({ 32, 33 }); e.push_back({ 33, 30 });
GCP2D gcp2d;
gcp2d.SetPoints(p);
gcp2d.SetConstraints(e);
gcp2d.DoTriangulation();
std::cout<<"三角形数量: " << gcp2d.bottomTriCount << std::endl;;
std::cout << "输出索引:(两个三角形;六个数字一行) " << std::endl;
for (int i = 0; i < gcp2d.bottomTriCount*3; i++) {
std::cout << gcp2d.triIndex[i] << " , ";
if (i % 6 == 5) std::cout << std::endl;
}
visualization(p, e, gcp2d);
return 0;
}