class_docstr: Fast 'geometric' approximation, recommended for large arrays.
class_docstr_tok: ["Fast","'geometric","'","approximation",",","recommended","for","large","arrays","."]
docstr: Build the (nelems, 3) weights coeffs of _triangles angles,
  renormalized so that np.sum(weights, axis=1) == np.ones(nelems)
docstr_tok: ["Build","the","(","nelems",",","3",")","weights","coeffs","of","_triangles","angles",",","renormalized","so","that","np.sum","(","weights",",","axis=1",")","==","np.ones","(","nelems",")"]
code: def compute_geom_weights(self):
      """
      Build the (nelems, 3) weights coeffs of _triangles angles,
      renormalized so that np.sum(weights, axis=1) == np.ones(nelems)
      """
      weights = np.zeros([np.size(self._triangles, 0), 3])
      tris_pts = self._tris_pts
      for ipt in range(3):
          p0 = tris_pts[:, ipt % 3, :]
          p1 = tris_pts[:, (ipt + 1) % 3, :]
          p2 = tris_pts[:, (ipt - 1) % 3, :]
          alpha1 = np.arctan2(p1[:, 1] - p0[:, 1], p1[:, 0] - p0[:, 0])
          alpha2 = np.arctan2(p2[:, 1] - p0[:, 1], p2[:, 0] - p0[:, 0])
          # In the below formula we could take modulo 2. but
          # modulo 1. is safer regarding round-off errors (flat triangles).
          angle = np.abs(((alpha2 - alpha1) / np.pi) % 1)
          # Weight proportional to angle up np.pi/2; null weight for
          # degenerated cases 0 and np.pi (note that *angle* is normalized
          # by np.pi).
          weights[:, ipt] = 0.5 - np.abs(angle - 0.5)
      return weights
  
imports: import numpy
  from matplotlib import _api
  from matplotlib.tri import Triangulation
  from matplotlib.tri._trifinder import TriFinder
  from matplotlib.tri._tritools import TriAnalyzer
label_desc: Use image node_id 2 for calling the _DOF_estimator_geom obj's underlying member method code with example usage: obj.compute_geom_weights() and returns: weights