Files
igl/tutorial/711_Subdivision/main.cpp
T
b0fd49d598 CMake refactor (#1805)
* Start CMake refactoring.

* WIP on instlal().

* Handle install + hunter setup.

* Handle module options + igl_include helper.

* Build all tutorials again.

* Update CMake for unit tests.

* Update triangle lib.

* Update Hunter integration.

* Fix for header-only mode.

* Fix Windows compilation + add GMP/MPFR find_package + set VS folders.

* Fix CGAL build.

* Add copy dll for Windows + improve find gmp/mpfr.

* Update Github Actions.

* Update README.

* Fixes for CMake 3.18

* Fix include option.

* Rename libigl_imgui_front to avoid conflicts.

* Fix when disabling unit tests.

* Build imguizmo with C++11.

* Update CMake option comments.

* Rename nonfree -> restricted.

* Update triangle and tetgen versions.

* Fix compilation issue.

* Update continuous.yml

* remove cork

* finding matlab with default

* mosek module compiles; default detected; osx dylib hack

* Reduce build parallelism.

* Fix find GMP/MPFR on Windows + cleanup CGAL changes.

* Update readme.

Co-authored-by: Alec Jacobson <alecjacobson@adobe.com>
Co-authored-by: Alec Jacobson <alecjacobson@gmail.com>
2022-02-09 18:58:40 -08:00

68 lines
1.5 KiB
C++
Executable File

#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();
}