(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream)
| 2855 | return resample; |
| 2856 | } |
| 2857 | function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { |
| 2858 | var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; |
| 2859 | if (d2 > 4 * δ2 && depth--) { |
| 2860 | 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; |
| 2861 | if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3) { |
| 2862 | resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); |
| 2863 | stream.point(x2, y2); |
| 2864 | resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); |
| 2865 | } |
| 2866 | } |
| 2867 | } |
| 2868 | resample.precision = function(_) { |
| 2869 | if (!arguments.length) return Math.sqrt(δ2); |
| 2870 | maxDepth = (δ2 = _ * _) > 0 && 16; |
no outgoing calls
no test coverage detected