From IT Skills
Jump to: navigation, search

ngraph on github

uses ngraph.events

  • Offline layout

ngraph.native which is fully implemented in C++ and is 9x faster thant javsript version.

  • Interactive renderer
    • VivaGraph, one of the fastest graph drawing libraries is now constructed from ngraph modules.
    • ngraph.pixel - Fast 3D graph renderer based on low level ShaderMaterial from three.js

quad tree[edit]

2d or 3d


force layout3d[edit]

uses oct-tree or #quad tree and #simulator

createQuadTree: require('ngraph.quadtreebh3d'), 
// has random - Brownian analog - if radius == 0 
// and if (isSamePosition(oldBody.pos, body.pos)) - Prevent infinite subdivision by bumping one node anywhere in this quadrant
createBounds: require('./lib/bounds'), // has random in getBestNewPosition(neighbors) used in simulator.initBody

friction[edit]

'./lib/dragForce'

  • update
    • body.force.x -= options.dragCoeff * body.velocity.x;

spring-like attraction[edit]

'./lib/springForce'

  • random if radius == 0
  • update
    • var d = r - length;
    • var coeff = ((!spring.coeff || spring.coeff < 0) ? options.springCoeff : spring.coeff) * d / r * spring.weight;
    • body1.force.x += coeff * dx;

physics.simulator ... was merged into ngraph.forcelayout[edit]

2d or 3d

Ideally ngraph.physics.simulator should operate with vectors, but on practices that showed performance decrease...

simulator[edit]

has './lib/bounds' and './lib/springForce'

  • accumulateForces()
    • for every body if (!body.isPinned)
      • body.force.reset();
      • quadTree.updateBodyForce(body);
      • dragForce.update(body);
    • for every spring
      • springForce.update(springs[i])