This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import igl | |
import numpy as np | |
import polyscope as ps | |
import scipy | |
# https://www.cs.cmu.edu/~kmcrane/Projects/ModelRepository/spot.zip | |
path = "/Users/cbabraham/data/mesh/spot/spot_triangulated.obj" | |
verts,faces = igl.read_triangle_mesh(path) | |
ps.init() | |
original = ps.register_surface_mesh("mesh", verts, faces) | |
L = igl.cotmatrix(verts, faces) | |
M = igl.massmatrix(verts, faces) | |
# eigendecomposition of the laplacian | |
eigenvals, eigenvecs = scipy.sparse.linalg.eigsh(L, 6, M) | |
for i, eigenvector in enumerate(eigenvecs.swapaxes(0,1)): | |
original.add_scalar_quantity( | |
"eigenvector-{}".format(i), | |
eigenvector.astype(np.float32), # discard complex components | |
defined_on='vertices' | |
) | |
ps.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure exactly what I was expecting but this doesn't seem right.
