code: def triangle_areas(p1,p2,p3):
      
      v1 = (p2 - p1).astype(np.float)
      v2 = (p3 - p1).astype(np.float)
      # Original:
      #   cross1 = v1[:,1] * v2[:,0]
      #   cross2 = v2[:,1] * v1[:,0]
      #   a = (cross1-cross2) / 2
      # Memory reduced:
      cross1 = v1[:, 1]
      cross1 *= v2[:, 0]
      cross2 = v2[:, 1]
      cross2 *= v1[:, 0]
      a = cross1
      a -= cross2
      a /= 2.0
      del v1, v2, cross1, cross2
      a = a.copy()  # a is a view on v1; shed one dimension.
      a = np.abs(a)
      #
      # Handle small round-off errors
      #
      a[a<np.finfo(np.float32).eps] = 0
      return a
docs: Compute an array of triangle areas given three arrays of triangle pts
      
      p1,p2,p3 - three Nx2 arrays of points