102_DrawMesh.py 471 B

123456789101112131415161718192021
  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 a mesh in OFF format
  9. V = igl.eigen.MatrixXd()
  10. F = igl.eigen.MatrixXi()
  11. igl.readOFF(TUTORIAL_SHARED_PATH + "beetle.off", V, F)
  12. # Plot the mesh
  13. viewer = igl.viewer.Viewer()
  14. viewer.data.set_mesh(V, F)
  15. viewer.launch()