1.0.7 • Published 3 years ago

force-n-body v1.0.7

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

force-n-body

Force-n-body algorithm with Barnes-Hut Algorithm acceleration.

npm.io

API

  • nodes: nodes to compute forces
  • weightFunc: each node's weight specifying function, default is () => 30
  • return: force vectors array
function forceNBody(
  nodes: { x: number; y: number }[],
  weightFunc?: (node?: { x: number; y: number }) => number
): { vx: number; vy: number }[];

function forceNBodyBruteForce(
  nodes: { x: number; y: number }[],
  weightFunc?: (node?: { x: number; y: number }) => number
): { vx: number; vy: number }[];

Reference

  1. http://arborjs.org/docs/barnes-hut
  2. https://github.com/d3/d3-force
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago