* 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>
39 lines
973 B
C++
39 lines
973 B
C++
#include <igl/barycenter.h>
|
|
#include <igl/colon.h>
|
|
#include <igl/jet.h>
|
|
#include <igl/readOFF.h>
|
|
#include <igl/slice_into.h>
|
|
#include <igl/sortrows.h>
|
|
#include <igl/opengl/glfw/Viewer.h>
|
|
#include <iostream>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
using namespace Eigen;
|
|
using namespace std;
|
|
MatrixXd V;
|
|
MatrixXi F;
|
|
igl::readOFF(TUTORIAL_SHARED_PATH "/decimated-knight.off",V,F);
|
|
|
|
// Sort barycenters lexicographically
|
|
MatrixXd BC,sorted_BC;
|
|
igl::barycenter(V,F,BC);
|
|
VectorXi I,J;
|
|
// sorted_BC = BC(I,:)
|
|
igl::sortrows(BC,true,sorted_BC,I);
|
|
// Get sorted "place" from sorted indices
|
|
J.resize(I.rows());
|
|
// J(I) = 1:numel(I)
|
|
igl::slice_into(igl::colon<int>(0,I.size()-1),I,J);
|
|
|
|
// Pseudo-color based on sorted place
|
|
MatrixXd C;
|
|
igl::jet(J,true,C);
|
|
|
|
// Plot the mesh with pseudocolors
|
|
igl::opengl::glfw::Viewer viewer;
|
|
viewer.data().set_mesh(V, F);
|
|
viewer.data().set_colors(C);
|
|
viewer.launch();
|
|
}
|