Skip to content

Commit 0008bca

Browse files
committed
Optimize non-adaptive projection.
1 parent ff238b8 commit 0008bca

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

d3.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,8 +2855,29 @@
28552855
d[2] /= l;
28562856
}
28572857
var d3_geo_projectCosMinDistance = Math.cos(30 * d3_radians), d3_geo_projectMaxDepth = 16;
2858+
function d3_geo_projectPoint(f, sink) {
2859+
return {
2860+
point: function(x, y) {
2861+
x = f(x, y);
2862+
sink.point(x[0], x[1]);
2863+
},
2864+
lineStart: function() {
2865+
sink.lineStart();
2866+
},
2867+
lineEnd: function() {
2868+
sink.lineEnd();
2869+
},
2870+
polygonStart: function() {
2871+
sink.polygonStart();
2872+
},
2873+
polygonEnd: function() {
2874+
sink.polygonEnd();
2875+
}
2876+
};
2877+
}
28582878
d3.geo.project = function(f, δ, sink) {
28592879
if (arguments.length < 3) sink = δ, δ = 0;
2880+
if (!(+δ > 0)) return d3_geo_projectPoint(f, sink);
28602881
var δ2 = δ * δ, λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0;
28612882
var project = {
28622883
point: point,

0 commit comments

Comments
 (0)