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

Function centroidRingPoint

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

Source from the content-addressed store, hash-verified

132354 centroidPointCartesian(x0, y0, z0);
132355}
132356function centroidRingPoint(lambda, phi) {
132357 lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians);
132358 var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = (0, _mathJs.hypot)(cx, cy, cz), w = (0, _mathJs.asin)(m), v = m && -w / m; // area weight multiplier
132359 X2.add(v * cx);
132360 Y2.add(v * cy);
132361 Z2.add(v * cz);
132362 W1 += w;
132363 X1 += w * (x0 + (x0 = x));
132364 Y1 += w * (y0 + (y0 = y));
132365 Z1 += w * (z0 + (z0 = z));
132366 centroidPointCartesian(x0, y0, z0);
132367}
132368exports.default = function(object) {
132369 W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0;
132370 X2 = new (0, _d3Array.Adder)();

Callers 1

centroidRingEndFunction · 0.70

Calls 2

centroidPointCartesianFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected