(p0, p1)
| 3880 | // p0 = [ux0, uy0, w0] |
| 3881 | // p1 = [ux1, uy1, w1] |
| 3882 | function zoom(p0, p1) { |
| 3883 | var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], |
| 3884 | ux1 = p1[0], uy1 = p1[1], w1 = p1[2], |
| 3885 | dx = ux1 - ux0, |
| 3886 | dy = uy1 - uy0, |
| 3887 | d2 = dx * dx + dy * dy, |
| 3888 | i, |
| 3889 | S; |
| 3890 | |
| 3891 | // Special case for u0 ≅ u1. |
| 3892 | if (d2 < epsilon2$1) { |
| 3893 | S = Math.log(w1 / w0) / rho; |
| 3894 | i = function(t) { |
| 3895 | return [ |
| 3896 | ux0 + t * dx, |
| 3897 | uy0 + t * dy, |
| 3898 | w0 * Math.exp(rho * t * S) |
| 3899 | ]; |
| 3900 | }; |
| 3901 | } |
| 3902 | |
| 3903 | // General case. |
| 3904 | else { |
| 3905 | var d1 = Math.sqrt(d2), |
| 3906 | b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), |
| 3907 | b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), |
| 3908 | r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), |
| 3909 | r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); |
| 3910 | S = (r1 - r0) / rho; |
| 3911 | i = function(t) { |
| 3912 | var s = t * S, |
| 3913 | coshr0 = cosh(r0), |
| 3914 | u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); |
| 3915 | return [ |
| 3916 | ux0 + u * dx, |
| 3917 | uy0 + u * dy, |
| 3918 | w0 * coshr0 / cosh(rho * s + r0) |
| 3919 | ]; |
| 3920 | }; |
| 3921 | } |
| 3922 | |
| 3923 | i.duration = S * 1000 * rho / Math.SQRT2; |
| 3924 | |
| 3925 | return i; |
| 3926 | } |
| 3927 | |
| 3928 | zoom.rho = function(_) { |
| 3929 | var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; |
nothing calls this directly
no test coverage detected