int main(int argc, char **argv) { mesh.loadOff("../model/armadillo.off"); double b_min[3], b_max[3]; mesh.buildBbox(b_min, b_max); Levelset lvs(mesh, 1.5, true); printf("Level set initialized\n"); lvs.redist(4.0); lvs.advectAllW(2.0); for (int i = 0; i < 30; i++) { lvs.smooth(0.3); printf("Level set smooth Iter: %d\n", i); } //lvs.mergeCntCmpnt(); // use this to remove island and keep only one piece std::vector<double> mc_verts; std::vector<int> mc_faces; lvs.marchingCubes(mc_verts, mc_faces); mesh_in.loadMesh(mc_verts, mc_faces); printf("Write offset surface to armadillo_in.obj\n"); mesh_in.writeObj("../model/armadillo_in.obj"); opgl_glut_init(argc, argv, "MeshSeg", windowWidth, windowHeight, &windowID, display, reshape, mouse, motion, keyboard, idle); focus[0] = (b_min[0] + b_max[0]) / 2.0; focus[1] = (b_min[1] + b_max[1]) / 2.0; focus[2] = (b_min[2] + b_max[2]) / 2.0; camera = new SphericalCamera(cameraRadius, 0.0f, 0.0f, focus, up, 0.02); glutMainLoop(); return 0; }