code: def get_normal(vertices, triangles):
      """calculate normal direction in each vertex
      Args:
          vertices: [nver, 3]
          triangles: [ntri, 3]
      Returns:
          normal: [nver, 3]
      """
      pt0 = vertices[triangles[:, 0], :]  # [ntri, 3]
      pt1 = vertices[triangles[:, 1], :]  # [ntri, 3]
      pt2 = vertices[triangles[:, 2], :]  # [ntri, 3]
      tri_normal = np.cross(
          pt0 - pt1, pt0 - pt2
      )  # [ntri, 3]. normal of each triangle
  
      normal = np.zeros_like(vertices)  # [nver, 3]
      for i in range(triangles.shape[0]):
          normal[triangles[i, 0], :] = (
              normal[triangles[i, 0], :] + tri_normal[i, :]
          )
          normal[triangles[i, 1], :] = (
              normal[triangles[i, 1], :] + tri_normal[i, :]
          )
          normal[triangles[i, 2], :] = (
              normal[triangles[i, 2], :] + tri_normal[i, :]
          )
  
      # normalize to unit length
      mag = np.sum(normal**2, 1)  # [nver]
      zero_ind = mag == 0
      mag[zero_ind] = 1
      normal[zero_ind, 0] = np.ones((np.sum(zero_ind)))
  
      normal = normal / np.sqrt(mag[:, np.newaxis])
  
      return normal
  
file_path: insightface/python-package/insightface/thirdparty/face3d/mesh_numpy/light.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: get_normal(vertices, triangles) and returns: normal