202_GaussianCurvature.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # This file is part of libigl, a simple c++ geometry processing library.
  2. #
  3. # Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
  4. #
  5. # This Source Code Form is subject to the terms of the Mozilla Public License
  6. # v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. # obtain one at http://mozilla.org/MPL/2.0/.
  8. import sys, os
  9. # Add the igl library to the modules search path
  10. sys.path.insert(0, os.getcwd() + "/../")
  11. import pyigl as igl
  12. from shared import TUTORIAL_SHARED_PATH, check_dependencies
  13. dependencies = ["glfw"]
  14. check_dependencies(dependencies)
  15. # Load mesh
  16. V = igl.eigen.MatrixXd()
  17. F = igl.eigen.MatrixXi()
  18. igl.readOFF(TUTORIAL_SHARED_PATH + "bumpy.off", V, F)
  19. # Compute Gaussian curvature
  20. K = igl.eigen.MatrixXd()
  21. igl.gaussian_curvature(V, F, K)
  22. # Compute pseudocolor
  23. C = igl.eigen.MatrixXd()
  24. igl.jet(K, True, C)
  25. # Plot the mesh with pseudocolors
  26. viewer = igl.glfw.Viewer()
  27. viewer.data().set_mesh(V, F)
  28. viewer.data().set_colors(C)
  29. viewer.launch()