MCPcopy
hub / github.com/mne-tools/mne-python / _get_tri_supp_geom

Function _get_tri_supp_geom

mne/surface.py:1618–1633  ·  view source on GitHub ↗

Create supplementary geometry information using tris and rrs.

(surf)

Source from the content-addressed store, hash-verified

1616
1617
1618def _get_tri_supp_geom(surf):
1619 """Create supplementary geometry information using tris and rrs."""
1620 r1 = surf["rr"][surf["tris"][:, 0], :]
1621 r12 = surf["rr"][surf["tris"][:, 1], :] - r1
1622 r13 = surf["rr"][surf["tris"][:, 2], :] - r1
1623 r1213 = np.ascontiguousarray(np.array([r12, r13]).swapaxes(0, 1))
1624 a = np.einsum("ij,ij->i", r12, r12)
1625 b = np.einsum("ij,ij->i", r13, r13)
1626 c = np.einsum("ij,ij->i", r12, r13)
1627 mat = np.ascontiguousarray(np.rollaxis(np.array([[b, -c], [-c, a]]), 2))
1628 norm = a * b - c * c
1629 norm[norm == 0] = 1.0 # avoid divide by zero
1630 mat /= norm[:, np.newaxis, np.newaxis]
1631 nn = fast_cross_3d(r12, r13)
1632 _normalize_vectors(nn)
1633 return dict(r1=r1, r12=r12, r13=r13, r1213=r1213, a=a, b=b, c=c, mat=mat, nn=nn)
1634
1635
1636@jit(parallel=True)

Callers 2

_make_morph_map_hemiFunction · 0.85
_project_onto_surfaceFunction · 0.85

Calls 2

fast_cross_3dFunction · 0.85
_normalize_vectorsFunction · 0.85

Tested by

no test coverage detected