201_Normals.py 637 B

123456789101112131415161718192021222324
  1. # Load a mesh in OFF format
  2. V = igl.eigen.MatrixXd()
  3. F = igl.eigen.MatrixXi()
  4. igl.readOFF("../shared/fandisk.off", V, F);
  5. # Compute per-face normals
  6. N_faces = igl.eigen.MatrixXd()
  7. igl::per_face_normals(V,F,N_faces);
  8. print("igl::per_face_normals: \n", N_faces, sep='')
  9. # Compute per-vertex normals
  10. N_vertices = igl.eigen.MatrixXd()
  11. igl::per_vertex_normals(V,F,N_vertices);
  12. print("igl::per_face_normals: \n", N_vertices, sep='')
  13. # Compute per-corner normals, |dihedral angle| > 20 degrees --> crease
  14. N_corners = igl.eigen.MatrixXd()
  15. igl::per_corner_normals(V,F,20,N_corners);
  16. print("igl::per_face_normals: \n", N_corners, sep='')
  17. }