This is an example of how to use the netdem library.
#include <filesystem>
#include <iostream>
#include <string>
using namespace std;
void GenDataset(int num_samples = 100);
void TrainNetSDF();
void TestNetSDF();
void TrainNetSPF();
void TestNetSPF();
void TestShapeNetSDF();
void TrainCodedNetSDF();
void TestCodedNetSDF();
void TestCodedShape();
void TestLatentSpace();
void PerfSDFQuery(int argc, char **argv);
void SamplesToVTK(string &filename);
void RandomEllipsoid();
void RandomPacking(int argc, char **argv);
void RandomPackingEllipsoid(int argc, char **argv);
int main(
int argc,
char **argv) {
if (argc == 1) {
cout << "please specify the id of the task. \n"
<< "e.g.: netdem_example_shape_netsdf id" << endl;
cout << ">> 00: genertate dataset for signed distance field and surface "
"projection point"
<< endl;
cout << ">> 01: train regressor for sdf" << endl;
cout << ">> 02: test regressor for sdf" << endl;
cout << ">> 03: train regressor for spf" << endl;
cout << ">> 04: test regressor for spf" << endl;
cout << ">> 05: test shape netsdf" << endl;
cout << ">> 11: train coded netsdf" << endl;
cout << ">> 12: test coded sdf" << endl;
cout << ">> 15: test the shape represented by coded netsdf" << endl;
cout << ">> 16: latent_space_interpolation" << endl;
cout << ">> 80: create a vtk file to view the sampled data points" << endl;
cout << ">> 81: generate an ellipsoid" << endl;
cout << ">> 90: random packing" << endl;
return -1;
}
int id = atof(argv[1]);
switch (id) {
case 0:
if (argc == 2) {
GenDataset();
} else if (argc == 3) {
int num_samples = atof(argv[2]);
GenDataset(num_samples);
}
break;
case 1:
TrainNetSDF();
break;
case 2:
TestNetSDF();
break;
case 3:
TrainNetSPF();
break;
case 4:
TestNetSPF();
break;
case 5:
TestShapeNetSDF();
break;
case 11:
TrainCodedNetSDF();
break;
case 12:
TestCodedNetSDF();
break;
case 15:
TestCodedShape();
break;
case 16:
TestLatentSpace();
break;
case 70:
PerfSDFQuery(argc, argv);
break;
case 80:
if (argc == 3) {
string filename(argv[2]);
SamplesToVTK(filename);
} else {
cout << ">> 80 [filename]" << endl;
}
break;
case 81:
RandomEllipsoid();
break;
case 90:
RandomPacking(argc, argv);
break;
default:
break;
}
return 0;
}
int main(int argc, char *argv[])
Definition main.cpp:18