Defining the winding number on a sphere

700 Views Asked by At

This is for “point-in-polygon” testing on the sphere.

I’ve defined a spherical polygon as a list of points on the sphere, coupled with whether the corresponding great circle arcs on the sphere are the longer one or the shorter one. Of the two regions of the sphere the polygon creates, the “interior” is the one enclosed by the “counter-clockwise” polygon.

Since you can rotate a sphere any direction, the problem is basically determining if the north pole of the sphere is within the interior of the polygon. There seems to be 4 cases:

  1. polygon encloses neither north pole nor south pole. (w = 0)

  2. polygon encloses north pole only. (w = 1, 2, 3 …)

  3. polygon encloses south pole only. (w = −1, −2, −3, …)

  4. polygon encloses both poles. (w = ?)

I think the normal rule, point is inside if and only if the winding number is not 0 works for cases 1 and 2. Case 3 I think can be covered if we narrow it to if and only if the winding number is greater than 0, since such a polygon would always have a negative winding number. But how do you account for case 4?

My question is: do I have a valid point-in-polygon test for cases 1–3, and if so, how can I extend it to cover case 4? I suspect it would have a winding number of 0, but I don’t know if this is true other than a few simple examples, and that’s clearly not helpful since it contradicts the test for the other 3 cases.