flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

67
VISUALIZACION/node_modules/d3-force-3d/src/radial.js generated vendored Executable file
View file

@ -0,0 +1,67 @@
import constant from "./constant.js";
export default function(radius, x, y, z) {
var nodes,
nDim,
strength = constant(0.1),
strengths,
radiuses;
if (typeof radius !== "function") radius = constant(+radius);
if (x == null) x = 0;
if (y == null) y = 0;
if (z == null) z = 0;
function force(alpha) {
for (var i = 0, n = nodes.length; i < n; ++i) {
var node = nodes[i],
dx = node.x - x || 1e-6,
dy = (node.y || 0) - y || 1e-6,
dz = (node.z || 0) - z || 1e-6,
r = Math.sqrt(dx * dx + dy * dy + dz * dz),
k = (radiuses[i] - r) * strengths[i] * alpha / r;
node.vx += dx * k;
if (nDim>1) { node.vy += dy * k; }
if (nDim>2) { node.vz += dz * k; }
}
}
function initialize() {
if (!nodes) return;
var i, n = nodes.length;
strengths = new Array(n);
radiuses = new Array(n);
for (i = 0; i < n; ++i) {
radiuses[i] = +radius(nodes[i], i, nodes);
strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
}
}
force.initialize = function(initNodes, ...args) {
nodes = initNodes;
nDim = args.find(arg => [1, 2, 3].includes(arg)) || 2;
initialize();
};
force.strength = function(_) {
return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
};
force.radius = function(_) {
return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius;
};
force.x = function(_) {
return arguments.length ? (x = +_, force) : x;
};
force.y = function(_) {
return arguments.length ? (y = +_, force) : y;
};
force.z = function(_) {
return arguments.length ? (z = +_, force) : z;
};
return force;
}