-
-
Save JossWhittle/ad9d9d4e0bc2197db349d76fc329ae33 to your computer and use it in GitHub Desktop.
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
F = meshes[0]["Faces"].copy().sort(1) | |
num_faces = F.shape[0] | |
edges = {} | |
for i in range(num_faces): | |
edges.setdefault(tuple(F[i,:2]), []).append(i) | |
edges.setdefault(tuple(F[i,1:3]), []).append(i) | |
edges.setdefault(tuple(F[i,[0,2]]), []).append(i) | |
neighbours = np.zeros((num_faces, 3), dtype=np.uint32) | |
idx = np.zeros((num_faces), dtype=np.uint32) | |
for ef in edges.values(): | |
neighbours[ef[0], idx[ef[0]]] = ef[1] | |
neighbours[ef[1], idx[ef[1]]] = ef[0] | |
idx[ef[0]] += 1 | |
idx[ef[1]] += 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment