main.cpp 612 B

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