<jupyter_start><jupyter_text>Neighborhood Computations<jupyter_code>import numpy as np
import igl
import meshplot
bunny_v, bunny_f = igl.read_triangle_mesh("data/bunny.off")
cube_v, cube_f = igl.read_triangle_mesh("data/cube.obj")
sphere_v, sphere_f = igl.read_triangle_mesh("data/sphere.obj")
meshplot.plot(bunny_v, bunny_f, shading={"wireframe": True})
meshplot.plot(cube_v, cube_f, shading={"wireframe": True})
meshplot.plot(sphere_v, sphere_f, shading={"wireframe": True})<jupyter_output><empty_output><jupyter_text>Vertex-to-Face Relations<jupyter_code>print(igl.vertex_triangle_adjacency(cube_f, len(cube_f)))<jupyter_output>(array([ 0,  6,  7, 10, 11,  0,  1,  7,  8,  0,  1,  2, 11,  1,  2,  3,  8,
        9,  2,  3,  4, 10, 11,  3,  4,  5,  9,  4,  5,  6, 10,  5,  6,  7,
        8,  9], dtype=int32), array([ 0,  5,  9, 13, 18, 23, 27, 31, 36, 36, 36, 36, 36], dtype=int32))<jupyter_text>Vertex-to-Vertex Relations<jupyter_code>print(igl.adjacency_list(cube_f))<jupyter_output>[[1, 2, 4, 6, 7], [0, 2, 3, 7], [0, 1, 3, 4], [1, 2, 4, 5, 7], [0, 2, 3, 5, 6], [3, 4, 6, 7], [0, 4, 5, 7], [0, 1, 3, 5, 6]]<jupyter_text>ShadingMeshplot requires per vertex normals, so we need to "explode" the mesh<jupyter_code>explode_f=cube_f
explode_v=cube_v
# print(explode_f)
# print(explode_v)
explode_v=np.array([explode_v[v] for v in (f for f in explode_f)])
explode_v.resize([explode_f.shape[0]*explode_f.shape[1],3])
print(explode_v)
explode_f=np.array([[3*i,3*i+1,3*i+2] for i in range(explode_f.shape[0])])
print(explode_f)<jupyter_output>[[-0.5 -0.5  0.5]
 [ 0.5 -0.5  0.5]
 [-0.5  0.5  0.5]
 [-0.5  0.5  0.5]
 [ 0.5 -0.5  0.5]
 [ 0.5  0.5  0.5]
 [-0.5  0.5  0.5]
 [ 0.5  0.5  0.5]
 [-0.5  0.5 -0.5]
 [-0.5  0.5 -0.5]
 [ 0.5  0.5  0.5]
 [ 0.5  0.5 -0.5]
 [-0.5  0.5 -0.5]
 [ 0.5  0.5 -0.5]
 [-0.5 -0.5 -0.5]
 [-0.5 -0.5 -0.5]
 [ 0.5  0.5 -0.5]
 [ 0.5 -0.5 -0.5]
 [-0.5 -0.5 -0.5]
 [ 0.5 -0.5 -0.5]
 [-0.5 -0.5  0.5]
 [-0.5 -0.5  0.5]
 [ 0.5 -0.5 -0.5]
 [ 0.5 -0.5  0.5]
 [ 0.5 -0.5  0.5]
 [ 0.5 -0.5 -0.5]
 [ 0.5  0.5  0.5]
 [ 0.5  0.5  0.5]
 [ 0.5 -0.5 -0.5]
 [ 0.5  0.5 -0.5]
 [-0.5 -0.5 -0.5]
 [-0.5 -0.5  0.5]
 [-0.5  0.5 -0.5]
 [-0.5  0.5 -0.5]
 [-0.5 -0.5  0.5]
 [-0.5  0.5  0.5]]
[[ 0  1  2]
 [ 3  4  5]
 [ 6  7  8]
 [ 9 10 11]
 [12 13 14]
 [15 16 17]
 [18 19 20]
 [21 22 23]
 [24 25 26]
 [27 28 29]
 [30 31 32]
 [33 34 35]]<jupyter_text>Flat Shading<jupyter_code>N=igl.per_face_normals(explode_v, explode_f, np.array([1.0,1.0,1.0]))
meshplot.plot(explode_v, explode_f,n=N,shading={"wireframe": True,"flat": False})<jupyter_output><empty_output><jupyter_text>Per-vertex Shading<jupyter_code>N=igl.per_vertex_normals(explode_v, explode_f)
meshplot.plot(explode_v, explode_f,n=N,shading={"wireframe": True,"flat": False})<jupyter_output><empty_output><jupyter_text>Per-corner Shading<jupyter_code>N=igl.per_corner_normals(explode_v, explode_f,1)
meshplot.plot(explode_v, explode_f,n=N,shading={"wireframe": True,"flat": False})<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21727395411605938, 'fraction_numerical': 0.1346153846153846, 'mean_word_length': 3.418777943368107, 'pattern_counts': {'":': 9, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '117956', 'license': 'MIT', 'n_tokens_mistral': 1727, 'n_tokens_neox': 1569, 'n_words': 313, 'path': 'Assignment_1/Assigment1.ipynb', 'repo_name': 'AmazingJinqi/gp', 'size': '2964'}