ngraph.forcelayout3d
Advanced tools
Comparing version 1.0.1 to 1.2.0
@@ -1,2 +0,2 @@ | ||
var physics = require('ngraph.physics.primitives'); | ||
var physics = require('ngraph.forcelayout/lib/primitives'); | ||
@@ -3,0 +3,0 @@ module.exports = function(pos) { |
@@ -10,3 +10,3 @@ /** | ||
function integrate(bodies, timeStep) { | ||
function integrate(bodies, timeStep, adaptiveTimeStepWeight) { | ||
var dx = 0, tx = 0, | ||
@@ -19,4 +19,7 @@ dy = 0, ty = 0, | ||
for (i = 0; i < max; ++i) { | ||
var body = bodies[i], | ||
coeff = timeStep / body.mass; | ||
var body = bodies[i]; | ||
if (adaptiveTimeStepWeight && body.springCount) { | ||
timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount); | ||
} | ||
var coeff = timeStep / body.mass; | ||
@@ -23,0 +26,0 @@ body.velocity.x += coeff * body.force.x; |
@@ -15,3 +15,3 @@ /** | ||
options = merge(options, { | ||
springCoeff: 0.0002, | ||
springCoeff: 0.8, | ||
springLength: 80 | ||
@@ -41,3 +41,3 @@ }); | ||
var d = r - length; | ||
var coeff = ((!spring.coeff || spring.coeff < 0) ? options.springCoeff : spring.coeff) * d / r * spring.weight; | ||
var coeff = ((!spring.coeff || spring.coeff < 0) ? options.springCoeff : spring.coeff) * d / r; | ||
@@ -47,2 +47,4 @@ body1.force.x += coeff * dx; | ||
body1.force.z += coeff * dz; | ||
body1.springCount += 1; | ||
body1.springLength += r; | ||
@@ -52,2 +54,4 @@ body2.force.x -= coeff * dx; | ||
body2.force.z -= coeff * dz; | ||
body2.springCount += 1; | ||
body2.springLength += r; | ||
} | ||
@@ -54,0 +58,0 @@ }; |
{ | ||
"name": "ngraph.forcelayout3d", | ||
"version": "1.0.1", | ||
"version": "1.2.0", | ||
"description": "Force directed graph layout in 3d", | ||
@@ -34,5 +34,4 @@ "main": "index.js", | ||
"ngraph.expose": "^1.0.0", | ||
"ngraph.physics.primitives": "^1.0.0", | ||
"ngraph.forcelayout": "^1.0.1" | ||
"ngraph.forcelayout": "^1.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120383
5
3260
- Removedngraph.physics.primitives@^1.0.0
- Removedngraph.physics.primitives@1.0.0(transitive)
Updatedngraph.forcelayout@^1.2.0