MCPcopy Index your code
hub / github.com/Colin97/DeepMetaHandles / main

Function main

data_preprocessing/sample_key_points.cpp:58–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58int main(int argc, char *argv[])
59{
60 printf("%s\n", argv[1]);
61
62 if(!igl::readOBJ(argv[1],surface.V,surface.F))
63 {
64 std::cout<<"failed to load mesh"<<std::endl;
65 }
66 n = surface.V.rows();
67 m = surface.F.rows();
68
69 head.resize(n, -1);
70 dis.resize(n, 1e9);
71 is_key_point.resize(n, false);
72 for (int i = 0; i < m; i++) {
73 int a = surface.F(i, 0), b = surface.F(i, 1), c = surface.F(i, 2);
74 add(a, b); add(b,a); add(a,c); add(c,a); add(b,c); add(c,b);
75 }
76 //std::cout << edges.size() << std::endl;
77 const int n_key_points = atoi(argv[3]);
78 Eigen::VectorXi key_points(n_key_points);
79 for (int i = 0; i < n_key_points; i++) {
80 int u = -1;
81 if (i == 0)
82 u = 0;
83 else {
84 for (int j = 0; j < n; j++)
85 if (is_key_point[j] == false && (u == -1 || dis[j] > dis[u]))
86 u = j;
87 }
88 dis[u] = 0;
89 is_key_point[u] = true;
90 spfa(u);
91 key_points[i] = u;
92 }
93
94 igl::slice(surface.V,key_points,1,output.V);
95 igl::writeOBJ(argv[2],output.V,output.F);
96 return 0;
97}

Callers

nothing calls this directly

Calls 2

addFunction · 0.85
spfaFunction · 0.85

Tested by

no test coverage detected