#include #include #include #include #include #include #include "tutorial_shared_path.h" int main(int argc, char * argv[]) { using namespace Eigen; using namespace std; using namespace igl; MatrixXi F; MatrixXd V; // Read in inputs as double precision floating point meshes read_triangle_mesh( TUTORIAL_SHARED_PATH "/armadillo.obj",V,F); // number of vertices on the largest side const int s = 50; const RowVector3d Vmin = V.colwise().minCoeff(); const RowVector3d Vmax = V.colwise().maxCoeff(); const double h = (Vmax-Vmin).maxCoeff()/(double)s; const RowVector3i res = (s*((Vmax-Vmin)/(Vmax-Vmin).maxCoeff())).cast(); // create grid cout<<"Creating grid..."<double {return Vmin(d)+(double)di/(double)(res(d)-1)*(Vmax(d)-Vmin(d));}; const double z = lerp(zi,2); for(int yi = 0;yi aliasing artifacts B = S; for_each(B.data(),B.data()+B.size(),[](double& b){b=(b>0?1:(b<0?-1:0));}); } cout<<"Marching cubes..."<bool { switch(key) { default: return false; case '1': viewer.data.clear(); viewer.data.set_mesh(V,F); break; case '2': viewer.data.clear(); viewer.data.set_mesh(SV,SF); break; case '3': viewer.data.clear(); viewer.data.set_mesh(BV,BF); break; } viewer.data.set_face_based(true); return true; }; viewer.launch(); }