I'm trying to work out how best to locate the centroid of an arbitrary shape draped over a unit sphere, with the input being ordered (clockwise or anti-cw) vertices for the shape boundary. The density of vertices is irregular along the boundary, so the arc-lengths between them are not generally equal. Because the shapes may be very large (half a hemisphere) it is generally not possible to simply project the vertices to a plane and use planar methods, as detailed on Wikipedia. A slightly better approach involves the use of planar geometry manipulated in spherical coordinates, but again, with large polygons this method fails, as nicely illustrated here. On that same page, @Cffk highlighted a paper which describes a method for calculating the centroid of spherical triangles. I've tried to implement this method, but haven't yet succeeded in calculating centroids that seem to fall in the proper place.
My attempt is implemented in Python and posted on StackOverflow here. I can copy the code over if wanted, but basically what I want to know is if the method described in the paper is applicable to a more complicated polygon boundary. Specifically by (1) stepping the base of the triangles along paired vertices (c.w. or c.c.w. ordered) of the polygon boundary, (2) calculating sub-centroids for each of these triangles and then (3) adding the area-scaled elements of the sub-centroids together to get a centroid value for the polygon as a whole.
In short, I am treating the equations in the paper as a 3d extension of the commonly-used method of determining the area and centroid of a planar polygon, but something doesn't appear to be holding up, and at the moment it seems more likely a flaw in the math or my logic than in the construction of the python code.