# Algorithms for computing winding numbers of 2-sphere maps

I have a question concerning computational geometry which arises in the simulation of fields with topological defects, and I'd like to know whether there's an efficient algorithm (or any algorithm) to solve it.

The problem is basically the following: consider a grid cell $\mathcal{C}$ in a 3-D cubical grid. On each of the eight vertices of this grid cell, we are given a triplet of numbers $(a_i, b_i, c_i)$ such that $a_i^2 + b_i^2 + c_i^2 = 1$ for each $i = 1 \dots 8$. By triangulating the surface of the cube (which we denote $\partial \mathcal{C}$) and linearly interpolating between the vertices of each triangle in $\partial \mathcal{C}$, we can define a map $f : \partial \mathcal{C} \to \mathbb{R}^3$. Let us assume that the image of this map does not contain 0, i.e., the map so defined is actually from $f: \partial \mathcal{C} \to \mathbb{R}^3 \setminus\{0\}.$

We have thus defined a map from a space homeomorphic to $S^2$ ($\partial \mathcal{C}$) to a space that has a non-trivial second homotopy group $\pi_2$. This map may or may not be contractible, and in fact it should have some notion of a winding number associated with it. My questions are:

• Is there an algorithm that, given the vertex values $(a_i, b_i, c_i)$ for a triangulated cube, calculates a winding number for the map $f$ so defined?
• Is there an algorithm that, given the vertex values $(a_i, b_i, c_i)$ for a triangulated cube, calculates whether the map $f$ so defined is nulhomotopic? (This is obviously a weaker question than the first one, but if this is all that can be done I wouldn't be too disappointed.)

I would not be surprised if this question has been addressed in the literature somewhere, but it's quite hard to google for it: every reference to "winding number" seems to be for maps of 1-D curves into some space rather than 2-D spheres.