Fix two bugs in projection stream caching.

The cached stream must be invalidated when the precision changes, and when the
context is changed.
Fix another bug in projection stream caching.
Add area-weighted geographic polygon centroids.

This generalises the centre of mass formula given in:

  J. E. Brock, The Inertia Tensor for a Spherical Triangle,
  J. Applied Mechanics 42, 239 (1975)

In addition, centroids of zero-extent features now fall back to the
centroid of the feature treated as a lower dimension, i.e. polygons →
lines → points.

Specifically, if the centroid of a polygon or multipolygon feature is
ambiguous, it will treat it as a set of lines.  Similarly (but not
exactly the same), if a line or set of lines has zero length, it will be
treated as a set of points.

This also applies to d3.geo.path.centroid, except that the fallback
always occurs if the feature has zero extent (area or length).  For
geographic polygons, it was simpler to fall back if the centroid was
undefined, as area is not tracked in a simple fashion.

Fixes #1011.

Optimised d3_acos, and used d3_asin and d3_acos where appropriate
instead of Math.min and Math.max.
Remove spurious dependency.
Don’t invalidate when precision changes.

The stream doesn’t capture the current value of the precision, so there’s no
reason to invalidate the stream when the precision changes. This partially
reverts commit 9a2fb5817efb414a7945a45429d11845954b91af.
Add missing import. Fixes #1292.
Use relative error for intersections. Fixes #1075.
Merge pull request #1294 from mbostock/pack

Use relative error for intersections. Fixes #1075.
Fix comment.
Optimise d3.geo.resample.

This avoids recreating closures for handling polygon rings, which was
causing the V8 JIT to recompile them.
Use point-in-polygon test for winding order.

This point-in-polygon algorithm uses the same area calculation as
d3.geo.area, inlined for performance.

Fixes #1300.
Add support for parsing weekdays and week numbers.

Also includes support for parsing "%" literals.
Remove a couple of comments that no longer apply.
...
Merge remote-tracking branch 'remotes/mbostock-original/3.2'

Conflicts:
	d3.js
	d3.min.js
	src/geo/centroid.js
	src/time/format.js
- fixup merges with vanilla 3.2 and earlier;

- included the performance tweak for force layout too: only invoke functors when the parameters require the per-node call/function overhead.
Merge branch 'master' into all_scales_have_subticks; also corrected spelling for force.neighbours() --> force.neighbors() (rest of the code uses US spelling, so this bit should be US too)

Conflicts:
	d3.latest.js
	src/interpolate/interpolate.js
	src/layout/force.js
	src/scale/threshold.js