123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import sys, os
- sys.path.insert(0, os.getcwd() + "/../")
- import pyigl as igl
- V = igl.eigen.MatrixXd()
- F = igl.eigen.MatrixXi()
- igl.readOFF("../../tutorial/shared/cheburashka.off", V, F)
- U = igl.eigen.MatrixXd()
- igl.readDMAT("../../tutorial/shared/cheburashka-scalar.dmat",U)
- U = U.col(0)
- G = igl.eigen.SparseMatrixd()
- igl.grad(V,F,G)
- GU = (G*U).MapMatrix(F.rows(),3)
- GU_mag = GU.rowwiseNorm()
- viewer = igl.viewer.Viewer()
- viewer.data.set_mesh(V, F)
- C = igl.eigen.MatrixXd()
- igl.jet(U,True,C)
- viewer.data.set_colors(C);
- max_size = igl.avg_edge_length(V,F) / GU_mag.mean()
- BC = igl.eigen.MatrixXd()
- igl.barycenter(V,F,BC)
- black = igl.eigen.MatrixXd([[0.0,0.0,0.0]])
- viewer.data.add_edges(BC,BC+max_size*GU, black)
- viewer.core.show_lines = False
- viewer.launch()
|