code: def get_point_weight(point, tri_points):
      """Get the weights of the position
      Methods: https://gamedev.stackexchange.com/questions/23743/whats-the-most-efficient-way-to-find-barycentric-coordinates
       -m1.compute the area of the triangles formed by embedding the point P inside the triangle
       -m2.Christer Ericson's book "Real-Time Collision Detection". faster.(used)
      Args:
          point: (2,). [u, v] or [x, y]
          tri_points: (3 vertices, 2 coords). three vertices(2d points) of a triangle.
      Returns:
          w0: weight of v0
          w1: weight of v1
          w2: weight of v3
      """
      tp = tri_points
      # vectors
      v0 = tp[2, :] - tp[0, :]
      v1 = tp[1, :] - tp[0, :]
      v2 = point - tp[0, :]
  
      # dot products
      dot00 = np.dot(v0.T, v0)
      dot01 = np.dot(v0.T, v1)
      dot02 = np.dot(v0.T, v2)
      dot11 = np.dot(v1.T, v1)
      dot12 = np.dot(v1.T, v2)
  
      # barycentric coordinates
      if dot00 * dot11 - dot01 * dot01 == 0:
          inverDeno = 0
      else:
          inverDeno = 1 / (dot00 * dot11 - dot01 * dot01)
  
      u = (dot11 * dot02 - dot01 * dot12) * inverDeno
      v = (dot00 * dot12 - dot01 * dot02) * inverDeno
  
      w0 = 1 - u - v
      w1 = v
      w2 = u
  
      return w0, w1, w2
  
file_path: insightface/python-package/insightface/thirdparty/face3d/mesh_numpy/render.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from time import time
label_desc: Use image node_id 2 for calling a global function with example usage: get_point_weight(point, tri_points) and returns: w0,  w1,  w2