Adjust centroid fallback slightly.

A polygon centroid will fall back to length-weighting if the
area-weighted centroid is undefined.  However, the length-weighted
centroid will only fall back to the point centroid if the feature has
zero length.  This is so that a great-circle LineString will have an
undefined centroid, rather than its centroid being the first or last
point.
Clean up tests.
Slightly more efficient.