Create supplementary geometry information using tris and rrs.
(surf)
| 1616 | |
| 1617 | |
| 1618 | def _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) |
no test coverage detected