Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1.     for i in range(0, len(f)):
  2.         e0 = v[f[i][0]]
  3.         e1 = v[f[i][1]]
  4.         e2 = v[f[i][2]]
  5.         a = e0 - e1
  6.         b = e2 - e0
  7.         c = e1 - e2
  8.         orthe0 = np.cross(a, b) / np.linalg.norm(np.cross(a, b))
  9.         gradient[f[i][0]] = gradient[f[i][0]] + np.cross(c, orthe0)
  10.         orthe1 = np.cross(c, a) / np.linalg.norm(np.cross(c, a))
  11.         gradient[f[i][1]] = gradient[f[i][1]] + np.cross(b, orthe1)
  12.         orthe2 = np.cross(b, c) / np.linalg.norm(np.cross(b, c))
  13.         gradient[f[i][2]] = gradient[f[i][2]] + np.cross(a, orthe2)
  14.  
  15.     return gradient
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement