202_GaussianCurvature.py 653 B

123456789101112131415161718192021222324252627282930
  1. import sys, os
  2. # Add the igl library to the modules search path
  3. sys.path.insert(0, os.getcwd() + "/../")
  4. import pyigl as igl
  5. from shared import TUTORIAL_SHARED_PATH, check_dependencies
  6. dependencies = ["viewer"]
  7. check_dependencies(dependencies)
  8. # Load mesh
  9. V = igl.eigen.MatrixXd()
  10. F = igl.eigen.MatrixXi()
  11. igl.readOFF(TUTORIAL_SHARED_PATH + "bumpy.off", V, F)
  12. # Compute Gaussian curvature
  13. K = igl.eigen.MatrixXd()
  14. igl.gaussian_curvature(V, F, K)
  15. # Compute pseudocolor
  16. C = igl.eigen.MatrixXd()
  17. igl.jet(K, True, C)
  18. # Plot the mesh with pseudocolors
  19. viewer = igl.viewer.Viewer()
  20. viewer.data.set_mesh(V, F)
  21. viewer.data.set_colors(C)
  22. viewer.launch()