$$\Delta_{ij} = (\theta_j - (\phi_{ij} + \theta_i)) (\bmod\:\pi/2) - \pi/4.$$

### Singularity Detection

The *index* of a triangle, $t_{ijk}$, with nodes $n_i$, $n_j$, and $n_k$ is the number given by $$\operatorname*{I}{(t_{ijk})} = \frac{\Delta_{ij} + \Delta_{jk} + \Delta_{ki} - \phi_{ij} - \phi_{jk} - \phi_{ki}}{2\pi}.$$

Practically, this is the number of turns that a cross makes while circulating the triangle, which is always an integer multiple of $\frac{1}{4}$. A triangle is *singular* if its index is non-zero. Summing the changes in cross orientation along each edge, we compute the total circulation of the cross around the triangle. On a flat surface, the total circulation must be a multiple of $\pi/2$; however, on curved surfaces, this is not the case. In general, a vector in the tangent bundle of $M$ parallel transported along a closed curve does not always return to the same orientation after circulating the curve. To mitigate the effects of *holonomy* while transporting a cross around the triangle, we subtract from the total circulation the angle defect that occurs when parallel transporting a vector around the triangle via our discrete connection. This angle defect is given by $\phi_{ij} + \phi_{jk} + \phi_{ki}$. Subtracting the angle defect from the total circulation 