main.cpp 659 B

123456789101112131415161718192021222324252627282930
  1. #include <igl/readOFF.h>
  2. #include <igl/viewer/Viewer.h>
  3. #include <igl/jet.h>
  4. #include "tutorial_shared_path.h"
  5. Eigen::MatrixXd V;
  6. Eigen::MatrixXi F;
  7. Eigen::MatrixXd C;
  8. int main(int argc, char *argv[])
  9. {
  10. // Load a mesh in OFF format
  11. igl::readOFF(TUTORIAL_SHARED_PATH "/screwdriver.off", V, F);
  12. // Plot the mesh
  13. igl::viewer::Viewer viewer;
  14. viewer.data.set_mesh(V, F);
  15. // Use the z coordinate as a scalar field over the surface
  16. Eigen::VectorXd Z = V.col(2);
  17. // Compute per-vertex colors
  18. igl::jet(Z,true,C);
  19. // Add per-vertex colors
  20. viewer.data.set_colors(C);
  21. // Launch the viewer
  22. viewer.launch();
  23. }