* 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>
70 lines
1.4 KiB
C++
Executable File
70 lines
1.4 KiB
C++
Executable File
#include <igl/boundary_loop.h>
|
|
#include <igl/readOFF.h>
|
|
#include <igl/opengl/glfw/Viewer.h>
|
|
|
|
#include <igl/lscm.h>
|
|
|
|
|
|
Eigen::MatrixXd V;
|
|
Eigen::MatrixXi F;
|
|
Eigen::MatrixXd V_uv;
|
|
|
|
bool key_down(igl::opengl::glfw::Viewer& viewer, unsigned char key, int modifier)
|
|
{
|
|
|
|
if (key == '1')
|
|
{
|
|
// Plot the 3D mesh
|
|
viewer.data().set_mesh(V,F);
|
|
viewer.core().align_camera_center(V,F);
|
|
}
|
|
else if (key == '2')
|
|
{
|
|
// Plot the mesh in 2D using the UV coordinates as vertex coordinates
|
|
viewer.data().set_mesh(V_uv,F);
|
|
viewer.core().align_camera_center(V_uv,F);
|
|
}
|
|
|
|
viewer.data().compute_normals();
|
|
|
|
return false;
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
using namespace Eigen;
|
|
using namespace std;
|
|
|
|
// Load a mesh in OFF format
|
|
igl::readOFF(TUTORIAL_SHARED_PATH "/camelhead.off", V, F);
|
|
|
|
// Fix two points on the boundary
|
|
VectorXi bnd,b(2,1);
|
|
igl::boundary_loop(F,bnd);
|
|
b(0) = bnd(0);
|
|
b(1) = bnd(bnd.size()/2);
|
|
MatrixXd bc(2,2);
|
|
bc<<0,0,1,0;
|
|
|
|
// LSCM parametrization
|
|
igl::lscm(V,F,b,bc,V_uv);
|
|
|
|
// Scale the uv
|
|
V_uv *= 5;
|
|
|
|
// Plot the mesh
|
|
igl::opengl::glfw::Viewer viewer;
|
|
viewer.data().set_mesh(V, F);
|
|
viewer.data().set_uv(V_uv);
|
|
viewer.callback_key_down = &key_down;
|
|
|
|
// Disable wireframe
|
|
viewer.data().show_lines = false;
|
|
|
|
// Draw checkerboard texture
|
|
viewer.data().show_texture = true;
|
|
|
|
// Launch the viewer
|
|
viewer.launch();
|
|
}
|