Optimise d3.geo.resample.

This avoids recreating closures for handling polygon rings, which was
causing the V8 JIT to recompile them.