MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / forceSize

Function forceSize

code/chapter/22_fast.js:49–56  ·  view source on GitHub ↗
(distance, connected)

Source from the content-addressed store, hash-verified

47var repulsionStrength = 1500;
48
49function forceSize(distance, connected) {
50 let repulse = -repulsionStrength / (distance * distance);
51 let spring = 0;
52 if (connected) {
53 spring = (distance - springLength) * springStrength;
54 }
55 return spring + repulse;
56}
57
58function forceDirected_simple(layout, graph) {
59 for (let a = 0; a < graph.size; a++) {

Callers 4

forceDirected_simpleFunction · 0.85
forceDirected_noRepeatFunction · 0.85
forceDirected_skipFunction · 0.85
forceDirected_noVectorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected