-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestDiscoverTopo.cc
More file actions
40 lines (36 loc) · 1.36 KB
/
testDiscoverTopo.cc
File metadata and controls
40 lines (36 loc) · 1.36 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
#include "modelGen2d.h"
#include "curveReader.h"
#include <numeric>
int main(int argc, char **argv) {
const int numExpectedArgs = 2;
if (argc != numExpectedArgs) {
std::cerr << "Usage: <input csv file>\n";
std::cerr << "input csv file with the following columns: "
"x,y,z,isOnCurve,angle,isMdlVtx\n";
return 1;
}
assert(argc == numExpectedArgs);
std::string filename = argv[1];
std::cout << "input csv file: " << argv[1] << "\n";
auto curveInfo = CurveReader::readCurveInfo(filename);
CurveReader::printCurveInfo(curveInfo);
ModelFeatures features;
features.outer.numVtx = 4;
for(int i=0; i < 4; i++) {
features.outer.vtx_x.push_back(curveInfo.x[i]);
features.outer.vtx_y.push_back(curveInfo.y[i]);
}
features.inner.numVtx = curveInfo.isMdlVtx.size()-4;
for(int i=0, j=4; j < curveInfo.isMdlVtx.size(); j++, i++) {
features.inner.vtx_x.push_back(curveInfo.x[j]);
features.inner.vtx_y.push_back(curveInfo.y[j]);
}
auto coincidentPtTolSquared = 1.0;
auto angleTol = 120.0;
auto onCurveAngleTol = 40.0;
auto debug = true;
auto [isPointOnCurve, isMdlVtx] = discoverTopology(features.inner, coincidentPtTolSquared, angleTol, onCurveAngleTol, debug);
auto numMdlVerts = std::accumulate(isMdlVtx.begin(), isMdlVtx.end(), 0);
std::cout << "number of model vertices: " << numMdlVerts << std::endl;
return 0;
}