You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
1.5 KiB

#include <igl/read_triangle_mesh.h>
#include <igl/loop.h>
#include <igl/upsample.h>
#include <igl/false_barycentric_subdivision.h>
#include <igl/opengl/glfw/Viewer.h>
#include <Eigen/Core>
#include <iostream>
int main(int argc, char * argv[])
{
using namespace std;
using namespace igl;
Eigen::MatrixXi OF,F;
Eigen::MatrixXd OV,V;
bool show_swept_volume = false;
read_triangle_mesh(
TUTORIAL_SHARED_PATH "/decimated-knight.off",OV,OF);
V = OV;
F = OF;
cout<<R"(Usage:
1 Restore Original mesh
2 Apply In-plane upsampled mesh
3 Apply Loop subdivided mesh
4 Apply False barycentric subdivision
)";
igl::opengl::glfw::Viewer viewer;
viewer.data().set_mesh(V,F);
viewer.data().set_face_based(true);
viewer.callback_key_down =
[&](igl::opengl::glfw::Viewer & viewer, unsigned char key, int mod)->bool
{
switch(key)
{
default:
return false;
case '1':
{
V = OV;
F = OF;
break;
}
case '2':
{
igl::upsample( Eigen::MatrixXd(V), Eigen::MatrixXi(F), V,F);
break;
}
case '3':
{
igl::loop( Eigen::MatrixXd(V), Eigen::MatrixXi(F), V,F);
break;
}
case '4':
{
igl::false_barycentric_subdivision(
Eigen::MatrixXd(V),Eigen::MatrixXi(F),V,F);
break;
}
}
viewer.data().clear();
viewer.data().set_mesh(V,F);
viewer.data().set_face_based(true);
return true;
};
viewer.launch();
}