Rather than doing something like picking the last seen point, return
an undefined centroid if it is ambiguous.
Users can decide what to do, e.g. when picking an origin for a rotating
globe, using the last coordinate in a MultiPoint or LineString seems
reasonable in an ambiguous situation.
This allows us to generate the clip outline for whole-earth projections
with arbitrary rotations.
Internally, this is interpreted as a polygon with null coordinates.
This reverts commit 7712dcd59e.
Unfortunately, this caused empty polygons to be interpreted as "the
whole sphere", which is undesirable. Also, it is more useful to have a
definite graticule outline, at least for a graticule that doesn't cover
the whole sphere.
This fixes various problems that were occurring due to winding numbers
being tricky on a finite sphere.
This also includes some cleanup and fixes for degenerate points.
1. We no longer perform an equality check on GeoJSON polygon endpoints,
since we know that the first and last points should be equal.
2. However, there are special cases where a polygon just touches the
clip edge, generating two coincident intersection points. Here we avoid
generating a coincident point, and continue as normal.
3. Another special case is where we have coincident intersection points
e.g. due to a self-intersecting polygon. Here we continue calculating
the winding number as if this is a closed polygon (so we know whether to
insert a polygon around the whole clip edge).
It's not always meaningful to define the centroid of a collection because
collections are heterogenous: they can contain points, lines, polygons, or all
these types together. The previous code ignored objects that had dimensionality
lower than the collection's maximum dimensionality; for example, ignoring lines
and points if the collection contains polygons. While this may be what you want,
this feels magical and it's simpler to just define the centroid as undefined.
I'd prefer to force the user to state what they want explicitly, say by creating
a MultiPolygon that merges together a collection's polygons.