mbostock/d3 — pull request #1231 by jasondavies (2013-05-05 10:34:19+00:00)
Title: d3.geo.bounds: antimeridian and inflection points.

The behaviour of d3.geo.bounds has been modified slightly, such that the
minimum and maximum longitudes denote minimum and maximum meridians when
going from left to right in a standard equirectangular projection.

If the maximum longitude is in fact numerically smaller than the
meridian, this simply means that the bounds cross the antimeridian.

This fixes several issues:

* The bounding box is now a true minimum-width bounding box.
* Line segments that cross the antimeridian are now correctly handled.
* Similarly, polygons that cross the antimeridian are now correctly
handled.

Secondly, inflection points are now detected, so that the latitudinal
range is extended in the case where the great arc contains the great
circle’s inflection point.

Lastly, support for polygons has been improved, e.g. those that wind
around the poles, and those that have a counter-clockwise winding order.

Note that as part of the winding order detection, the performance of
d3.geo.area had to be reduced somewhat (by as much as 25%). This is
because the trick to avoid atan2 calls fails for winding order detection
in the case where a counter-clockwise area strays into a positive
quadrant. We can reinstate the trick for area-only calculations in
future; I think correct winding order detection is more important at the
moment.

See #1154 (remaining: handling of null-like features and geometries).