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 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.
Rather than producing separate files for each module, the default build now
produces a single file. This should encourage better page-load performance as
the files were relatively small. Also, it's easier to deal with only one file
rather than many, especially if you're not quite sure what the dependencies are.
You may still create minimized builds, if you don't want every feature.
This commit also demotes the chart components to the examples directory, rather
than keeping them as part of the core library. As always, D3 is not a charting
library, and these were ever only intended to serve as examples.
This can be used with d3.geo.path.clip to clip the input coordinates of
geographical shapes using a given origin and angular radius, e.g. for
hemispherical or near-hemispherical views. Geodesics are inserted as
necessary.
This also includes a minor bugfix and test for d3.geo.path: the last
coordinate of Polygon features was being included unnecessarily
(MultiPolygon already handled this correctly).