@@ 3205-3216 (lines=12) @@ | ||
3202 | d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; |
|
3203 | d3_geo_centroid.point = d3_geo_centroidPoint; |
|
3204 | }; |
|
3205 | function nextPoint(λ, φ) { |
|
3206 | λ *= d3_radians; |
|
3207 | var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u); |
|
3208 | d3_geo_centroidX2 += v * cx; |
|
3209 | d3_geo_centroidY2 += v * cy; |
|
3210 | d3_geo_centroidZ2 += v * cz; |
|
3211 | d3_geo_centroidW1 += w; |
|
3212 | d3_geo_centroidX1 += w * (x0 + (x0 = x)); |
|
3213 | d3_geo_centroidY1 += w * (y0 + (y0 = y)); |
|
3214 | d3_geo_centroidZ1 += w * (z0 + (z0 = z)); |
|
3215 | d3_geo_centroidPointXYZ(x0, y0, z0); |
|
3216 | } |
|
3217 | } |
|
3218 | function d3_geo_compose(a, b) { |
|
3219 | function compose(x, y) { |
|
@@ 3175-3183 (lines=9) @@ | ||
3172 | d3_geo_centroid.point = nextPoint; |
|
3173 | d3_geo_centroidPointXYZ(x0, y0, z0); |
|
3174 | }; |
|
3175 | function nextPoint(λ, φ) { |
|
3176 | λ *= d3_radians; |
|
3177 | var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); |
|
3178 | d3_geo_centroidW1 += w; |
|
3179 | d3_geo_centroidX1 += w * (x0 + (x0 = x)); |
|
3180 | d3_geo_centroidY1 += w * (y0 + (y0 = y)); |
|
3181 | d3_geo_centroidZ1 += w * (z0 + (z0 = z)); |
|
3182 | d3_geo_centroidPointXYZ(x0, y0, z0); |
|
3183 | } |
|
3184 | } |
|
3185 | function d3_geo_centroidLineEnd() { |
|
3186 | d3_geo_centroid.point = d3_geo_centroidPoint; |