def _project_onto_surface(rrs, surf, project_rrs=False):
 surf_geom = _get_tri_supp_geom(surf)
 coords = np.empty((len(rrs), 3))
 tri_idx = np.empty((len(rrs),), int)
 for (ri, rr) in enumerate(rrs):
  tri_idx[ri] = _find_nearest_tri_pt(rr, surf_geom)[2]
  coords[ri] = _triangle_coords(rr, surf_geom, tri_idx[ri])
 weights = np.array([((1.0 - coords[:, 0]) - coords[:, 1]), coords[:, 0], coords[:, 1]])
 out = (weights, tri_idx)
 if project_rrs:
  out += (np.einsum('ij,jik->jk', weights, surf['rr'][surf['tris'][tri_idx]]),)
 return out

def _project_onto_surface ( rrs , surf , project_rrs = False ) : surf_geom = _get_tri_supp_geom ( surf ) coords = np . empty ( ( len ( rrs ) , 3 ) ) tri_idx = np . empty ( ( len ( rrs ) , ) , int ) for ( ri , rr ) in enumerate ( rrs ) : tri_idx [ ri ] = _find_nearest_tri_pt ( rr , surf_geom ) [ 2 ] coords [ ri ] = _triangle_coords ( rr , surf_geom , tri_idx [ ri ] ) weights = np . array ( [ ( ( 1.0 - coords [ : , 0 ] ) - coords [ : , 1 ] ) , coords [ : , 0 ] , coords [ : , 1 ] ] ) out = ( weights , tri_idx ) if project_rrs : out += ( np . einsum ( 'ij,jik->jk' , weights , surf [ 'rr' ] [ surf [ 'tris' ] [ tri_idx ] ] ) , ) return out
project points onto surface .