MCPcopy Create free account
hub / github.com/jipegit/OSXAuditor / resampleLineTo

Function resampleLineTo

d3-3.2.8/d3.js:3403–3413  ·  view source on GitHub ↗
(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream)

Source from the content-addressed store, hash-verified

3401 return resample;
3402 }
3403 function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
3404 var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
3405 if (d2 > 4 * δ2 && depth--) {
3406 var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
3407 if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
3408 resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
3409 stream.point(x2, y2);
3410 resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
3411 }
3412 }
3413 }
3414 resample.precision = function(_) {
3415 if (!arguments.length) return Math.sqrt(δ2);
3416 maxDepth = (δ2 = _ * _) > 0 && 16;

Callers 2

linePointFunction · 0.85
ringEndFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected