Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i in range(0, len(f)):
- e0 = v[f[i][0]]
- e1 = v[f[i][1]]
- e2 = v[f[i][2]]
- a = e0 - e1
- b = e2 - e0
- c = e1 - e2
- orthe0 = np.cross(a, b) / np.linalg.norm(np.cross(a, b))
- gradient[f[i][0]] = gradient[f[i][0]] + np.cross(c, orthe0)
- orthe1 = np.cross(c, a) / np.linalg.norm(np.cross(c, a))
- gradient[f[i][1]] = gradient[f[i][1]] + np.cross(b, orthe1)
- orthe2 = np.cross(b, c) / np.linalg.norm(np.cross(b, c))
- gradient[f[i][2]] = gradient[f[i][2]] + np.cross(a, orthe2)
- return gradient
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement