-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.js
30 lines (26 loc) · 1.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* This module provides all required forces to regular ngraph.physics.simulator
* to make it 3D simulator. Ideally ngraph.physics.simulator should operate
* with vectors, but on practices that showed performance decrease... Maybe
* I was doing it wrong, will see if I can refactor/throw away this module.
*/
module.exports = createLayout;
createLayout.get2dLayout = require('ngraph.forcelayout');
function createLayout(graph, physicsSettings) {
var merge = require('ngraph.merge');
physicsSettings = merge(physicsSettings, {
createQuadTree: require('ngraph.quadtreebh3d'),
createBounds: require('./lib/bounds'),
createDragForce: require('./lib/dragForce'),
createSpringForce: require('./lib/springForce'),
integrator: getIntegrator(physicsSettings),
createBody: require('./lib/createBody')
});
return createLayout.get2dLayout(graph, physicsSettings);
}
function getIntegrator(physicsSettings) {
if (physicsSettings && physicsSettings.integrator === 'verlet') {
return require('./lib/verletIntegrator.js');
}
return require('./lib/eulerIntegrator')
}