MCPcopy Create free account
hub / github.com/microsoft/SandDance / areaPoint

Function areaPoint

docs/app/js/sanddance-app.js:131905–131915  ·  view source on GitHub ↗
(lambda, phi)

Source from the content-addressed store, hash-verified

131903 lambda0 = lambda, cosPhi0 = (0, _mathJs.cos)(phi = phi / 2 + (0, _mathJs.quarterPi)), sinPhi0 = (0, _mathJs.sin)(phi);
131904}
131905function areaPoint(lambda, phi) {
131906 lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians);
131907 phi = phi / 2 + (0, _mathJs.quarterPi); // half the angular distance from south pole
131908 // Spherical excess E for a spherical triangle with vertices: south pole,
131909 // previous point, current point. Uses a formula derived from Cagnoli’s
131910 // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).
131911 var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = (0, _mathJs.cos)(phi), sinPhi = (0, _mathJs.sin)(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * (0, _mathJs.cos)(adLambda), v = k * sdLambda * (0, _mathJs.sin)(adLambda);
131912 areaRingSum.add((0, _mathJs.atan2)(v, u));
131913 // Advance the previous points.
131914 lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
131915}
131916exports.default = function(object) {
131917 areaSum = new (0, _d3Array.Adder)();
131918 (0, _streamJsDefault.default)(object, areaStream);

Callers 1

areaRingEndFunction · 0.70

Calls 1

addMethod · 0.45

Tested by

no test coverage detected