-
Notifications
You must be signed in to change notification settings - Fork 14
/
remeshmesh.cpp
54 lines (48 loc) · 1.4 KB
/
remeshmesh.cpp
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
#include "src/remesh_botsch.h"
#include <igl/read_triangle_mesh.h>
#include <igl/write_triangle_mesh.h>
using namespace std;
int main(int argc, const char* argv[]){
Eigen::MatrixXd V;
Eigen::VectorXd target;
Eigen::MatrixXi F;
string in,out;
bool project = false;
int iterations = 10;
double h = 0.05;
out = "output.obj";
int argindex = 0;
if(argc>1){
in = argv[1];
argindex = 1;
}else{
std::cout<<R"(
No input specified. To run in command line, issue
./remeshmesh [input.ext] [output.ext] [-i num_iterations] [-h target_edge_length]
The mesh in input.ext must be closed and manifold,
and ext can be either of obj, ply, off, stl or mesh.
)";
return argindex;
}
while(argindex+1<argc){
if(strncmp(argv[argindex+1],"-i",2)==0){
iterations = atoi(argv[argindex+2]);
argindex = argindex+2;
}else{
if(strncmp(argv[argindex+1],"-h",2)==0){
h = atof(argv[argindex+2]);
argindex = argindex+2;
}else{
if(strncmp(argv[argindex+1],"-p",2)==0){
project = true;
argindex = argindex+1;
}else{
out = argv[argindex+1];
argindex = argindex+1;
}}}
}
igl::read_triangle_mesh(in,V,F);
target = Eigen::VectorXd::Constant(V.rows(),h);
remesh_botsch(V,F,target,iterations,project);
igl::write_triangle_mesh(out,V,F);
}